Lab 9: Instructors’ notes

Week 9

MAT 229, Spring 2021

Taylor polynomials

The (n^th) degree Taylor polynomial for f(x) centered at a is
	(Subscript[T, n])(x)=f(a)+f'(a)(x-a)+(((f^((2)))(a))/(2!))(((x-a))^2)+(((f^((3)))(a))/(3!))(((x-a))^3)+…+(((f^((n)))(a))/(n!))(((x-a))^n)

Example

Compute the third degree Taylor polynomial for (Sqrt[x]) centered at 4, and define a function equal to it.

f[x_]:=Sqrt[x]

t3[x_]=f[4]+f'[4](x-4)+f''[4]/2(x-4)^2+f'''[4]/3!(x-4)^3

Plot[{f[x],t3[x]},{x,0,20}]

What are the first four derivatives of f(x) evaluated at 4? What are the first four derivatives of (Subscript[T, 3])(x) evaluated at 4?

Series command

For high degree Taylor polynomials use Mathematica’s Series command.

Series[Sqrt[x],{x,4,3}]

Enclose this with command Normal to get just the polynomial (or copy and paste). (Note: cannot use :=  when defining functions with Series. Use =.)

t10[x_]=Normal[Series[f[x],{x,100,10}]]

Plot[{Sqrt[x],t10[x]},{x,50,150}]

Taylor remainder

The (n^th) degree Taylor remainder for f(x) centered at a is the signed error between f(x) and its Taylor polynomial.
	(Subscript[R, n])(x)=f(x)-(Subscript[T, n])(x)
It provides a way to estimate the error without knowing what f(x) is. If you approximate f(x) with (Subscript[T, n])(x) for 
	|x-a|≤d
or
	-d≤x-a≤d
and M is the maximum value of |(f^((n+1)))(x)| for |x-a|≤d, then the Taylor series error estimate for these values of x is
	|(Subscript[R, n])(x)|≤(M/((n+1)!))|x-a((|)^(n+1))

Example

Use the third degree Taylor polynomial for (Sqrt[x]) centered at 4 to approximate (Sqrt[x]) for |x-4|≤2.

What are the values of x that satisfy |x-4|≤2?

[2,6]

What is the maximum value of |(f^((4)))(x)| for these values of x?

Plot[Abs[f'''''[x]],{x,2,6},PlotRange->All]

What is the maximum error in approximating (Sqrt[x]) with (Subscript[T, 3])(x) for these values of x?

k4=Abs[f''''[2.0]]

What is the maximum error in approximating (Sqrt[x]) with (Subscript[T, 4])(x), the fourth degree Taylor polynomial, for these values of x?

k4*(2)^4/4!

Plot[{f[x],t3[x]},{x,2,6}]
Plot[{f[x]-t3[x]},{x,2,6}]

What is the maximum error in approximating (Sqrt[x]) with (Subscript[T, 5])(x), the fifth degree Taylor polynomial, for these values of x?

t5[x_]=Normal[Series[f[x],{x,4,5}]]

Plot[Abs[f''''''[x]],{x,2,6},PlotRange->All]
k6=Abs[f''''''[2.0]]
k6*(2)^6/6!

Plot[{f[x],t5[x]},{x,2,6}]
Plot[{f[x]-t5[x]},{x,2,6}]