Case Study · Math · Analysis
Onto the Curve: Taylor Series, Term by Term
The idea
Here is one of the quietly astonishing facts of calculus. If you know a smooth function’s value at a single point, and its slope there, and its curvature, and the rate the curvature changes, and so on through every derivative, then for a great many functions you know the whole function. Not near the point, the whole thing. All the information spread across the graph has been folded back into an infinite list of numbers taken at one spot.
The recipe that unfolds it is the Taylor series. Around (the Maclaurin case, which is all either plate uses) it reads
Each term is a correction: the constant matches the height, the linear term matches the slope, the quadratic bends the line into the curve, and every term after tunes a finer wiggle. Cut the sum off after terms and you have a polynomial , the best polynomial of its degree for hugging the curve near zero. The question the first plate is built to make visible is what happens as grows: does close in on across the whole picture, or only on part of it?
The approach
The first plate carries five functions whose series are worth knowing by heart:
The first three are entire: their series converge for every real , so as you drag the term count up, the green partial sum swings out to meet the true curve farther and farther from the origin, and the fit never stops improving. The last two are different. Both have a radius of convergence of exactly , drawn as the pair of dashed vertical lines, and outside that band the partial sums do not just approximate badly, they run off to infinity while the true function sits there perfectly smooth. Watching for blow up to the left of , where is a calm , is the whole lesson of the radius in one image.
A note on the arithmetic. Summing directly overflows the factorial fast, so neither plate ever forms a factorial. Each carries a term from the last by a ratio: for the step is , for the trig series it folds in the that turns one term into the next, and so on. That keeps every partial sum exact to double precision out to the term cap, which is what lets the reported error fall to for eˣ before floating point, not the mathematics, sets the floor. The idea (and the appetite for watching a series converge one term at a time) comes from a small Java routine I wrote years ago that summed configurable numbers of Taylor terms for the exponential and the trig functions; this is that experiment rebuilt as a picture.
| terms N | Pₙ(1) | error vs e |
|---|---|---|
| 1 | 1.000000 | 1.7e+0 |
| 2 | 2.000000 | 7.2e-1 |
| 4 | 2.666667 | 5.2e-2 |
| 8 | 2.718254 | 2.8e-5 |
The radius is not an accident of these two examples; it is a shadow cast from the complex plane. A real function like looks flawless on the real line except at , where it has a pole, and is fine except at , where it dives to negative infinity. The Taylor series cannot see the real line in isolation: it converges in a disk around the expansion point whose radius reaches exactly to the nearest place the function misbehaves anywhere in the complex plane. The two singularities sit at distance from the origin, so the radius is , and the real interval is that disk seen edge-on. The entire functions have no singularity anywhere, so their disk is the whole plane, which is why eˣ and the trig series converge everywhere.
Where the fact fails
The opening claim carried a hedge, and the hedge is where the mathematics is. For a great many functions you can rebuild the whole graph from derivatives at a point; for the rest you cannot, and the rest are not exotic. Every specimen in the plate below is infinitely differentiable at every real number, with no corner, no jump, and no vertical asymptote anywhere on the line. Each one breaks the recipe anyway, and the three break it in two different ways.
The first way is the more unsettling, because nothing diverges at all. Take
a smooth, gentle bump that sits flat against the axis near the origin and climbs toward in both directions. Differentiate it and every derivative comes out as some polynomial in multiplied by , and that exponential goes to zero faster than any power of can grow. So every derivative at the origin is exactly . Feed those into the recipe and the Maclaurin series is , the zero polynomial, for every you ask for. The series converges beautifully. It converges for every real , absolutely, instantly, and it converges to the wrong function. Smoothness is not analyticity, and this is the standard counterexample that separates them.
The second way is the radius again, arriving where nothing on the real line asked for it. The function is bounded by , defined everywhere, and as well behaved as anything on this page, and its series still quits at . Squeeze the bump and it gets worse: has radius , so the polynomial that is supposed to know the whole function knows a fifth of the unit interval. The reason is the one the previous section gave. The poles of sit at , and those of at : off the real line entirely, invisible from the line, and setting the radius from there.
That explanation covers the flat bump too, which is why the second plate draws both panels side by side. Follow up the imaginary axis instead of along the real one, at , and the exponent becomes . The function does not settle down to zero as you approach the origin; it runs to infinity. The origin is an essential singularity, the disk of convergence has radius zero, and the smoothness on the real line was an artifact of approaching a bad point along the one direction that hides it.
| specimen | nearest singularity | radius | series equals f |
|---|---|---|---|
| e^(−1/x²) | essential, at 0 itself | 0 | never: Pₙ ≡ 0 |
| 1/(1+x²) | ±i | 1 | only on (−1, 1) |
| 1/(1+25x²) | ±i/5 | 0.2 | only on (−0.2, 0.2) |
On the real line
In the complex plane
The practical moral is a small shift in what you ask for. “Does the series converge?” is the wrong question, because the flat bump answers yes and is no help. The question is whether the remainder goes to zero, that is whether as grows, which is a claim about the gap rather than about the terms. For eˣ and the trig functions it does, everywhere, which is the promise the word entire is making. For the flat bump the remainder is itself at every , unchanged and unbudging, which is exactly what the readout reports when you drag the slider and watch a number refuse to move.
What I would build next
The first plate plots the partial sum and the true function and lets you read the gap between them, but it does not draw the remainder as its own object. Taylor’s theorem gives that gap a formula, the Lagrange remainder for some between and , and a natural next version would shade the guaranteed error band around so the reader sees not just that the fit is good but why it is provably good. The error I report is the measured maximum over the convergence interval, which is the empirical truth; the theorem’s bound is the companion claim I have not yet drawn.
Two limits sit at the edges. The expansion point is pinned at in both plates; the richer picture lets you slide the point and watch the disk of convergence travel with it, which is where Taylor series stop feeling like a party trick for nice functions and start being a local tool you aim. Under that change the second plate gets sharper rather than redundant, because sliding toward a pole is how you watch a radius shrink to nothing in real time.
The counterexamples have a plate of their own, Plate II, which is the half of the story that keeps the astonishing fact from turning into a superstition. One cautionary tale it still does not draw, and I want to be exact about which: Runge’s phenomenon is a statement about interpolation, that a high-degree polynomial pinned through equally spaced samples of oscillates violently near the ends of the interval. Plate II shows the same function failing as a Taylor series, which is a different mechanism with the same underlying cause (poles at , close to the real axis and invisible from it). Drawing the interpolation version needs a node sampler and a Lagrange basis rather than a term-by-term recurrence, so it is its own figure, and putting the two side by side (same function, two ways of failing, one explanation) is the version of this page I would build next.
This figure belongs to the same family as the rest of the approximation work on the site: the continued-fractions plate asks the same “how close, how fast” question for rationals instead of polynomials, the Fourier plate rebuilds a function from circles rather than from derivatives, and Newton’s method is the iteration that a truncated Taylor series, kept to first order, is secretly doing.