Examples for Section 8.10
Convegence of Taylor Series

p.687

1.

Plug u = -5 x into the series (e^u) = 
                1 + u + (1/(2!)) (u^2) +  (1/(3!)) (u^3) +   ... 
                  +(1/(n!)) (u^n)+ ... to get
(e^(-5 x)) = \(TraditionalForm
      \`\(\(\(1 + \((\(-5\) x)\) + \(1\/\(2!\)\) \((\(-5\) x)\)\^2 + \ 
                \(1\/\(3!\)\) \((\(-5\) x)\)\^3 + \  ... \) + 
            \(1\/\(n!\)\) \((\(-5\) x)\)\^n + \  ...  = \)\ \)\)\(TraditionalForm
      \`\(1 - 5  x + \(5\^2\/\(2!\)\) x\^2 + \ \(5\^3\/\(3!\)\) x\^3 + \  ... 
            \) + \(\(\(\((\(-1\))\)\^n\) 5\^n\)\/\(n!\)\) x\^n + \  ... \)

Series[(E^(-5 x)), {x, 0, 4}]

5.

Plug u = (Sqrt[x]) into the series \(TraditionalForm
      \`cos(u)\  = \ 
        \(1\  - \ \(1\/\(2!\)\) u\^2 + \ \(1\/\(4!\)\) u\^4 + \  ... \) + 
            \(\((\(-1\))\)\^n\/\(\((2  n)\)!\)\) u\^\(2  n\) + \  ... \) to get \(TraditionalForm
      \`cos(\@x)\  = \ 
        \(\(1\  - \ \(1\/\(2!\)\) \((\@x)\)\^2 + \ 
                  \(1\/\(4!\)\) \((\@x)\)\^4 + \  ... \) + 
              \(\((\(-1\))\)\^n\/\(\((2  n)\)!\)\) \((\@x)\)\^\(2  n\) + 
              \  ...  = \ 
          \(1\  - \ \(1\/\(2!\)\) x + \ \(1\/\(4!\)\) x\^2 + \  ... \) + 
              \(\((\(-1\))\)\^n\/\(\((2  n)\)!\)\) x\^n + \  ... \)\)

Series[Cos[(Sqrt[x])], {x, 0, 4}]

15.

Plug u = 2  x into the formula for geometric series \(TraditionalForm
      \`1\/\(1 - u\) = \(1 + u + u\^2 +  ... \) + u\^n + \  ... \) to get:
((x^2)/(1 - 2  x))=(x^2)((1/(1 - 2  x))) = (x^2)(
                1  +  (2  x)  +  (((2  x))^2) +   ...   +  
                    (((2  x))^n) +   ... ) = (x^2) +  2  (x^3) +  (2^2) (x^4) +   ...   + 
                     (2^n) (x^(n + 2)) +   ...

Series[((x^2)/(1 - 2  x)), {x, 0, 4}]

17.

First observe that \(TraditionalForm
      \`\(d\/\(d\ x\)\) \((1\/\(1 - x\))\) = 1\/\((1 - x)\)\^2\) [(for problem 18, you also need \(TraditionalForm
      \`\(d\/\(d\ x\)\) \((1\/\((1 - x)\)\^2)\) = 2\/\((1 - x)\)\^3\)], so \(TraditionalForm
      \`1\/\((1 - x)\)\^2 = 
        \(\(d\/\(d\ x\)\) \((1\/\(1 - x\))\) = 
          \(\(d\/\(d\ x\)\) 
              \((\(1 + x + x\^2 + x\^3 +  ... \) + x\^n +  ... )\) = 
            \(0 + 1 + 2  x + 3  x\^2 +  ... \) + n\ x\^\(n - 1\) +  ... 
              \)\)\)
You could also try multiplying the series, but that is a little harder: \(TraditionalForm
      \`1\/\((1 - x)\)\^2 = 
        \(\((\(1 + x + x\^2 +  ... \) + x\^n +  ... )\) 
            \((\(1 + x + x\^2 +  ... \) + x\^n +  ... )\) = 
          \(1 + 2  x + 3  x\^2 +  ... \) + \((n\  + 1)\) x\^n +  ... \)\)

Series[(1/(((1 - x))^2)), {x, 0, 4}]

19.

Fir approximately what values of x can you replace sin(x) by x  -  ((x^3)/6) with an error of magnitude no greater than 5×(10^(-4))?

Solution. The error of approximation is less than \(TraditionalForm
      \`\( | \(R\_3\)(x) | \) = 
        \( | \((\(\(\(\(sin'\)'\)'\)' \((c)\)\)\/\(4!\))\) x\^4 | 
          \( ≤ \ \(1\/24\) x\^4\)\)\). To ensure that the error is less than 5×(10^(-4)) we should require that (1/24) (x^4) <  5×(10^(-4)) which reduces to -0.330975  <  x  <  0.330975 .

(((5. ×(10^(-4))) 24)^(1/4))

It's hard to see the difference in the graphs even on the interval [-1, 1]:

Plot[{ x - ((x^3)/6), Sin[x]}, {x, -1, 1}, 
      PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}]

22.

Estimate the error of approximating (Sqrt[1 + x]) with its second order Taylor polynomial 1  -  x/2 when  | x |  < 0.01.

Solution. The error is less than \(TraditionalForm
      \`\(\( | \(R\_2\)(x) | \) = 
        \(\( | \((\ \(\(\(f'\)'\)' \((c)\)\)\/\(3!\))\) x\^3 | \) = 
          \(1\/\(3!\)\) 3\/\(8\ \((1 + c)\)\^\(5/2\)\) | x\( | \^3\)\)\ 
      \)\).

D[(Sqrt[1 + x]), {x, 3}]

Since \(TraditionalForm
      \`3\/\(8\ \((1 + c)\)\^\(5/2\)\) < 
        \((3\/\(8 \((1 - 0.01)\)\^\(5/2\)\))\)\)   = 0.384542 for -0.01 < x < 0.01,

(3/(8 (((1 - 0.01))^(5/2))))

we see that we can estimate, using  | x |  < 0.01 , \(TraditionalForm
      \`\( | \(R\_2\)(x) | \ \( < \ 0.384542\)\  | x
          \( | \^3\)\( < \ \ 0.384542\ \((0.1)\)\^3\)\) = 0.000384542\) and the error is never greater than 3.8×(10^(-4)).

35.

Multiply the Maclaurin series for (e^x) and sin(x) to get the first five non-szero terms of the Maclaurin series for (e^x) sin(x).
Solution. Multiply like polynopmials:  
\(TraditionalForm
      \`\(e\^x\) \(sin(x)\)\  = \ 
        \(\((1 + x + \(1\/2\) x\^2 + \(1\/\(3!\)\) x\^3 + 
                  \(1\/\(4!\)\) x\^4 + \(1\/\(5!\)\) x\^5 + 
                  \(1\/\(6!\)\) x\^6 +  ... )\) 
            \((x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                  \(1\/\(7!\)\) x\^7 +  ... )\)
			 = 
          \(\((x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                      \(1\/\(7!\)\) x\^7 +  ... )\) + 
                x(x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                      \(1\/\(7!\)\) x\^7 +  ... ) + 
                \(1\/2\) 
                  \(\(x\^2\)(
                    x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                        \(1\/\(7!\)\) x\^7 +  ... )\) + 
                \(1\/\(3!\)\) 
                  \(\(x\^3\)(
                    x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                        \(1\/\(7!\)\) x\^7 +  ... )\) + 
                \(1\/\(4!\)\) 
                  \(\(x\^4\)(
                    x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                        \(1\/\(7!\)\) x\^7 +  ... )\) + 
                \(1\/\(5!\)\) 
                  \(\(x\^5\)(
                    x - \(1\/\(3!\)\) x\^3 + \(1\/\(5!\)\) x\^5 - 
                        \(1\/\(7!\)\) x\^7 +  ... )\) +  ... 
				 = \ 
            \(x\  + \ x\^2 + \ \((\(-\(1\/6\)\) + 1\/2)\) x\^3 + 
                  \((\(-\(1\/6\)\) + 1\/6)\) x\^4 + 
                  \((1\/120 - 1\/12 + 1\/24)\) x\^5 + 
                  \((1\/120 - 1\/36 + 1\/120)\) x\^6 +  ... 
				 = \ 
              x\  + \ x\^2 + \ \(1\/3\) x\^3 - \ \(1\/30\) x\^5 - 
                  \(1\/90\) x\^6 + \ \  ... \)\)\)\)

Series[(E^x) Sin[x], {x, 0, 6}]

62.

f[x_]  :=  (E^(x/3)) Sin[2  x]

Step 1)

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

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)

Series[f[x],  {x, 0, 3}]

Step 3)

f''[x]

Plot[f''[x], {x, -2, 2}]

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

f'''[x]

Plot[f'''[x], {x, -2, 2}]

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

f''''[x]

Plot[f''''[x], {x, -2, 2}]

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

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

Plot[3  (x^2), {x, -2, 2}, PlotRange -> All]

To get | (Subscript[R, 1])(x) | (( < 10)^(-2)) we need 3  (x^2) < (10^(-2)) or -0.0577 < x < 0.0577.

(Sqrt[ .01/3])

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

Plot[(8/3) Abs[x]^3, {x, -2, 2}, PlotRange -> All]

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

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

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

Plot[(25/24) (x^4), {x, -2, 2}, PlotRange -> All]

To get | (Subscript[R, 4])(x) | (( < 10)^(-2)) we need (x^4) < (10^(-2)) or -0.313 < x < 0.313.

((24 ( .01)/25)^(1/4))

Step 5)

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

Maximum error using p1 on [-2, 2] appears to be  ≤ 6.

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

Maximum error using p2 on [-2, 2] appears to be  ≤ 8.

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

Maximum error using p3 on [-2, 2] appears to be  ≤ 8.

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.313 < x <  .313. The difference does not show up readily in the graphs:

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