Taylor approximations to sin(x)

In class, we've discussed how truncating the Taylor series of a function gives us a polynomial approximation to that function, and that higher order truncations lead to more accurate approximations. I attempted to draw low order approximations to the function sin(x), and here will reproduce those graphics with (more attractive) computer generated pictures.

The graph I attempted to draw in class was the following:


where P1(x)=x, P3(x)=x-x^3/3!, and P5(x)=x-x^3/3!+x^5/5! are the first, third, and fifth order approximations to sin(x), respectively. It is easy to see in this picture that when x is between -0.2 and 0.2, all four functions are virtually indistinguishable. To emphasise this point, the following graph is identical to the one above, but zoomed-in closer to 0:


We see in this close-up of 0 that sin(x) (the red line) looks exactly like a straight line. Returning to the first image, we see that the third order approximation, P3(x) looks indistinguishable from sin(x) between -1 and 1, even though the line P1(x) and sin(x) no longer look the same that far away from 0, and the fifth order approximation, P5(x), stays close to sin(x) even further away from 0. To emphasise, we'll zoom in again, to the domain (-1.5,1.5) to see just where P3(x) starts to differ noticably from sin(x):

Let's now look at some higher order approximations to sin(x). A similar pattern to that above will continue--the higher the order of the Taylor polynomial, the closer the graph of the polynomial will be to sin(x) for more x. For example, consider the graph:


The red curve is still sin(x), and for a reference to compare to the previous graphs, I've included the first order approximation, P1(x), and the fifth order approximation, P5(x), which are blue and green, respectively. The higher order approximations are the 13th order approximation, P13(x), which looks close to sin(x) between -5 and 5, and the 29th order approximation, P29(x), which looks close to sin(x) between -11 and 11. Finally, for some personal amusement, below I've included a picture of the 99th order Taylor approximation to sin(x). You can see that this degree 99 polynomial stays close to sin(x) for much larger values of x, but then when they differ, they differ pretty catastrophically.