Complex Number Calculator
Perform arithmetic on complex numbers and convert between rectangular and polar form.
A = a + bi
B = a + bi
About this tool
Complex numbers extend arithmetic beyond the real number line by introducing an imaginary unit i (where i² = −1). This enables us to work with quantities involving square roots of negative numbers—crucial in electrical engineering, signal processing, quantum mechanics, and control systems. A complex number takes the form a + bi, where a is the real part and b is the imaginary part, and both can be visualized as coordinates on a 2D plane called the complex plane.
This calculator lets you perform fundamental operations: addition, subtraction, multiplication, and division of any two complex numbers, plus single-number operations like conjugation, modulus (absolute value), and conversion to polar form. For each result, you instantly see both rectangular form (a + bi) and polar form (r · e^(iθ)), making it easy to switch between representations. Whether you are analyzing AC circuits, designing filters, or solving differential equations, this tool eliminates tedious hand calculations and catches sign errors.
Frequently Asked Questions
Code Implementation
import cmath
import math
# Create complex numbers
z1 = 3 + 4j
z2 = 1 - 2j
# Arithmetic
print(z1 + z2) # (4+2j)
print(z1 - z2) # (2+6j)
print(z1 * z2) # (11-2j)
print(z1 / z2) # (-1+2j)
# Properties
print(z1.real) # 3.0
print(z1.imag) # 4.0
print(abs(z1)) # 5.0 (modulus)
print(z1.conjugate()) # (3-4j)
# Polar form
r, theta = cmath.polar(z1)
print(f"r={r:.3f}, theta={math.degrees(theta):.2f}°")
# r=5.000, theta=53.13°
# From polar back to rectangular
z_back = cmath.rect(r, theta)
print(z_back) # (3+4j)
# Complex math functions
print(cmath.exp(1j * math.pi)) # Euler: e^(i*pi) ≈ -1+0j
print(cmath.sqrt(-1)) # 1j
print(cmath.log(z1)) # complex logarithmComments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.