Basically a new branch of mathematics was created around this special number (or concept), and now imaginary numbers are used in numerical and mathematical applications. Combining a real number with an imaginary number forms a single entity known as a complex number. A complex number is any ordered pair of floating point real numbers (x, y) denoted by x + y j where x is the real part and y is the imaginary part of a complex number.
Here are some facts about Python’s support of complex numbers:
Imaginary numbers by themselves are not supported in Python
Complex numbers are made up of real and imaginary parts
Syntax for a complex number: real+imag j
Both real and imaginary components are floating point values
Imaginary part is suffixed with letter “J” lowercase ( j) or upper (J)
The following are examples of complex numbers:
Complex Number Built-in Attributes
The data attributes are the real and imaginary components of the complex number object they belong to. Complex numbers also have a method attribute which can be invoked, returning the complex conjugate of the object.
>>> aComplex = -8.333-1.47j >>> aComplex (-8.333-1.47j) >>> aComplex.real -8.333 >>> aComplex.imag -1.47 >>> aComplex.conjugate() (-8.333+1.47j)
Complex Number Attributes
|num.real||real component of complex number num|
|num.imag||imaginary component of complex number num|
|num. conjugate()||returns complex conjugate of num|