In Exercises 25 – 30, use the Taylor series given in Key Idea 8.8.1 to create the Taylor series of the given functions.
\(\text{26.}\) \(f(x) = e^{−x}\)
Instead of using the taylor expension for \(e^{x}\) and substitute x by -x, let’s actually do the math, and derive the Taylor series expension of \(e^{-x}\).
Let’s write Taylor series of a function f(x) centered at 0:
\[ \begin{split} f(x) &= \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}x^n \\ &= f(0) + \frac{f'(0)}{1!}x + \frac{f(0)}{2!}x^2 + \frac{f'(0)}{3!}x^3...+\frac{f^{(n)}(0)}{n!}x^n \end{split} \]
Function | Evaluation |
\(f(x) = e^{-x}\) | \(f(0) = 1\) |
\(f'(x) = -e^{-x}\) | \(f'(0) = -1\) |
\(f''(x) = e^{-x}\) | \(f''(0) = 1\) |
\(f'''(x) = -e^{-x}\) | \(f'''(0) = -1\) |
Therefore applying these calculations to \(f(x) = e^{-x}\), we obtain: \[ \begin{split} e^{-x} &= 1 - \frac{1}{1!} x^1 + \frac{1}{2!} x^2 - \frac{1}{3!}x^3 ... (-1)^n\frac{1}{n!}x^n \\ &= 1 - \frac{x}{1!} + \frac{x^2}{2!} - \frac{x^3}{3!} + ... + (-1)^n\frac{1}{n!}x^n \\ &= \boxed{\sum_{n=0}^{\infty} (-1)^n\frac{x^n}{n!} } \end{split} \]
In Exercises 31-32, approximate the value of the given definite integral by using the first 4 nonzero terms of the integrand’s Taylor series.
\[ \begin{split} \int^{\sqrt \pi}_{0} sin(x^2) \end{split} \]
Computing the Taylor series for \(sin(x^2)\)
We know the Taylor series of \(sin(x)\) is:
\[ \begin{split} sin(x) &= \sum^{\infty}_{n=0} (-1)^n x^{2n+1}/(2n+1)! \\ &= x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{10!} + ... \end{split} \]
We can then compute the Taylor series for \(sin(x^2)\) by substituting \(x\) for \(x^2\). Then we should obtain:
\[ \begin{split} sin(x^2)&= \sum^{\infty}_{n=0} (-1)^n x^{2(2n+1)}/(2n+1)! \\ &= \sum^{\infty}_{n=0} (-1)^n x^{4n+2}/(2n+1)! \\ &= x^2 - \frac{x^6}{3!} + \frac{x^{10}}{5!} - \frac{x^{14}}{7!} + ... \end{split} \]
Back to our integral and replacing \(sin(x^2)\) by the quation above, should give us:
\[ \begin{split} \int^{\sqrt \pi}_{0} sin(x^2) \,dx &= \int^{\sqrt \pi}_{0} \sum^{\infty}_{n=0} (-1)^n x^{4n+2}/(2n+1)! \,dx\\ &= \int^{\sqrt \pi}_{0} x^2 - \frac{x^6}{3!} + \frac{x^{10}}{5!} - \frac{x^{14}}{7!} + ... \,dx \\ &= \big[\frac{x^3}{3} - \frac{x^7}{(7*3!)} + \frac{x^{11}}{(11*5!)} - \frac{x^{15}}{(15*7!)} + ...\big]^{\sqrt \pi}_0 \\ &= \frac{(\sqrt \pi)^3}{3} - \frac{(\sqrt \pi)^7}{(7*3!)} + \frac{(\sqrt \pi)^{11}}{(11*5!)} - \frac{(\sqrt \pi)^{15}}{(15*7!)}+ ...\\ &= \boxed{ \sum^{\infty}_{n=0} (-1)^n \frac{\sqrt \pi^{4n+3}}{[(4n+3) (2n+1)!]} } \end{split} \]
In General the approximation of \(\int^{\sqrt \pi}_{0} sin(x^2) \,dx\) using all the terms is:
\[ \begin{split} \boxed{ \sum^{\infty}_{n=0} (-1)^n \frac{\sqrt \pi^{4n+3}}{[(4n+3) (2n+1)!]} } \end{split} \]
But what is the approximation for \(\int^{\sqrt \pi}_{0} sin(x^2) \,dx\) using only the first 4 terms?
Let us ask R to compute that for us.
first_4_terms <- 0:3
integral_approximator <- function(x, n){
a <- x^(4*n+3)
b <- (4*n+3) * factorial(2*n+1)
return(sum(((-1)^n) * (a / b)))
}
my_humble_approximation <- integral_approximator(pi^0.5, first_4_terms)
my_humble_approximation
## [1] 0.8877069
So the approximation for \(\int^{\sqrt \pi}_{0} sin(x^2) \,dx\) using the first 4 terms is \(\textbf{0.8877069}\).