← All Labs
INTERACTIVE APPLET · ANALYSIS

Taylor Series — Peeling an Apple

A polynomial is a blunt object; a transcendental function like sin, exp or log is smooth and curved. Yet peel enough thin polynomial layers around a single point and they wrap the curve perfectly — locally. Drag the expansion point and slide it along the function; add terms and watch the approximation hug tighter and reach further. A violet radius-of-convergence ring shows exactly how far the peel can stretch before the series gives up.

Σ f⁽ⁿ⁾(a)/n! · (x−a)ⁿ

Polynomials becoming transcendental — locally

Successive approximations peel around a movable centre a
p5.js + KaTeX · live

DRIVE IT

CONTROLS

Function to approximate
Tip: you can also drag the orange dot on the canvas to move a.

WALKTHROUGH

    AHA
    A Taylor polynomial only knows one point — the value there, the slope, the curvature, the rate of change of curvature, and so on. From that single fingerprint of derivatives it reconstructs the whole curve nearby. Add terms and the match spreads outward, but only to the edge of the violet ring: the distance from the centre to the function's nearest trouble spot (a pole, a branch cut) sets a hard wall the series can never cross. exp, sin and cos have no such wall, so their peel reaches to infinity.
    Try 1/(1−x) centred at 0: the ring stops at x=1 no matter how many terms you add, because the function blows up there. Now drag the centre toward 1 and watch the ring shrink to nothing — and toward −1 and watch it grow.

    EXPLANATION

    The Taylor polynomial of degree \(N\) about a centre \(a\) is the unique degree-\(N\) polynomial whose first \(N\) derivatives at \(a\) match those of \(f\):

    \(\displaystyle P_N(x)=\sum_{k=0}^{N}\frac{f^{(k)}(a)}{k!}\,(x-a)^k.\)

    Each coefficient stores one more piece of local information — \(f(a)\) fixes the height, \(f'(a)\) the slope, \(f''(a)\) the curvature, and so on. Because the applet uses exact \(n\)-th derivatives (e.g. \(\frac{d^n}{dx^n}\sin x=\sin\!\big(x+\tfrac{n\pi}{2}\big)\), \(\frac{d^n}{dx^n}\frac{1}{1-x}=\frac{n!}{(1-x)^{n+1}}\)) the plotted polynomials are correct to machine precision.

    How good is the fit? The gap is captured by the Lagrange remainder: for some \(\xi\) between \(a\) and \(x\),

    \(\displaystyle f(x)-P_N(x)=\frac{f^{(N+1)}(\xi)}{(N+1)!}\,(x-a)^{N+1}.\)

    The \((N+1)!\) in the denominator is why adding terms crushes the error so fast — until \((x-a)^{N+1}\) outruns it. The turning point is the radius of convergence \(R\), given by Cauchy–Hadamard \(\tfrac1R=\limsup_n |c_n|^{1/n}\). For real-analytic functions \(R\) equals the distance from \(a\) to the nearest singularity in the complex plane: for \(\ln(1+x)\) that is \(x=-1\) so \(R=a+1\); for \(\tfrac{1}{1-x}\) it is \(x=1\) so \(R=|1-a|\); and \(e^x,\sin,\cos\) are entire, with no singularity anywhere, so \(R=\infty\). Inside the violet ring the remainder \(\to 0\) as \(N\to\infty\); outside it, the terms grow and no amount of peeling recovers the function.

    Further reading: Rudin, Principles of Mathematical Analysis §8 (power series & Taylor's theorem); or any complex-analysis text on the disc of convergence, which explains why a real function's series can be strangled by a singularity you never see on the real line.