Instructor Hentzel Office Phone: 515-294-8141 E-mail: hentzel@iastate.edu Math Department Fax: 515-294-5454 http://www.math.iastate.edu/hentzel/class.166.08 Textbook: Calculus by Varberg, Purcell, Rigdon, ninth edition. Monday, April 7, 9.9 Taylor Approximation Assignment: Page 503: 2, 4, 6, 8, 50 Main Idea: (n) (n+1) f (0) f (c) n+1 Key Words: -------- ----------- x n! (n+1)! Taylor Series, Maclaurin Series about any point a. Goal: Be able to express any function as a power series and compute an error bound. -------------------------------------------------------- Previous assignment: p495:(4),(8),(16),(28) 5 Find the terms through x in the Maclaurin series for f(x). Page 495 Problem 4 -x f(x) = e Cos[x] -x -x e Sin[x] e Cos[x] -x ______________________________ e Sin[x] | -1 +1 | | | | | -x | | e Cos[x] | -1 -1 | |____________________________| | -1 -1 | 0 -1 2 -2 0 4 | 1 -1 | 1 -1 0 2 -4 4 Evaluate at zero 1 -1 0 2 -4 4 0 2 2 3 -4 4 4 5 f(x) = 1 -x + --- x + ---- x + ---- x + ---- x 2 3! 4! 5! ----------------------------------------------------- 2 3 4 5 2 4 f(x) = (1 -x + x /2 - x /3! +x /4! - x /5!)(1 - x /2! + x /4!) 2 3 4 5 f(x) = (1 -x + x /2 - x /3! +x /4! - x /5!) 2 3 4 5 -x /2 + x /2 -x /4 + x /12 4 5 +x /4! - x /4! ------------------------------------------------------------ 2 3 -4 4 4 5 f(x) = 1 -x + ---- x + --- x + ----- x 3! 4! 5! --------------------------------------------------------------------- Get["font.math"]; f[x_] := 1 -x +0/2 x^2 +2/3! x^3 -4/4! x^4 + 4/5! x^5; g[x_] := E^(-x) Cos[x]; a = Plot[f[x],{x,-4,4},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[g[x],{x,-4,4}]; c = Show[a,b,PlotLabel->"P495 p4 red=series S5;black=e^(-x) Cos[x]"]; Display["p4.ps",c]; -------------------------------------------------------- 5 Find the terms through x in the Maclaurin series for f(x). Page 495 Problem 8 2 Cos[x] - 1 + x /2 f(x) = ----------------------- 4 x 2 4 6 8 2 1 - x /2 + x /4! - x /6! + x /8! - 1 + x /2 f(x) = ----------------------------------------------------- 4 x 4 6 8 + x /4! - x /6! + x /8! f(x) = ----------------------------------------------------- 4 x 2 4 f(x) = 1/4! -x /6! + x /8! --------------------------------------------------------------------- Get["font.math"]; f[x_] := 1/4! -x^2/6! + x^4/8!; g[x_] := (Cos[x]-1+x^2/2)/x^4; a = Plot[f[x],{x,-4,4},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[g[x],{x,-4,4}]; c = Show[a,b,PlotLabel->"P495 p8: red=series;black=(Cos[x]-1-x^2/2)/x^4"]; Display["p8.ps",c]; ---------------------------------------------------- Page 495 Problem 16 Cos[x] f(x) = ----------- Sqrt[1+x] 2 3 4 5 6 Sqrt[1+x] = 1 + 1/2 x - 1/8 x + 1/16 x - 5/128 x + 7/256 x - 21/1024 x 2 3 5 5 (1/2)/Sqrt[1+x] = 1/2 - 1/4 x + 3/16 x -5/32 x +35/256 x - 63/512 x 2 3 5 5 1/Sqrt[1+x] = 1 - 1/2 x + 3/8 x -5/16 x +35/128 x - 63/256 x 2 4 Cos[x] = 1 - x /2 + x /24 --------------------------------------------------------------------------- 2 3 4 5 1 - 1/2 x + 3/8 x -5/16 x +35/128 x - 63/256 x 2 3 4 5 -1/2 x + 1/4 x - 3/16 x + 5/32 x 4 5 1/24 x - 1/48 x --------------------------------------------------------------------------- 2 3 4 5 1 - 1/2 x -1/8 x -1/16 x + (35/128-3/16+1/24) x +(-63/256+5/32-1/48)x 2 3 4 5 1 - 1/2 x -1/8 x -1/16 x + 49/384 x -85/768 x ---------------------------------------------------------------------------- Get["font.math"]; f[x_] := 1-1/2 x-1/8 x^2-1/16 x^3+(35/128-3/16+1/24) x^4+(-63/256+5/32-1/48)x^5; g[x_] := Cos[x]/Sqrt[1+x]; a = Plot[f[x],{x,-4,4},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[g[x],{x,-1,4}]; c = Show[a,b,PlotLabel->"P495 p18: red=series S5;black=Cos[x]/Sqrt[1+x]"]; Display["p18.ps",c]; ---------------------------------------------------------------------- Page 495 Problem 28 Given that -1 x 1 sinh x = INT --------------- dt 0 2 Sqrt[1+t ] find the first four nonzero terms in the Maclaurin -1 series for sinh x x 1 f(x) = INT -------------- dt 0 2 Sqrt[1+t ] 2 3 4 Sqrt[1+x] = 1 + 1/2 x -1/8 x + 1/16 x -5/128 x -1/2 2 3 1/2 (1+x) = 1/2 - 1/4 x + 3/16 x -5/32 x -1/2 2 3 (1+x) = 1 - 1/2 x + 3/8 x - 5/16 x 2 -1/2 2 4 6 (1+x ) = 1 - 1/2 x + 3/8 x - 5/16 x x 1 3 5 7 INT ----------- dx = x - 1/6 x + 3/40 x - 5/112 x 0 2 Sqrt[1+x ] --------------------------------------------------------------------- Get["font.math"]; f[x_] := x - 1/6 x^3 + 3/40 x^5 - 5/112 x^7; g[x_] := ArcSinh[x]; a = Plot[f[x],{x,-4,4},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[g[x],{x,-4,4}]; c = Show[a,b,PlotLabel->"P495 p28: red=series;black=INT 1/Sqrt[1+t^2]"]; Display["p28.ps",c]; ---------------------------------------------------- New Material More on series and the remainder term. We have three ways to estimate error. (a) For a positive decreasing function Infinity R <= INT f(x) dx n n (b) For a decreasing alternating function the error is less than the first omitted term. (n+1) f (c) n+1 (c) For any function Error = ----------- x (n+1)! How many terms are needed to approximate ln(2) to within 0.0001? n+1 Infinity (-1) ln(2) = SUM --- n=1 n 1 want ------ < 0.0001 n+1 1 ------ < n+1 0.0001 10,000 < n+1 Use 10,000 terms. Approx ln(2) difference 0.693097 0.693147 -0.0000499975 --------------------------------------------- Get["font.math"]; a = Sum[-(-1)^n/n,{n,1,10000}]; b = Log[2]; a = N[a]; b = N[b]; Print[a," ",b," ",a-b," "]; --------------------------------------------- How many terms are necessary to approximate Sin[x] to within 0.0001 on [-1,1]; (n+1) n+1 f (c) n+1 x 1 Error(n) <= ------------ x <= -------- <= ------- (n+1)! (n+1)! (n+1)! n 1 2 3 4 5 6 7 8 n+1 2 3 4 5 6 7 8 9 n+1 x 1 1 1 1 1 1 1 1 (n+1)! 2 6 24 120 720 5040 40320 362880 .5 .17 .04 .008 .0013 .0002 .0000248 .00000276 use n=7 3 5 7 Sin[x] = x - x /3! + x /5! -x /7! ------------------------------------------------------------------ Get["font.math"]; f[x_] := x - x^3/3! + x^5/5! -x^7/7!; g[x_] := Sin[x]; a = Plot[f[x],{x,-3,3},PlotStyle->{Thickness[0.005]}]; b = Plot[g[x],{x,-3,3},PlotStyle->{RGBColor[1,0,0],Thickness[0.01]}]; c = Show[b,a, PlotLabel->"Degree 7 Approximation to Sin[x] red=series,black=Sin[x]"]; Display["sinx.ps",c]; d = Plot[ f[x]-g[x],{x,-1.5,1.5}]; e = ListPlot[{{-1,f[-1]-g[-1]},{1,f[1]-g[1]}}, PlotStyle->{RGBColor[1,0,0],Thickness[0.01]}]; h = Plot[{0.0001,-0.0001},{x,-1.5,1.5},PlotStyle->{RGBColor[0,0,1]}]; k = Show[d,e,h, PlotLabel->"Error for Sin using degree 7 polynomial",PlotRange->All]; Display["siny.ps",k]; -------------------------------------------------------------- Here is a somewhat useful trick. Expansion about a point other than x = 0. To expand a function about a point a, think of f(x) = g(a+x). Then / // 2 /// 3 (n) n f(x) = g(a) + g (a) x+g (a)/2 x + g (a)/3! x + ... +g (a) /n! x + ... This has all the properties we know, except that x measures the distance from a, not from zero. diverges converges diverges ---------------0-----------------------(----------a---------)----- This is usually written as / // 2 (n) n g(x) = g(a) + g (a) (x-a) + g (a)/2 (x-a) + ... + g (a)/n! (x-a) + ... -------------------------------------------------------------------- Write the power series for y = Sin[x] about x = Pi/4. --------------------------------------------------------------------- Pi -Pi 2 -Pi 3 -Pi 4 (x - ---) (x - ---) (x - ---) (x - ---) 1 4 4 4 4 ------- + --------- - ---------- - ---------- + ---------- + Sqrt[2] Sqrt[2] 2 Sqrt[2] 6 Sqrt[2] 24 Sqrt[2] -Pi 5 -Pi 6 (x - ---) (x - ---) 4 4 ----------- - ----------- 120 Sqrt[2] 720 Sqrt[2] ----------------------------------------------------- Write the power series for y = ln(x) about x=1. 2 3 4 5 ( x - 1) ( x - 1) ( x - 1) ( x - 1) ( x - 1) - --------- + --------- - --------- + --------- 2 3 4 5 Compare this series to the familiar y = ln(1+x) -------------------------------------------------------- 2 3 4 5 x x x x x - -- + -- - -- + -- 2 3 4 5 -------------------------------------------------------------- Get["font.math"]; f[x_] := Sum[ (-1)^(n+1) (x-1)^n/n,{n,1,100}]; g[x_] := Sum[ (-1)^(n+1) x^n/n,{n,1,100}]; a = Plot[f[x],{x,0,2.06},PlotStyle->{RGBColor[1,0,0],Thickness[0.005]}]; b = Plot[Log[x],{x,0.01,5},PlotStyle->{Thickness[0.003]}]; c = Show[a,b,PlotLabel->"red=series about 1;black=ln(x)"]; Display["logx.ps",c]; d = Plot[g[x],{x,-1,1.06},PlotStyle->{RGBColor[1,0,0],Thickness[0.005]}]; e = Plot[Log[1+x],{x,-0.95, 4},PlotStyle->{Thickness[0.005]}]; h = Show[d,e,PlotLabel->"red=series for ln(1+x); black = ln(1+x)"]; Display["logy.ps",h]; ----------------------------------------------------------------------