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.05 Textbook: Calculus by Varberg, Purcell, Rigdon, eight edition. March 28 11.1 Taylor Approximation p485:1,(3),(5),9-12,17,(18),20,27,28,(39) Main Idea: First priority is to stay inside the interval of convergence. Second priority is to put a bound on your error. (n) (n+1) f (0) f (c) n+1 Key Words: -------- ----------- x n! (n+1)! Maclaurin Series, Taylor Series about any point a. Goal: Be able to express any function as a power series and compute an error bound. -------------------------------------------------------- Previous assignment: March 25 10.8 Taylor, Maclaurin p473:1-3,(6),7,(10),14,(17),18,(20),21-23,(28),32 Page 473 Problem 6 5 Find the terms through x in the Maclaurin series for f(x) = Sin[x] Sqrt[1+x] 3 5 2 3 4 (x - x /6 + x /120 )( 1 + x/2 - x /8 + x /16 -5/128 x ) 2 3 4 5 x 7 x x 19 x f(x) = x + -- - ---- - -- - ----- 2 24 48 1920 ------------------------------------------- f[x_] := Sin[x] Sqrt[1+x]; g[x_] := x + x^2/2 -7/24 x^3 - x^4/48 - 19/1920 x^5; a = Plot[f[x],{x,-1,2.5}]; b = Plot[g[x],{x,-1,2.5},PlotStyle->{RGBColor[1,0,0]}]; c = Show[a,b,PlotLabel->"P473 P6 black = Sin[x] Sqrt[1+x] red = series"]; Display["6.ps",c]; -------------------------------------------------------------------- What is the radius of convergence? (1/2)(-1/2)(-3/2)(-5/2)...(-(2(n+1)-3)/2) -------------------------------------- an+1 (n+1)! ---- = ----------------------------------------------------- an (1/2)(-1/2)(-3/2)(-5/2)...(-(2n-3)/2) ------------------------------------- n! an+1 1/2 - n ---- = ----------- an n+1 Limit an+1/an = 1 n->infinity ----------------------------------------------------------------------------------- Page 473 Problem 10 5 Find the terms through x in the Maclaurin series for 1 1 - ln(1+x) f[x] = ------ ln(-------- ) = ---------- 1+x 1+x 1+x 2 3 4 5 6 7 8 9 n n 1/(1+x) = 1 - x + x - x + x - x + x - x + x - x .. (-1) x 2 3 4 5 ln(1+x) = x - x /2 + x /3 -x /4 + x /5 2 3 4 5 1/(1+x) = 1 - x + x - x + x - x 2 3 4 5 2 3 4 5 f[x] = -(x - x /2 + x /3 -x /4 + x /5)(1 - x + x - x + x - x ) 2 3 4 5 2 3 4 5 f[x] = (-x + x /2 - x /3 +x /4 - x /5)(1 - x + x - x + x - x ) 2 3 4 5 3 x 11 x 25 x 137 x f[x] = -x + ---- - ----- + ----- - ------ 2 6 12 60 ----------------------------------------------------------------- f[x_] := - Log[1+x]/(1+x); g[x_] := -x + 3 x^2/2 - 11 x^3/6 + 25 x^4/12 - 137 x^5/60; a = Plot[f[x],{x,-0.7, 2.5}]; b = Plot[g[x],{x,-1, 2.5},PlotStyle->{RGBColor[1,0,0]}]; c = Show[a,b,PlotLabel->"P473 P10 black = -ln(1+x)/(1+x) red = series"]; Display["10.ps",c]; --------------------------------------------------------------------- f[x_,n_] := Sum[-(-1)^i x^i/i,{i,1,n}]; y = ParametricPlot[{0,y},{y,-5,5}]; A = Table[Plot[f[x,2^i],{x,-1.0, 1+2^(-i)},PlotPoints->200, PlotStyle->{RGBColor[0,1-i/10,i/10]}],{i,1,10}]; a = Show[A]; b = Plot[Log[1+x],{x,-0.95, 1.3},PlotStyle->{RGBColor[1,0,0]}]; c = Show[y,a,b,PlotLabel->"P473 P10 y = ln[1+x] using 2^i terms"]; Display["10x.ps",c]; f[x_,n_] := Sum[-(-1)^i x^i/i,{i,1,n}]; y = ParametricPlot[{1,y},{y,-5,5}]; A = Table[Plot[f[x,2^i],{x, 0.95, 1+1.6^(-i)},PlotPoints->200, PlotStyle->{RGBColor[i/10,1-i/10,i/10]}],{i,1,10}]; a = Show[A]; b = Plot[Log[1+x],{x, 0.95, 1.2},PlotStyle->{RGBColor[1,0,0]}]; c = Show[y,a,b,PlotLabel->"P473 P10 y = ln[1+x] using 2^i terms near x=1"]; Display["10y.ps",c]; ---------------------------------------------------------------- Page 473 Problem 17 5 Find the terms through x in the Maclaurin series for 3/2 f(x) = (1+x) f(0) = 1 1/2 f'(x) = 3/2 (1+x) f'(0) = 3/2 -1/2 f"(x) = 3/2 1/2 (1+x) f"(0) = 3/4 -3/2 f"'(x) = 3/2 1/2 (-1/2) (1+x) f"'(0) = -3/8 -5/2 f""(x) = 3/2 1/2 (-1/2) (-3/2) (1+x) f""(0) = +9/16 -7/2 f""'(x) = 3/2 1/2 (-1/2) (-3/2) (-5/2) (1+x) f""'(0) = -45/32 2 3 4 5 f(x) = 1 + 3/2 x + 3/4 x /2 -3/8 x /3! + 9/16 x /4! - 45/32 x /5! 2 3 4 5 f(x) = 1 + 3/2 x + 3 x/(2^2 2!) - 3 x /(2^3 3!) + 9 x /(2^4 4!) - 45 x /(2^5 5!) --------------------------------------------------------- c[n_] := Product[ 5/2 -i,{i,1,n}]; f[x_,n_] := 1 + Sum[c[i] x^i,{i,1,n}]; A = Table[Plot[ f[x,i],{x,-1,1},PlotStyle->{RGBColor[0,1-i/10,i/10]}], {i,1,10} ]; a = Show[A]; b = Plot[Sign[1+x] Abs[1+x]^(3/2),{x,-1,1},PlotStyle->{RGBColor[1,0,0]}]; q = Show[a,b,PlotLabel->"P473 P17 red:y = (1+x)^(3/2) black=series"]; Display["17.ps",q]; --------------------------------- What is the radius of convergence? an+1 3/2 1/2 (-1/2) (-3/2) (-5/2) .......... (-2(n+1)+5)/2 ) x^(n+1) /(n+1)! ---- =----------------------------------------------------------- an 3/2 1/2 (-1/2) (-3/2) (-5/2) ...(-2n+5)/2 x^n /n! an+1 (-2n+3)/2 ---- = ------- x So the series converges by the ratio test if an n+1 |x| < 1 It diverges at the endpoints because |an| goes off to infinity. ----------------------------------- c[n_] := Product[ 5/2 -i,{i,1,n}]; f[x_,n_] := 1 + Sum[c[i] x^i,{i,1,n}]; A = Table[{2*i,f[1.0,2*i]},{i,1,6}]; B = Table[{2*i+1,f[-1.0,2*i+1]},{i,1,5}]; a = ListPlot[A] b = ListPlot[B,PlotStyle->{RGBColor[1,0,0]}]; q = Show[a,b,PlotLabel->"P473 P17 The endpoint case |x| = 1",PlotRange->All]; Display["17x.ps",q]; --------------------------------------------------------- Page 473 Problem 20 3 Find the Taylor series in x-a through (x-a) . f(x) = Sin[x], a = Pi/6 f(x) = Sin[x] f(Pi/6) = 1/2 f'(x) = Cos[x] f'(Pi/6) = Sqrt[3]/2 f"(x) = -Sin[x] f"(Pi/6) = -1/2 f"'(x) = -Cos[x] f"'(Pi/6) = -Sqrt[3]/2 f(x)= 1/2 + Sqrt[3]/2 (x-Pi/6) - 1/2 (x-Pi/6)^2/2 - Sqrt[3]/2 (x-Pi/6)^3/3! -------------------------------------- f[x_] = Sin[x]; g[x_] := 1/2 + Sqrt[3]/2 (x-Pi/6) - 1/2 (x-Pi/6)^2/2 - Sqrt[3]/2 (x-Pi/6)^3/3!; y = ParametricPlot[{Pi/6,y},{y,-1,1},PlotStyle->{RGBColor[0,0,1]}]; a = Plot[f[x],{x,-2 Pi,2 Pi},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[g[x],{x,-2 Pi,2 Pi}]; c = Show[y,a,b,PlotLabel->"P473 P20 red=Sin[x] black=series about Pi/6"]; Display["20.ps",c]; ---------------------------------------------------------------------------- Page 473 Problem 28 Given that -1 x 1 sinh x = INT --------------- dt 0 Sqrt[1+t^2] find the first four nonzero terms in the Maclaurin -1 series for sinh x x 1 f(x) = INT -------------- dt 0 Sqrt[1+t^2] Sqrt[1+x] = 1 + 1/2 x -1/8 x^2 + 1/16 x^3 -5/128 x^4 1/2 (1+x)^(-1/2) = 1/2 - 1/4 x + 3/16 x^2 -5/32 x^3 (1+x)^(-1/2) = 1 - 1/2 x + 3/8 x^2 - 5/16 x^3 (1+x^2)^(-1/2) = 1 - 1/2 x^2 + 3/8 x^4 - 5/16 x^6 x 1 INT ----------- dx = x - 1/6 x^3 + 3/40 x^5 - 5/112 x^7 0 Sqrt[1+x^2] --------------------------------------------------------------------- f[x_] := x - 1/6 x^3 + 3/40 x^5 - 5/112 x^7 g[x_] := Integrate[1/Sqrt[1+t^2],{t,0,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->"P473 P28,black = INT 1/Sqrt[1+x^2] red=series"]; Display["28.ps",c]; ---------------------------------------------------- More on series and the remainder term. We have three ways to estimate error. (a) For a positive decreasing function Infinity Rn <= INT f(x) dx 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 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 --------------------------------------------- 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) f (c) n+1 Error(n) <= ------------ x (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 Sin[x] = x - x^3/3! + x^5/5! -x^7/7! ------------------------------------------------------------------ f[x_] := -Sin[x] + x - x^3/3! + x^5/5! -x^7/7! a = Plot[ f[x],{x,-1,1}]; b = Show[a,PlotLabel->"Error for Sin using degree 7 polynomial",PlotRange->All]; Display["e.ps",b]; f[x_] := x - x^3/3! + x^5/5! -x^7/7!; g[x_] := Sin[x]; a = Plot[f[x],{x,-3,3},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[g[x],{x,-3,3}]; c = Show[a,b,PlotLabel->"Degree 7 Approximation to (red)=Sin[x]"]; Display["s.ps",c]; -------------------------------------------------------------- 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 (n) f(x) = g(a) + g'(a) x + g''(a)/2 x^2 + g'''(a)/3! x^3 + ... + g /n! x^n + 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 (n) n g(x) = g(a) + g'(a) (x-a) + g"(a)/2 (x-a)^2 + ... + 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 (-1 + x) (-1 + x) (-1 + x) (-1 + x) (-1 + x) - --------- + --------- - --------- + --------- 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