UC SCI 111
Demo Taylor series

Taylor[args__] := Normal[Series[args]]

Here are some standard Taylor series at the point x=0. We start with the geometric series

Taylor[1/(1 - x), {x, 0, 20}]

Then the exponential function

Taylor[Exp[x], {x, 0, 10}]
Sum[x^n/n!, {n, 0, 10}]

The function sin(x) and cos(x)

Taylor[Sin[x], {x, 0, 10}]
Taylor[Cos[x], {x, 0, 10}]

The function log(1-x)

Taylor[Log[1 - x], {x, 0, 10}]

The following Taylor series shows that there need not be an obvious pattern in the coeffcients

Taylor[Tan[x], {x, 0, 20}]

We now study how good Taylor approximations are to the actual functions. We start with the function sin(x). The following command gives the (7th order) Taylor polynomial of sin(x) at the point x=0.

ser = Taylor[Sin[x], {x, 0, 7}]

Here you see a combined plot of the sine function and its Taylor polynomial.

Plot[{Sin[x], ser}, {x, 0, 6*Pi}]

Now let us change the 7 into something bigger and repeat the experiment. We will see that the range of validity of the Taylor approximations increase with the order.

Let us do the same with the function (1/((x^2) + 1))

ser = Taylor[1/(x^2 + 1), {x, 0, 5}]

And let us make some combined plots

Plot[{1/(x^2 + 1), ser}, {x, -1.5, 1.5}, 
      PlotRange -> {-0.5, 2}]

Instead of order 5 take higher order Taylor approximations. Unlike the sine approximations the range of validity of the approximations stay within -1 < x < 1. This has to do with diverge of the infinite Taylor series when |x|≥1.