VOOZH about

URL: https://www.geeksforgeeks.org/python/complex-numbers-python-set-2-important-functions-constants/

⇱ Complex Numbers in Python | Set 2 (Important Functions and Constants) - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Complex Numbers in Python | Set 2 (Important Functions and Constants)

Last Updated : 15 Jul, 2022
Introduction to python complex numbers: Complex Numbers in Python | Set 1 (Introduction) Some more important functions and constants are discussed in this article. Operations on complex numbers : 1. exp() :- This function returns the exponent of the complex number mentioned in its argument. 2. log(x,b) :- This function returns the logarithmic value of x with the base b, both mentioned in its arguments. If base is not specified, natural log of x is returned. Output:
The exponent of complex number is : (1.4686939399158851+2.2873552871788423j)
The log(base 10) of complex number is : (0.15051499783199057+0.3410940884604603j)
  3. log10() :- This function returns the log base 10 of a complex number. 4. sqrt() :- This computes the square root of a complex number. Output:
The log10 of complex number is : (0.15051499783199057+0.3410940884604603j)
The square root of complex number is : (1.09868411346781+0.45508986056222733j)
  5. isfinite() :- Returns true if both real and imaginary part of complex number are finite, else returns false. 6. isinf() :- Returns true if either real or imaginary part of complex number is/are infinite, else returns false. 7. isnan() :- Returns true if either real or imaginary part of complex number is NaN , else returns false. Output:
Complex number is finite
Complex number is infinite
Complex number is NaN
  Constants There are two constants defined in cmath module, "pi", which returns the numerical value of pi. The second one is "e" which returns the numerical value of exponent.
Output:
The value of pi is : 3.141592653589793
The value of exponent is : 2.718281828459045
Complex Numbers in Python | Set 3 (Trigonometric and Hyperbolic Functions)  
Comment
Article Tags:
Article Tags: