Arrows and j
A complex number like 3 + 4j has two parts: a real part, 3, and an imaginary part, 4. Draw it on a plane: 3 steps right along the real axis, 4 steps up. The arrow from 0 to that point is the number.
Multiplying by j turns an arrow 90° anticlockwise and keeps its length: (3 + 4j)·j = −4 + 3j. Two quarter turns point it backwards, so j·j = −1. That is what j² = −1 means. Four quarter turns bring it home.
Impedance as an arrow
A 3 Ω resistor pushes back in step with the current: 3, on the real axis. At 50 Hz, a 12.7 mH coil adds about 4 Ω a quarter turn later: 4j. Add them tip to tail: the impedance Z = 3 + 4j Ω.
The two parts and the arrow form a right triangle. Its length, the magnitude |Z|, comes from Pythagoras: √(3² + 4²) = √25 = 5. So at 50 Hz this pair limits the current like a single 5 Ω resistor.
The angle from the real axis is θ = atan2(4, 3) = 53.13°. Length and angle together are the polar form: Z = 5∠53.13°. Going back is trig: 5·cos 53.13° = 3 and 5·sin 53.13° = 4.
Polar form and Ohm's law
Euler's formula, e^jθ = cos θ + j sin θ, is an arrow of length 1 at angle θ. Turn it to 53.13°, which is 0.927 radians, and stretch it 5 times: Z = 5e^j0.927. One expression holds the length and the angle.
The source gives V = 5∠0° V. Ohm's law, I = V / Z, divides arrows: divide the lengths, 5 ÷ 5 = 1, and subtract the angles, 0° − 53.13°. So the current is I = 1∠−53.13° A.
In parts, I = cos(−53.13°) + j sin(−53.13°) = 0.6 − 0.8j A. Check by multiplying: (0.6 − 0.8j)(3 + 4j) = 5. Multiplying undoes dividing: the lengths multiply, 1 × 5, and the angles add, −53.13° + 53.13° = 0°.
Waves and code
Spin both arrows 50 times a second. The voltage arrow's shadow on the real axis traces v = 5 cos ωt, ω = 2π·50. The current arrow trails by 53.13°, so its wave peaks 2.95 ms later. The fixed arrows V and I are phasors.
Python writes imaginary numbers with j, as engineers do, since i usually means current. In cmath, abs(Z) gives 5.0, cmath.phase(Z) gives the angle in radians, 0.927, and 5 / Z gives (0.6-0.8j).
Try it in the Python prompt
;; step 1/10 · Numbers with two parts >>> z = 3 + 4j >>> z.real, z.imag (3.0, 4.0) >>> type(z) <class 'complex'>
Mathematicians write i for √−1; electrical engineers and Python write j, because i (or I) already stands for current. 3 + 4j and 3 + 4i are the same number. Use atan2(b, a) or cmath.phase, not atan(b / a): atan cannot tell 3 + 4j from −3 − 4j (both have b / a = 4/3), while atan2 looks at both signs and returns the angle in the right quarter, between −180° and 180°.