I created a program to find high degree Taylor series approximations for any function, but I notice an interesting behavior as higher order polynomials are included. My understanding is that a function such as f(x) = sin(x) is entire, and can be represented infinitely, since it is continuous and differentiable at any point. However, after my Taylor series powers go beyond ~50, the graph becomes hypersensitive and "noisy".
I am posting this to ask if there are flaws in my understanding of these types of power series, or if there is a good explanation of this behavior. I also wonder whether it is preventable in order to obtain a very high order representation of an oscillating function.
I have attached some photos of the described behavior.
The Taylor series for $\sin(x)$ does converge to $\sin(x)$ for every $x$, but that doesn't mean it is very good in practice for approximating $\sin(x)$. Consider a particular Taylor polynomial $$S_N(x) = \sum_{n=0}^N \frac{f^{(n)}(0)}{n!} x^n$$ where $f^{(n)}(0) = 1$ for $n = 1, 5, 9, \ldots$, $-1$ for $3, 7, 11, \ldots$, $0$ otherwise. If $N$ is large that is an extremely good approximation to $f(x)$ when $x$ is very close to $0$. But it is a polynomial of degree $N$ (if $N$ is odd), and so it grows rapidly for large $|x|$, while $f(x) = \sin(x)$ is bounded on the real line. So if you compare the graphs of $f$ and $S_N$, you should see $S_N$ following $f$ very closely on some interval around $0$ and then shooting off to $+\infty$ or $-\infty$ rapidly. The larger $N$ is, the larger the interval where it is a good approximation.
But that's assuming exact arithmetic. The terms that made $S_{50}(x)$ large are still present in $S_{100}(x)$, they are just cancelled by other terms. When you do the calculations numerically, the inevitable rounding errors mean that the cancellation is not exact. A sum of large numbers of different signs that should almost cancel is a recipe for disaster in numberical work. That is what produces the "noisy" result.
EDIT: Here are $\sin(x)$ (blue) with $S_{99}(x)$ (red) and $S_{199}(x)$ (green) as plotted in Maple using Digits = 100 (i.e. $100$ decimal digit arithmetic). This seems to be enough for the interval in the plot.
And here is the same with the default setting (which used hardware floating-point, roughly equivalent to $16$ digits). Note that $S_{99}$ seems to still be OK, but $S_{199}$ gives "chaotic" results for $x > 35$ or so.