Taylor polynomials' plots begin to look odd in graphing software for high-degree polynomials

96 Views Asked by At

I was playing around with Taylor approximations using some graphing software. I am using $-\sin\left(x\right)\approx-x+\frac{1}{3!} x^{3}-\frac{1}{5!} x^{5}+ \ldots$.

When I turn the Taylor polynomial into a Sum notation, to make the degree of the polynomial easier to vary, I notice that, for smaller-degree polynomials (say, take $k=10$ in the link above), the plotted curve looks smooth. However, for larger $k$, say $k>50$, the plotted curve begins to show "breaks" in it, or to look "hairy" somehow.

Is this a fundamental feature of the underlying polynomial, or a computing issue of some sort?

If the former, then is the lesson here that Taylor/Maclaurin approximations about a point $x=c$ are fundamentally only good within a certain range of $c$, for any degree polynomial? E.g. if I want an approximation that's good near $x=100$, could I in principle calculate the polynomial at $x=0$ and just expand it to a high enough degree (ignoring efficiency concerns etc.)? Or at some point would I have to change what the starting $c$ of my polynomial was?

If this is a computing issue only, then any ideas what is happening? Because e.g. the same software has no issues in drawing the original curve $y=-\sin\left(x\right)$ for $x$ values beyond where it seems to struggle to draw the polynomial (assuming that it is struggling). So how is it drawing the sine curve in the first place, if not by computing a polynomial approximation?

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

tl; dr: It's the latter, a numerical issue.

An absolutely convergent power series $$ \sum_{k=0}^{\infty} a_{k}(x - x_{0})^{k} $$ has the pleasant property that for every positive integer $n$, and for $|x - x_{0}| \leq |R|$, $$ \biggl|\sum_{k=n+1}^{\infty} a_{k}(x - x_{0})^{k}\biggr| \leq \sum_{k=n+1}^{\infty} |a_{k}|\, |x - x_{0}|^{k} \leq \sum_{k=n+1}^{\infty} |a_{k}| |R|^{k}. $$ Consequently, if the series converges absolutely at a point $x_{0} + R$, then the tails dominate the convergence on $[x_{0} - |R|, x_{0} + |R|]$.

Since the sine, cosine, and exponential series have infinite radius, they converge absolutely for all real (or complex) $x$. This has two implications for your question:

  1. For each real $x$, you can approximate $\sin x$ as closely as you like with some Taylor polynomial centered at $x_{0} = 0$.

  2. For a Taylor polynomial in 1., the approximation is at least as good on $[-|x|, |x|]$ as it is at $x$.

2
On

Any polynomial $p(x)$ of high degree goes very rapidly to $\pm \infty$ as $x \to \pm \infty$, so it can only be a good approximation of a bounded function on a certain interval, and outside that interval it will typically grow very rapidly. That interval grows as the degree of the Taylor polynomial increases: since $\sin$ is an entire function, it eventually grows arbitrarily large.

Here is an animation of $\sin(x)$ and its Taylor approximations of degree up to $39$.

enter image description here