MathStudio  Blog  Share  Manual  Forums  Support 
Post Format

Taylor Polynomials using MathStudio

I recently demonstrated the built-in function Taylor(function, var, n, [val], [mode]), which computes the Taylor Polynomial of degree n.

The idea is that a “nice” enough function f(x) can be represented exactly as an infinite series, which we say is centered at some point a,  and then a truncation yields a polynomial that is an approximation to f(x).  The form of this series is

\displaystyle f(x) = \sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!}(x-a)^k

and the Taylor Polynomial of degree n is

\displaystyle f(x) \approx \sum_{k=0}^n\frac{f^{(k)}(a)}{k!}(x-a)^k.

It is of course desireable to know something about the error in this approximation, and luckily there is an analogous result to the Mean Value Theorem which says that

\displaystyle f(x) =\sum_{k=0}^n\frac{f^{(k)}(a)}{k!}(x-a)^k + R_n(z),

where we have regained equality by introducing a residual term, which is given by

\displaystyle R_n(z) = \frac{f^{(n+1)}(z)}{(n+1)!} (x-a)^{n+1}

where z is some number between a and x (we say between these two numbers since we could have a<x or a>x).

In MathStudio, the Taylor Polynomial of degree 7 centered at 1 for \sin(x) can be found by Taylor(sin(x),x,7,1).  The resulting polynomial will have terms like (x-1)^k with coefficients.  This is a standard way of writing the polynomial, but if you wanted the expanded form, then you can add another parameter Taylor(sin(x),x,7,1,1).

Plot(sin(x),Taylor(sin(x),x,7,1,0)

One important question that should be asked is whether a Taylor polynomial or Taylor Series will converge to the function for any choice of x.  Since not all series converge, this is an important question; the answer is that the Taylor polynomial will converge to the function for all x within the radius of convergence.  I will not delve into the topic of radius of convergence here, but as an example see the plot of the Taylor polynomial for \tan^{-1}(x) below.

Plot(atan(x),Taylor(asin(x),x,7,0,0))

It seems that no matter how large we take n, we only get convergence inside of the region -1 <x < 1.  There are indeed very good reasons for this, and I hope this post is enough to motivate you to read further!

Leave a Reply