Pick any exercise in 8.8 of Apex Calculus, the calculus textbook, . Solve and post your solution. If you have issues doing so, discuss them.

Exercise 8.8:

Taylor and Maclaurin Series

The concepts of Taylor polynomials and Taylor series:

1. What is the difference between a Taylor polynomial and a Taylor series?

The key difference lies in the number of terms:

  • A Taylor polynomial has a finite number of terms, while a Taylor series is an infinite summation.
  • Taylor polynomials are useful for local approximations, whereas Taylor series provide a broader view or global approximation of the function. For example, the Maclaurin series for the cosine function is:

    [ \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \ldots ]

  • It includes all powers of (x) (infinitely many terms).

2. What theorem must we use to show that a function is equal to its Taylor series?

To show that a function is equal to its Taylor series, we can use Taylor’s theorem or the Taylor series expansion theorem.

Taylor’s theorem states that if a function f(x) is ntimes differentiable on an interval containing x = a, then the Taylor series expansion of f(x) about the point x = a is given by:

f(x)=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+f′′′(a)3!(x−a)3+⋯+f(n)(a)n!(x−a)n+Rn(x)f(x)=f(a)+f′(a)(x−a)+2!f′′(a)​(x−a)2+3!f′′′(a)​(x−a)3+⋯+n!f(n)(a)​(x−a)n+Rn​(x)

Where Rn(x) is the remainder term or the error term, which represents the difference between the function and its Taylor series.

If the remainder term Rn(x) approaches 0 as n approaches infinity, then the function f(x) is equal to its Taylor series expansion.

In other words, if the function f(x) is infinitely differentiable and its Taylor series converges to f(x) on some interval, then we can conclude that f(x) is equal to its Taylor series on that interval.

Basically, if a function (f(x)) is infinitely differentiable (i.e., all its derivatives exist), and the remainder term (R_n(x)) approaches zero as (n) approaches infinity, then the function is equal to its Taylor series expansion.

Mathematically, this can be expressed as:

[ \lim_{{n \to \infty}} R_n(x) = 0 \quad \text{{for all }} x \text{{ in an interval }} I ]

When this condition is met, we can confidently state that the function (f(x)) is indeed equal to its Taylor series representation.

Problem

Key Idea 8.8.1 gives the n th term of the Taylor series of common functions. In Exercises 3 – 6, verify the formula given in the Key Idea by finding the first few terms of the Taylor series of the given function and identifying a pattern.

  1. f(x) = e x ; c = 0
  2. f(x) = sin x; c = 0
  3. f(x) = 1/(1 − x); c = 0
  4. f(x) = tan−1 x; c = 0

SOLUTION:

Let’s calculate the Taylor series expansions for each function:

  1. For f(x)=exf(x)=ex, the Taylor series expansion centered at c=0c=0 is: ex=∑n=0∞xnn!ex=∑n=0∞​n!xn​

  2. For f(x)=sin⁡(x)f(x)=sin(x), the Taylor series expansion centered at c=0c=0 is: sin⁡(x)=∑n=0∞(−1)nx2n+1(2n+1)!sin(x)=∑n=0∞​(−1)n(2n+1)!x2n+1​

  3. For f(x)=11−xf(x)=1−x1​, the Taylor series expansion centered at c=0c=0 is a geometric series: 11−x=∑n=0∞xn1−x1​=∑n=0∞​xn

  4. For f(x)=tan⁡−1(x)f(x)=tan−1(x), the Taylor series expansion centered at c=0c=0 is: tan⁡−1(x)=∑n=0∞(−1)nx2n+12n+1tan−1(x)=∑n=0∞​(−1)n2n+1x2n+1​

Let’s use R code to compute the first few terms of each Taylor series expansion and observe any patterns:

# Define the functions
f1 <- function(x, n) {
  return(x^n / factorial(n))
}

f2 <- function(x, n) {
  return((-1)^n * x^(2*n + 1) / factorial(2*n + 1))
}

f3 <- function(x, n) {
  return(x^n)
}

f4 <- function(x, n) {
  return((-1)^n * x^(2*n + 1) / (2*n + 1))
}

# Number of terms to compute
terms <- 5

# Compute and print the Taylor series expansions
cat("Taylor series expansion for e^x:\n")
## Taylor series expansion for e^x:
for (i in 0:(terms-1)) {
  cat("Term", i+1, ":", f1(1, i), "\n")
}
## Term 1 : 1 
## Term 2 : 1 
## Term 3 : 0.5 
## Term 4 : 0.1666667 
## Term 5 : 0.04166667
cat("\nTaylor series expansion for sin(x):\n")
## 
## Taylor series expansion for sin(x):
for (i in 0:(terms-1)) {
  cat("Term", i+1, ":", f2(1, i), "\n")
}
## Term 1 : 1 
## Term 2 : -0.1666667 
## Term 3 : 0.008333333 
## Term 4 : -0.0001984127 
## Term 5 : 2.755732e-06
cat("\nTaylor series expansion for 1/(1-x):\n")
## 
## Taylor series expansion for 1/(1-x):
for (i in 0:(terms-1)) {
  cat("Term", i+1, ":", f3(1, i), "\n")
}
## Term 1 : 1 
## Term 2 : 1 
## Term 3 : 1 
## Term 4 : 1 
## Term 5 : 1
cat("\nTaylor series expansion for atan(x):\n")
## 
## Taylor series expansion for atan(x):
for (i in 0:(terms-1)) {
  cat("Term", i+1, ":", f4(1, i), "\n")
}
## Term 1 : 1 
## Term 2 : -0.3333333 
## Term 3 : 0.2 
## Term 4 : -0.1428571 
## Term 5 : 0.1111111