Complex Numbers
Nerd Cafe
1. What Is a Complex Number?
Definition (Mathematics)
A complex number is a number of the form:
Where:
a is the real part,
b is the imaginary part,
i is the imaginary unit where:
Example:
Real part:
3
Imaginary part:
4
Python Representation
Output:
2. Basic Operations
Addition
Subtraction
Multiplication
Division
Python Operations
Output:
3. Modulus of a Complex Number
Formula:
Example:
Python:
Output:
4. Complex Conjugate
Definition:
The conjugate of
is
Python:
Output:
5. Polar Form of a Complex Number
Formula:
Convert
into:
Where:
Python:
Output:
6. Euler's Formula
So:
7. Convert Between Cartesian and Polar Forms
Python:
Convert to Polar:
Output:
Convert to Rectangular:
Output:
8. Powers and Roots
Power:
n-th Roots:
Python (Using cmath
):
cmath
):Output:
9. Plotting Complex Numbers (Optional Visualization)
Output:
Summary Cheat Sheet
Complex number
complex(a, b)
Real part
z.real
Imaginary part
z.imag
Conjugate
z.conjugate()
Modulus
abs(z)
Phase/angle
cmath.phase(z)
Polar form
cmath.polar(z)
Rectangular form
cmath.rect(r, θ)
Square root
cmath.sqrt(z)
Plotting
matplotlib
Keywords
complex numbers
, imaginary numbers
, real part
, imaginary part
, complex arithmetic
, addition
, subtraction
, multiplication
, division
, modulus
, complex conjugate
, polar form
, rectangular form
, Euler’s formula
, Python complex type
, cmath module
, plotting complex numbers
, argument of complex number
, powers of complex numbers
, roots of complex numbers
, nerd cafe
Last updated