Taylor Polynomials

Taylor series review

If function f(x) has a power series representation centered at a, then that power series must be the Taylor series centered at a,
	f(x)=(Underoverscript[Σ, (n=0), ∞])(((f^((n)))(a))/(n!))(((x-a))^n)

Taylor polynomials

Definition

The (n^th) degree Taylor polynomial of f(x) centered at a is the partial sum of the Taylor series that goes up to and includes the (n^th) power of (x-a). If the Taylor series for f(x) centered at a converges to f(x) for a given value x, then the (n^th) Taylor polynomial of f(x) centered at a provides a polynomial approximation to f(x).

Taylor remainder

If you approximate a quantity, you need some way to analyze how good the approximation is. Consider the error=|approximation-exact|. Here the exact is a given function g(x) and the approximation is the (n^th) degree Taylor polynomial of g(x) centered at a.

Definition

The (n^th) Taylor remainder of g(x) centered at a is

(Subscript[R, n])(x)=g(x)-(Underoverscript[Σ, (k=0), n])(((g^((k)))(a))/(k!))(((x-a))^k)

In other words the error in using the (n^th) degree Taylor polynomial to approximate the function is error=|(Subscript[R, n])(x)|

Analyzing error

The Taylor series error estimate: If |(f^((n+1)))(x)|≤M for all values of x of interest, then

|(Subscript[R, n])(x)|≤(M/((n+1)!))|x-a((|)^(n+1)).

You can think of this roughly as the error on the interval is smaller than the largest "first neglected term" on the interval.

Questions

Let g(x)=sin(x).

What is the Taylor series centered at zero for g(x)?

What is a simple estimate for M in the remainder for this function? (|(g^((n+1)))(x)|≤M)

What degree Taylor polynomial for g(x) will approximate it with error less than 0.01 for |x|<1?

Table[{n,1/Factorial[n+1]<.01},{n,0,5}]
nterms=4(* Why does nothing change if you replace 4 with 3? *)
f[x_]:=Sin[x]
Series[f[x],{x,0,nterms}]
sn[x_]=Normal[Series[f[x],{x,0,nterms}]];
Plot[{f[x],sn[x]},{x,-1,1}]
Plot[{f[x]-sn[x]},{x,-1,1},PlotRange->All]

What degree Taylor polynomial for g(x) will approximate it with error less than 0.01 for |x|<2?

Table[{n,2^(n+1)/Factorial[n+1]<.01},{n,0,10}]
nterms=7 
f[x_]:=Sin[x]
Series[f[x],{x,0,nterms}]
sn[x_]=Normal[Series[f[x],{x,0,nterms}]];
Plot[{f[x],sn[x]},{x,-2,2}]
Plot[{f[x]-sn[x]},{x,-2,2},PlotRange->All]

What degree Taylor polynomial for g(x) will approximate it with error less than 0.01 for |x|<3?

Table[{n,3^(n+1)/Factorial[n+1]<.01},{n,0,12}]
nterms=10 (* why can I replace 10 with 9, but not 8? *) 
f[x_]:=Sin[x]
Series[f[x],{x,0,nterms}]
sn[x_]=Normal[Series[f[x],{x,0,nterms}]];
Plot[{f[x],sn[x]},{x,-3,3}]
Plot[{f[x]-sn[x]},{x,-3,3},PlotRange->All]

Questions

Let h(x)=ln(x).

What is the Taylor series centered at 1 for h(x)?

What is the interval of convergence for that Taylor series?

What is true about any estimate for M in the remainder for this function for the values of x in the interval of convergence?

What if we use the (5^th) degree Taylor polynomial, (Subscript[T, 5])(x), centered at 1 to approximate h(x) for |x-1|≤0.5? What is a good estimate for M?

Approximate ln(1.5) with (Subscript[T, 5])(1.5). What is an estimate of the error in this approximation?

nterms=5
f[x_]:=Log[x]
Table[{n,D[f[x],{x,n}]},{n,0,6}]
Series[f[x],{x,1,nterms}]
deriv[x_]=D[f[x],{x,nterms+1}]
Plot[Abs[deriv[x]],{x,0.5,1.5}]
3100/Factorial[nterms+1]*(1.5-1)^(nterms+1)
sn[x_]=Normal[Series[f[x],{x,1,nterms}]];
Plot[{f[x],sn[x]},{x,0.2,1.8}]
Plot[{f[x]-sn[x]},{x,0.2,1.8},PlotLabel->"Absolute Error"]

Questions

Let f(x)=(e^x).

What is the Taylor series centered at zero for (e^x)?

If we plan to use an (n^th) degree Taylor polynomial, (Subscript[T, n])(x), to approximate f(x) for -1≤x≤1, what is an estimate for M?

Find a value of n so that (Subscript[T, n])(x) approximates f(x) with error less than 0.0001 for all x with |x|≤1.

nterms=10
f[x_]:=Exp[x]
Series[f[x],{x,0,nterms}]
sn[x_]=Normal[Series[f[x],{x,0,nterms}]];
Plot[{f[x],sn[x]},{x,-1,1}]
Plot[{f[x]-sn[x]},{x,-1,1},PlotLabel->"Absolute Error"]