Taylor Sine

Wave · y = f(x, t)

y = Σ_(k=0)^(floor(mod(t, 12))) (−1)^k · x^(2k+1)/factorial(2k+1)

Open in the app The dials and keys named below are the app's.

What it draws

The Taylor polynomial of sin(x), gaining a term a second. The first is x itself, the straight line every small-angle approximation uses. The next subtracts x³/6, the next adds x⁵/120, and the alternating signs and factorials continue to twelve terms before the count resets.

Near the origin each new term matters less, because x^(2k+1) shrinks faster than (2k+1)! grows. Away from it the opposite holds for a while, which is why the early curves swing so far.

Where it stops working

Watch the right-hand edge, at x = 4, where sin(4) = −0.76. One term puts the curve at 4.00, two overcorrect to −6.67, three to 1.87, five to −0.66, and by eight it has settled on −0.76. Each polynomial is exact at the origin and drifts further the further out it is read.

The useful range grows with the term count rather than the accuracy at a point. Five terms track the real sine within 0.01 out to x ≈ 3.25, and past that they leave. This series does converge everywhere in the end, unlike many, but only in the limit, and a polynomial of any fixed length is eventually beaten by its own highest power.

Try

  • Raise Span of x to 12. The curve tracks the sine across the middle and every partial sum still leaves it, now far enough out to run off the top.
  • Freeze it at three terms with sum((−1)^k · x^(2k+1)/factorial(2k+1), k, 0, 2). The overshoot at the edges stops moving and can be read off.
  • Swap in the cosine series, sum((−1)^k · x^(2k)/factorial(2k), k, 0, floor(mod(t, 12))). Even powers, and it starts from 1 rather than 0.
  • Try sum(x^k/factorial(k), k, 0, floor(mod(t, 12))). Without the alternating sign the series builds e^x, which climbs rather than waves.

Read more

Wave · y = f(x, t)