cmath
Complex-number versions of math functions — handy for AC phasor calculations.
Easy
import cmath
z = 230 * cmath.exp(1j * cmath.pi / 6) # 230 V at 30°
abs(z), math.degrees(cmath.phase(z))
cmath.polar(3 + 4j) # (5.0, 0.927…)
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.