p.688

61.

f[x_]  :=  (E^(-x)) Cos[2  x]

Step 1)

Plot[f[x],  {x, -1, 1}]

Step 2) Taylor polynomials for n = 1, 2, 3:

p1  =  f[0]  +  f'[0] x

p2  =  
      f[0]  +  f'[0] x  +  f''[0]/(2!) (x^2)

p3  =  
      f[0]  +  f'[0] x  +  f''[0]/(2!) (x^2) + 
        f'''[0]/(3!) (x^3)

Step 3)

f''[x]

Plot[f''[x], {x, -1, 1}, PlotRange -> All]

f''[- .7]

The maximum of of  | f'' (x) |  appears to be  < (Subscript[M, 2]) = 9

f'''[x]

Plot[f'''[x], {x, -1, 1}, PlotRange -> All]

f'''[-1. ]

The maximum of of  | f''' (x) |  appears to be  < (Subscript[M, 3]) = 18

f''''[x]

Plot[f''''[x], {x, -1, 1}, PlotRange -> All]

f''''[-1. ]

The maximum of of  | f'''' (x) |  appears to be  < (Subscript[M, 4]) = 68

Step 4)
\(TraditionalForm
      \`\(|\( R\_1\)(x) | \) = \ 
        \(\( | \(\(f'\)' \((c)\)\)\/2 | \ 
            x\^2 ≤ \(M\_2\/2\) x\^2\) = \(9\/2\) x\^2\)\)

Plot[(9/2) (x^2), {x, -1, 1}, PlotRange -> All]

To get  | (Subscript[R, 1])(x) |  < (10^(-2)) we need (9/2) (x^2) < (10^(-2)) or -0, 047 < x < 0.047.

(Sqrt[2 ( .01)/9])

\(TextForm
    \`\(|\( R\_2\) \((x)\) | \) = \ 
      \(\( | \(\(\(f'\)'\)' \((c)\)\)\/\(3!\) | \  | x
          \( | \^3\)\( ≤ M\_3\/6\)\  | x\( | \^3\)\) = 
        3\  | x\( | \^3\)\)\)

Plot[3  Abs[x]^3, {x, -1, 1}, PlotRange -> All]

To get  | (Subscript[R, 2])(x) |  < (10^(-2)) we need \(TraditionalForm\`3 | x\( | \^3\)\( < 10\^\(-2\)\)\) or -0, 149 < x < 0.149.

((( .01)/3)^(1/3))

\(TextForm
    \`\(|\( R\_3\) \((x)\) | \) = \ 
      \(\( | \(\(\(\(f'\)'\)'\)' \((c)\)\)\/\(4!\) | \  | x
          \( | \^4\)\( ≤ M\_4\/24\)\  | x\( | \^4\)\) = 
        17\/6\  | x\( | \^4\)\)\)

Plot[(17/6) (x^4), {x, -1, 1}, PlotRange -> All]

To get  | (Subscript[R, 4])(x) |  < (10^(-2)) we need \(TraditionalForm\`17\/6 | x\( | \^4\)\( < 10\^\(-2\)\)\) or -0.243 < x < 0.243.

((6 ( .01)/17)^(1/4))

Step 5)

Plot[Abs[f[x] - p1],  {x, -1, 1}, PlotRange -> All]

Maximum error using p1 on [-1, 1] appears to be  ≤ 3.2.

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

Maximum error using p2 on [-1, 1] appears to be  ≤ 7.

Plot[Abs[f[x] - p3],  {x, -1, 1}, PlotRange -> All]

Maximum error using p3 on [-1, 1] appears to be  ≤ 0.5.

Step 6)

Plot[{p1, p2, p3, f[x]}, {x, -2, 2},  
      PlotStyle 
        -> {RGBColor[1, 1, 0], RGBColor[0, 1, 1],  RGBColor[0, 0, 1],  
          RGBColor[1, 0, 0]}]

The higher degree Taylor polynomials match the function (red) better. The error of using (Subscript[P, 3])(x) to approximate f(x) is less than .01 for -0.243 < x <  .243. The difference does not show up readily in the graphs:

Plot[{f[x], p3}, {x, -0.243, 0.243},  
      PlotStyle -> {RGBColor[1, 0, 0],  RGBColor[0, 0, 1]}]