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. Friday, April 4, 9.8 Taylor, Maclaurin Assignment: page 495: 4, 8,16,28 Main Idea: The general term and the error function are the same. (n) (n+1) f (0) f (c) n+1 Key Words: -------- ----------- x n! (n+1)! Taylor Series, Maclaurin Series, Flat Functions Goal: Be able to express any function as a power series and compute an error bound. -------------------------------------------------------- Previous assignment: p487: (1),(5),(14),(25) Page 487 Problem 1 Find the power series representation for f(x) and specify the radius of convergence. 1 2 3 4 5 n n f(x) = ----- = 1 - x + x - x + x - x ... + (-1) x ... 1+x R = 1. ...................................................... Get["font.math"]; f[x_] := 1+Sum[ (-1)^n x^n ,{n,1,20}]; a = Plot[f[x],{x,-1.1 ,1.1 },PlotStyle->{RGBColor[1,0,0]}]; b = Plot[ 1/(1+x),{x,-0.9,1.1}]; c = Plot[0,{x,-1,1},PlotStyle->{RGBColor[1,0,1],Thickness[0.003]}]; d = Show[a,b,c, PlotLabel->"P487 p1; black = 1/(1+x); red=SUM (-1)^n x^n : S20", PlotRange->{{-1.1,1.1},{-0.1,10}}]; Display["p1.ps",d]; ................................................................ Page 487 Problem 5 1 1/2 f(x) = ------ = ------------- 2-3x 1 - 3/2 x _ _ | 2 2 3 3 n n | = 1/2 | 1 + (3/2) x + (3/2) x + (3/2) x + .... + (3/2) x + ... | |_ _| R = 2/3 ...................................................... Get["font.math"]; f[x_] := 1/2 + 1/2 Sum[ (3/2 x)^n ,{n,1,20}]; a = Plot[f[x],{x,-2/3-0.1,2/3+0.1},PlotStyle->{RGBColor[1,0,0]}]; b = Plot[ 1/(2-3x),{x,-2/3-0.3,2/3-0.01}]; c = Plot[0,{x,-2/3,2/3},PlotStyle->{RGBColor[1,0,1],Thickness[0.003]}]; d = Show[a,b,c, PlotLabel->"P487 p5; black = 1/(2-3x); red= 1/2 SUM (3/2 x)^n S20 ", PlotRange->{{-1,1},{-1,8}}]; Display["p5.ps",d]; ............................................................................. Page 487 Problem 14 Find the power series in x: 2 x f(x) = x e 2 3 4 n x x x x x e = 1 + x + --- + ---- + ---- + .... + ---- + ... 2 3! 4! n! 2 4 6 8 2n x 2 x x x x e = 1 + x + --- + ---- + ---- + .... + ---- + ... 2 3! 4! n! 2 5 7 9 2n+1 x 3 x x x x x e = x + x + --- + ---- + ---- + .... + ---- + ... 2 3! 4! n! ...................................................... Get["font.math"]; f[x_] := x+Sum[ x^(2n+1)/n!,{n,1,8}]; a = Plot[f[x],{x,-3 ,3 },PlotStyle->{RGBColor[1,0,0]}]; b = Plot[ x E^(x^2),{x,-3,3}]; c = Show[a,b, PlotLabel->"P487 p14; black = x E^(x^2); red=SUM x^(2n+1)/n! ", PlotRange->{{-3,3},{-400,400}}]; Display["p14.ps",c]; ................................................................ Page 487 Problem 25 Find the sum of each of the following series. 2 3 4 5 (a) x - x + x - x + x + .... x ------- <=== Answer 1+x 2 3 (b) 1/2! + x/3! + x /4! + x /5! + .... x e - x - 1 ---------------- 2 x 2 3 4 (c) 2x + 4x /2 + 8x /3 + 16x /4 + ... 2 3 4 2x + (2x) /2 + (2x) /3 + (2x) /4 + ... y = -ln(1-2x) / \/ / 2 2 3 n y = ------ = 2( 1 + 2x + (2x) + (2x) + ... + (2x) + ... 1-2x 2 3 n+1 y = 2x + (2x) /2 + (2x) /3 + ... + (2x) /(n+1) + .... ----------------------------------------------- Get["font.math"]; f[x_] := Sum[ -(-x)^n,{n,1,100}]; a = Plot[f[x],{x,-1.5 ,1.5 },PlotStyle->{RGBColor[1,0,0]}]; b = Plot[ x/(1+x),{x,-0.9,2.00}]; c = Plot[0,{x,-1,1},PlotStyle->{RGBColor[1,0,1],Thickness[0.003]}]; d = Show[a,b,c, PlotLabel->"P487 p25a; black = x/(1+x) red=Sum -(-x)^n S100", PlotRange->{{-1.5 ,1.5 },{-10,1}}]; Display["p25a.ps",d]; f[x_] := 1/2 + Sum[ x^n/(n+2)!,{n,1,10}]; a = Plot[f[x],{x,-10,10 },PlotStyle->{RGBColor[1,0,0]}]; b = Plot[ (E^x-1-x)/x^2,{x,-10,10}]; c = Plot[0,{x,-10,10},PlotStyle->{RGBColor[1,0,1],Thickness[0.003]}]; d = Show[a,b,c, PlotLabel->"P487 p25b; black = (e^x-x-1)/x^2 red=Sum x^n/(n+2)! S10", PlotRange->{{-10,10},{-1 ,10}}]; Display["p25b.ps",d]; f[x_] := Sum[ (1/n) (2x)^n,{n,1,100}]; a = Plot[f[x],{x,-0.53 ,0.51 },PlotStyle->{RGBColor[1,0,0]}]; b = Plot[ -Log[1-2 x],{x,-1,0.499}]; c = Plot[0,{x,-0.5,0.5},PlotStyle->{RGBColor[1,0,1],Thickness[0.003]}]; d = Show[a,b,c, PlotLabel->"P487 p25c black= -ln(1-2x) red=Sum(1/n)(2x)^n S100", PlotRange->{{-0.6,0.6},{-10,10}}]; Display["p25c.ps",d]; =================================================== New Material Page 491 Example 1: Express Sin[x] as a power series. Find an upper bound on the error by using the degree 5 polynomial on [-Pi,Pi]. (6) Sin [c] 6 1 6 Error = ------- Pi <= ------- Pi = 1.33526 6! 6! 10 Pi ---- = 0.0258069 10! 20 Pi -9 --- = 3.60473 10 20! ----------------------------------------------------------- Page 492 Example 2: Express Cos[x] as a power series. How many terms are necessary so that the error on [-Pi/2,Pi/2] is less than 0.0001? n+1 n+1 | | | +/- (Cos[c] or Sin[c]) (Pi/2) | (Pi/2) | Error | = | -------------------------------- | < -------------- | | | (n+1)! | (n+1)! f[n_] := (Pi/2)^(n+1)/(n+1)!; Do[Print[n," ",N[f[n]]],{n,1,10}]; 1 1.2337 2 0.645964 3 0.25367 4 0.0796926 5 0.0208635 6 0.00468175 7 0.00091926 8 0.000160441 9 0.000025202 <==== This works when n = 9 -6 10 3.59884 10 ......................................................................... Get["font.math"]; f[x_] := 1 - x^2/2 + x^4/4! - x^6/6! + x^8/8! ; a = Plot[f[x],{x,-2.0,2.0},PlotStyle->{RGBColor[1,1,0],Thickness[0.01]}]; b = Plot[Cos[x],{x,-2.0,2.0}]; c = Show[b,a,b, PlotLabel->"P492 Ex 2 yellow = SUM (-1)^n x^(2n)/(2n)!; yellow = Cos[x]"]; Display["ex2x.ps",c]; d = Plot[Cos[x] - f[x],{x,-2.0,2.0}]; e = ListPlot[ {{-Pi/2,Cos[-Pi/2]-f[-Pi/2]}, {+Pi/2,Cos[+Pi/2]-f[+Pi/2]}}, PlotStyle->{RGBColor[1,0,0],PointSize[0.01]}]; k = Show[d,e,PlotLabel->"P492 Ex2, Cos[x]-Degree 8 approximation", PlotRange->All]; Display["ex2y.ps",k]; ---------------------------------------------------------------------- Page 492 Example 3: How many terms are necessary to approximate Cosh[x] to 0.00001 on [-2,2]. | | (Sinh[c] or Cosh[c]) n+1 Cosh[2] n+1 | Error | = -------------------- 2 < ---------- 2 | | (n+1)! (n+1)! f[n_] := Cosh[2] 2^(n+1)/(n+1)!; Do[Print[n," ",N[f[n]]],{n,1,20}]; 1 7.52439 2 5.01626 3 2.50813 4 1.00325 5 0.334417 6 0.0955478 7 0.023887 8 0.00530821 9 0.00106164 10 0.000193026 11 0.000032171 -6 12 4.94938 10 <=========== n = 12 ............................................................................ Get["font.math"]; f[x_] := 1 + x^2/2 + x^4/4! + x^6/6! + x^8/8! + x^10/10! + x^12/12! ; a = Plot[f[x],{x,-5.5,5.5},PlotStyle->{RGBColor[1,1,0],Thickness[0.01]}]; b = Plot[Cosh[x],{x,-5.5,5.5}]; c = Show[b,a,b, PlotLabel->"P492 ex 3: yellow = SUM x^(2n)/(2n)!; black = Cosh[x]"]; Display["ex3x.ps",c]; d = Plot[Cosh[x] - f[x],{x,-2.5,2.5}]; e = ListPlot[ {{-2,Cosh[-2]-f[-2]},{2,Cosh[2]-f[2]}}, PlotStyle->{RGBColor[1,0,0],PointSize[0.01]}] k = Show[d,e, PlotLabel->"P492 ex3, Cosh[x]-Degree 12 approximation",PlotRange->All]; Display["ex3y.ps",k]; ...................................................................... Example 4: Page 493: The Binomial Series. p Express (1+x) as a power series. ------------------------------------------------------------------- Get["font.math"]; p = 1/2; f[x_] := 1 + Sum[ Binomial[p,i] x^i,{i,1,40}]; a = Plot[f[x],{x,-1.05, 1.2},PlotStyle->{RGBColor[1,1,0],Thickness[0.003]}]; b = Plot[Sqrt[1+x],{x,-1,1.3}]; c = Show[b,a,b, PlotLabel->"P493 ex 4: yellow = SUM Binomial[p,n] x^n!; black = Sqrt[1+x]", PlotRange->All]; Display["ex4x.ps",c]; ............................................................................... Memorize the following power series: 1 1. -------- 1-x 2. ln(1+x) 3. ArcTan[x] x 4. e 5. Sin[x] 6. Cos[x] 7. Sinh[x] 8. Cosh[x] p 9. (1+x) ---------------------------------------------------------- -1/x^2 Flat Functions: y = e ------------------------------ Get["font.math"]; f[x_] := E^(-1/x^2); a = Plot[f[x], {x,-4.5,4.5},PlotRange->All]; b = Show[a,PlotLabel->"Flat Function = E^(-1/x^2)" ,PlotRange->All]; Display["flat.ps",b]; -------------------------------------------------------------------