Here is a classic trigonometry problem:
With the satellite dish pointed up 13 degrees above the ground, how far up will the Line of Sight (LOS) be after passing over 100 meters of ground? (To save a few sentences in our post, we will ignore the fact that the satellite dish will usually start a few meters above the ground.)
This is simple using any calculator with the trigonometry function tangent:
tan(ϕ) = opp/adj, so height = 100 * tan 13° (after 13° is converted to radians).
If you didn’t want to use a trigonometric function, however, what could you do? Another approach is complex numbers, and it is pretty simple. You simply need to rotate ϕ degrees up the unit circle (a basic operation with complex numbers), get the real and imaginary parts of that complex number, and use that proportion to figure out the opposite side of your problem triangle.
So, after raising e^i by 13 degrees (converted to radians) multiply 100 x (imag Z / real Z). In programming code, it looks like this:
#lang racket (define tau (* 2 pi)) (define rfact (/ tau 360)) (define (rise gnd deg) (let* ([rad (* deg rfact)] [Z (exp (* 0+1i rad))]) (/ (* gnd (imag-part Z)) (real-part Z)))) > (rise 100 13) 23.08681911255631
It gives geometrically sane results also if you use negative degrees or negative distances:
> (rise 100 -13) -23.08681911255631 > (rise -100 -13) 23.08681911255631 > (rise -100 13) -23.08681911255631
What if you don’t have or want to use the exp function (to raise e to some value). You instead start with an approximation of e^i, which happens to be
and then just raise that to ϕ.
Now, why would you want to use the complex number approach rather than the trig function? Well, to be honest I couldn’t think of a really compelling reason off the top of my head. An easy one would be if you were already using complex numbers for other reasons. Another would be if you wanted to use purely algebraic operations in your programming, say, on a computer board that did not have trigonometric functions built in. I suspect that the complex number approach is ultimately simpler and more efficient on the computational level, but since trigonometric functions are usually approximated with tables and with an algebraic exponential function, I couldn’t really say for sure off the top of my head.
In any case, it seems cool that complex numbers allow you to do an angle and distance trigonometry problem without trigonometry.