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.
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.
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.
Complex number is finite Complex number is infinite Complex number is NaN
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.
The value of pi is : 3.141592653589793 The value of exponent is : 2.718281828459045
This article is contributed by Manjeet Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Mathematical Functions in Python | Set 4 (Special Functions and Constants)
- Complex Numbers in Python | Set 3 (Trigonometric and Hyperbolic Functions)
- Array in Python | Set 2 (Important Functions)
- Mathematical Functions in Python | Set 2 (Logarithmic and Power Functions)
- Mathematical Functions in Python | Set 3 (Trigonometric and Angular Functions)
- Constants of Maths in Python
- Complex Numbers in Python | Set 1 (Introduction)
- Mathematical Functions in Python | Set 1 (Numeric Functions)
- Python program for addition and subtraction of complex numbers
- Multiply matrices of complex numbers using NumPy in Python
- Python Program to convert complex numbers to Polar coordinates
- Important differences between Python 2.x and Python 3.x with examples
- Extracting the real and imaginary parts of an NumPy array of complex numbers
- Serialize and Deserialize complex JSON in Python
- View Computer's Important Network Information Using Python
- NetworkX : Python software package for study of complex networks
- Python - Extract rows with Complex data types
- Selecting with complex criteria using query method in Pandas
- Statistical Functions in Python | Set 1 (Averages and Measure of Central Location)
- Python | Set 2 (Variables, Expressions, Conditions and Functions)