Back in October I published two posts involving the ubiquitous exponential function. [see: Circular Math and Fourier Geometry] The posts were primarily about Fourier transforms, but the exponential function is a key aspect of how they work.
We write it as ex or as exp(x) — those are equivalent forms. The latter has a formal definition that allows for the complex numbers necessary in physics. That definition is of a series that converges on an answer of increasing accuracy.
As a sidebar, I thought I’d illustrate that convergence. There’s an interesting non-linear aspect to it.
Because e is a transcendental number, calculations that use it usually are approximations to an acceptable precision. [There are some notable exceptions: e0=1 (by definition). Other examples include: eiπ=-1 (which is Euler’s Identity) and ei2π=+1, both for reasons explained in those previous two posts. Most answers aren’t as precise, though.]
The formal definition of the exp(x) function reflects this transcendental nature. In principle, it’s an infinite series of terms. In reality, we use enough terms to give us the precision we need for a given task.
Here’s the formal definition:
The infinity symbol over the big Sigma (Σ) indicates the series continues infinitely (the n below the Sigma is the index variable; here it’s assumed to begin at zero and increase by one for each term).
The above expands to and is calculated as:
For however many terms one chooses for n.
Note that this definition makes it easy for x to be a complex number (or a quaternion… or any type that supports multiplication and division). This definition is what gives e-to-the-power-of-something so much utility, and therefore presence, in mathematics and physics.
Note that the first term is always 1 because x0=1 and 0!=1.
Likewise, the second term is always x because x1=x and 1!=1.
That’s why the definition is sometimes written as:
So the answer is always 1 if we calculate only a single term. Calculating only two isn’t much better, it just adds 1 to the input, x. It’s the later terms that start to converge on the computed value — the more terms added, the more accurate the value.
The precision of the answer and the number of terms are correlated. This correlation is not linear. Convergence is quick “near zero,” but takes longer and longer with larger values. I’ll show you what I mean by that.
The image at the top of the post (and shown again to the right here) illustrates a simple calculation for a point on the complex unit circle. Each red dot represents one more term added to the sum.
We’re calculating: ei2πa, where a=3/8 (or 0.375).
That’s a point on the complex unit circle 3/8’s of the way around (an angle of 135°). In the image, we see the black lines and red dots converging on that point. Each dot represents a calculation of n terms (beginning at one).
The first dot, on the far right of the circle, represents calculating just one term — which, of course, is just 1 (which, as a complex number, is [1+0i]).
The second dot (two terms), is 1+(i2π×0.375), which is the complex number [1+(~2.36)i]. That’s the second red dot in the upper right of the image.
In this case, further calculations quickly converge on approximately the right point, and calculations after that refine the value with increasing precision.
Notice that by eight terms, we’re fairly close to the correct point. By 12 terms we’re even closer, and with 20 terms we’d have a very useful answer.
Circles are circular, so we can calculate the same point, but after going fully around the circle (360°+135°=495°). To calculate that, we add 1.0 (one full revolution) to a, to give us a=1.375 (whereas before it was 0.375).
Going around once takes us “further from zero” (135° vs 495°), and this means we don’t converge as quickly. Here’s an illustration:
The four panels show different zoom levels and an increasing number of terms in the calculation.
The upper-left, which is zoomed out to -50 to +50 (horizontally and vertically) isn’t zoomed out enough to show all the points. Note the tiny blue unit circle in the center. This calculation involves 20 terms. The first two terms are the same as above, but then it diverges hugely before returning to the general location of the unit circle.
The upper-right uses 24 terms. The first term is the red dot on the right; the 20th term is the red dot on the far left — that’s where the previous panel left off.
The lower-left adds two more terms (26 total), and now the point is generally in the right location.
The lower-right adds yet two more terms (28 total) for a reasonably precise answer. We could round up to make it 30 for a good answer here whereas the same point only took 20 when we were “closer to zero.”
It isn’t necessary to go fully around the circle to need more terms. Even points “later” in the circle need more precision (“later” meaning getting closer to all the way around).
Here’s a peek at what happens with a point 7/8’s around the circle (at the angle of 315°):
In this case the points don’t jump quite as far afield. In the left panel, which shows 12 terms, I only had to zoom out to -30 by +30 to capture them all. Notice that those 12 terms don’t even get us in the right quadrant.
The right panel (16 terms) converges on a better answer; 20 terms would probably provide a sufficiently precise one. (The red dot in the lower left of the right image is where the left image left off.)
However, in reality, in all cases, we’d probably do at least 100 terms, and that would give us very good precision for cases generally “close to zero.” But because of chaos, cases far from zero blow up eventually, even with 100 terms.
Note that e0=1, which is ultimately close to zero, is also what we get using a single term for any input — at zero, that first term is accurate. For an extremely small angle, two terms would be fairly close.
We can see the effect of increasing angle if we try to draw a circle. That is, if we try to draw a number of points on the complex unit circle:
The 16 panels, left-to-right and top-to-bottom, represent that calculation using 1 to 16 terms. As you see, increasing the number of terms wraps more and more of the points around the circle.
In the upper-left, N=1, so all the points are at [1,0i]. In the second panel, N=2, so the points are just 1+x, which stacks them in a vertical line.
By N=3, the points are starting to wrap around the circle. As N increases, more points wrap around. However, even by N=16, they points don’t quite form a circle.
Note how some number of initial points are reasonably close, but further ones diverge wildly — they run off towards infinity. At the end, it’s only the last points that are seriously off.
Of course, if we calculated more points — ones representing a second time around the circle — we’d continue to see severe divergence. It would be even worse on a third time around the circle.
The larger the angle, the more terms necessary for even a reasonable answer.
The reason calculations diverge “further from zero” has to do with the calculus of what’s really happening in an infinite series like the one that defines the exp(x) function.
It has to do with derivatives and the increasing powers in the series. As usual, Grant Sanderson, of 3Blue1Brown, has a really great video that explains:
Once again, I have to commend the channel to anyone with an interest in math. There aren’t any better, and few that come close.
Stay exponential, my friends! Go forth and spread beauty and light.