Search Knowledge

© 2026 LIBREUNI PROJECT

Page 11 of 12

Taylor Series

Power series, radius of convergence, Taylor's Theorem with Remainder, and analytical polynomial approximations of transcendental functions.

Lesson briefApproximation · 2 h · 3 outcomes

Required knowledge

  • Higher-order derivatives, the Mean Value Theorem, and Riemann integration
  • Geometric series and basic sequence convergence

Learning outcomes

  • Determine radius and interval of convergence for power series using ratio and root tests
  • Construct Taylor polynomials and bound approximation error using the Lagrange and integral remainder formulas
  • Manipulate, differentiate, and integrate Maclaurin series for elementary transcendental functions

Assessment target

Determine the exact interval of convergence of a power series and bound the truncation error of a Taylor polynomial over a target interval using Lagrange remainder.

Scope boundary

  • Complex analyticity, Laurent series, and Fourier series expansions.

Many continuous functions (such as sin⁡(x)\sin(x) exe^x or ln⁡(x)\ln(x) cannot be calculated using simple algebraic operations. Power series, and specifically Taylor series, allow us to represent these transcendental functions as “infinite polynomials,” which are easy to compute, differentiate, and integrate.

Power Series and Convergence

Before defining Taylor series, we must understand the behavior of power series.

Definition 3.1.1Power Series

A power series centered at aa is an infinite series of the form:

∑n=0∞cn(x−a)n=c0+c1(x−a)+c2(x−a)2+…\sum_{n=0}^\infty c_n (x - a)^n = c_0 + c_1(x - a) + c_2(x - a)^2 + \dots

where xx is a variable and cnc_n are the coefficients.

Every power series converges at its center x=ax = a The set of all xx for which the series converges is an interval, governed by the radius of convergence.

Theorem 3.1.2Radius of Convergence

For any power series ∑n=0∞cn(x−a)n\sum_{n=0}^\infty c_n (x - a)^n exactly one of the following holds:

  1. The series converges only at x=ax = a (Radius of convergence R=0R = 0
  2. The series converges absolutely for all x∈Rx \in \mathbb{R} (Radius of convergence R=∞R = \infty
  3. There exists a real number R>0R > 0 such that the series converges absolutely for ∣x−a∣<R|x - a| < R and diverges for ∣x−a∣>R|x - a| > R

The value RR is the radius of convergence, and can be calculated using the Root or Ratio test:

1R=lim⁡n→∞∣cn+1cn∣or1R=lim⁡n→∞∣cn∣n.\frac{1}{R} = \lim_{n \to \infty} \left| \frac{c_{n+1}}{c_n} \right| \quad \text{or} \quad \frac{1}{R} = \lim_{n \to \infty} \sqrt[n]{|c_n|}.

Taylor and Maclaurin Series

If a function can be represented by a power series, the coefficients are uniquely determined by the function’s derivatives.

Definition 3.1.3Taylor and Maclaurin Series

Let ff be a function with derivatives of all orders on an interval containing aa The Taylor series of ff centered at aa is:

∑n=0∞f(n)(a)n!(x−a)n=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+…\sum_{n=0}^\infty \frac{f^{(n)}(a)}{n!} (x - a)^n = f(a) + f'(a)(x - a) + \frac{f''(a)}{2!}(x - a)^2 + \dots

If a=0a = 0 the series is called the Maclaurin series of ff

Taylor’s Theorem with Remainder

In practice, we can only compute finite sums. Taylor’s Theorem provides a formula for the error (remainder) when approximating a function with a Taylor polynomial of degree kk

Theorem 3.1.4Taylor's Theorem

Let ff have k+1k+1 derivatives on an open interval II containing aa For any x∈Ix \in I there exists a number cc between aa and xx such that:

f(x)=Pk(x)+Rk(x),f(x) = P_k(x) + R_k(x),

where Pk(x)P_k(x) is the kk-th degree Taylor polynomial:

Pk(x)=∑n=0kf(n)(a)n!(x−a)n,P_k(x) = \sum_{n=0}^k \frac{f^{(n)}(a)}{n!} (x - a)^n,

and Rk(x)R_k(x) is the remainder (error) term, expressed in the Lagrange form:

Rk(x)=f(k+1)(c)(k+1)!(x−a)k+1.R_k(x) = \frac{f^{(k+1)}(c)}{(k+1)!} (x - a)^{k+1}.

Pause & Predict: Does f∈C∞f \in C^\infty guarantee convergence to f(x)f(x) Suppose a function f:R→Rf: \mathbb{R} \to \mathbb{R} has continuous derivatives of all orders f∈C∞(R)f \in C^\infty(\mathbb{R}) and its Taylor series ∑n=0∞f(n)(0)n!xn\sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!} x^n converges for all x∈Rx \in \mathbb{R} (radius of convergence R=∞R = \infty Does the sum of the series necessarily equal f(x)f(x) for all xx Commit your intuition before opening the analysis below.

Show hintExpand

Recall the distinction between smooth (C∞C^\infty) and real-analytic (CωC^\omega) functions. Does vanishing derivatives at zero imply the function itself is zero everywhere?

Reveal analysisExpand

Analysis: No! Having infinitely many derivatives does not imply that the Taylor series reconstructs the original function away from the expansion point. A function is called real-analytic CωC^\omega only if its Taylor series actually converges to f(x)f(x) in a neighborhood of aa There exist infinitely differentiable functions C∞C^\infty that are not analytic: their remainder term Rk(x)R_k(x) fails to vanish as k→∞k \to \infty We analyze this profound counterexample below.

ProofExpand proof

We fix x≠ax \neq a Let MM be the unique real number satisfying:

f(x)=Pk(x)+M(x−a)k+1.f(x) = P_k(x) + M(x - a)^{k+1}.

We want to prove that M=f(k+1)(c)(k+1)!M = \frac{f^{(k+1)}(c)}{(k+1)!} for some cc between aa and xx Define an auxiliary function g(t)g(t) for tt in the interval:

g(t)=f(t)−Pk(t)−M(t−a)k+1.g(t) = f(t) - P_k(t) - M(t - a)^{k+1}.

  1. Since ff has k+1k+1 derivatives, gg is continuous and differentiable.
  2. Evaluate gg at t=at = a
    • g(a)=f(a)−Pk(a)−M(0)=f(a)−f(a)=0g(a) = f(a) - P_k(a) - M(0) = f(a) - f(a) = 0
    • By definition of Pk(t)P_k(t) we also have g′(a)=g′′(a)=⋯=g(k)(a)=0g'(a) = g''(a) = \dots = g^{(k)}(a) = 0
  3. Evaluate gg at t=xt = x
    • g(x)=f(x)−Pk(x)−M(x−a)k+1=0g(x) = f(x) - P_k(x) - M(x - a)^{k+1} = 0 by our choice of MM

Since g(a)=g(x)=0g(a) = g(x) = 0 by Rolle’s Theorem, there exists c1c_1 between aa and xx such that g′(c1)=0g'(c_1) = 0 Now, since g′(a)=0g'(a) = 0 and g′(c1)=0g'(c_1) = 0 by Rolle’s Theorem again, there exists c2c_2 between aa and c1c_1 such that g′′(c2)=0g''(c_2) = 0 Repeating this process k+1k+1 times, we find that there exists c=ck+1c = c_{k+1} between aa and xx such that:

g(k+1)(c)=0.g^{(k+1)}(c) = 0.

Differentiating g(t)g(t) exactly k+1k+1 times:

  • The (k+1)(k+1)-th derivative of f(t)f(t) is f(k+1)(t)f^{(k+1)}(t)
  • The (k+1)(k+1)-th derivative of the polynomial Pk(t)P_k(t) of degree kk is 00
  • The (k+1)(k+1)-th derivative of M(t−a)k+1M(t - a)^{k+1} is M⋅(k+1)!M \cdot (k+1)!

Thus:

g(k+1)(t)=f(k+1)(t)−0−M(k+1)!g^{(k+1)}(t) = f^{(k+1)}(t) - 0 - M(k+1)!

Evaluating at t=ct = c

0=f(k+1)(c)−M(k+1)!  ⟹  M=f(k+1)(c)(k+1)!.0 = f^{(k+1)}(c) - M(k+1)! \implies M = \frac{f^{(k+1)}(c)}{(k+1)!}.

Substituting MM back into our original equation yields the Lagrange remainder.

∎
Maclaurin polynomials $P_2(x) = 1 - \frac{x^2}{2}$ and $P_4(x) = 1 - \frac{x^2}{2} + \frac{x^4}{24}$ approximating $\cos(x)$ around $a = 0$. Graph of cos(x) compared against its degree-2 and degree-4 Maclaurin polynomials P_2(x) and P_4(x) over [-3.5, 3.5].
Figure 3.1.1: Maclaurin polynomials P2(x)=1−x22P_2(x) = 1 - \frac{x^2}{2} and P4(x)=1−x22+x424P_4(x) = 1 - \frac{x^2}{2} + \frac{x^4}{24} approximating cos⁡(x)\cos(x) around a=0a = 0.

Let us write a Python script to plot the Maclaurin polynomials of cos⁡(x)\cos(x) and analyze how adding terms expands the interval where the approximation remains accurate.

python

Interactive Lab

1import math
2import numpy as np
3import matplotlib.pyplot as plt
4 
5def cos_approx(x, order):
6 # P_n(x) for cos(x) around a=0
7 val = 0.0
8 for i in range(0, order + 1, 2):
9 sign = (-1) ** (i // 2)
10 term = (x ** i) / math.factorial(i)
11 val += sign * term
12 return val
13 
14x = np.linspace(-2 * np.pi, 2 * np.pi, 200)
15 
16plt.plot(x, np.cos(x), label='cos(x)', color='black', linewidth=2)
17plt.plot(x, cos_approx(x, 2), '--', label='Order 2 (quadratic)', color='r')
18plt.plot(x, cos_approx(x, 4), '--', label='Order 4', color='g')
19plt.plot(x, cos_approx(x, 8), '--', label='Order 8', color='b')
20plt.ylim(-2, 2)
21plt.legend()
22plt.title("Maclaurin Approximations of cos(x)")
23plt.grid(True)
24plt.show()
25 
26# Compute error at x = np.pi
27exact = np.cos(np.pi)
28print(f"Exact cos(pi): {exact}")
29print(f"Error (order 2): {abs(cos_approx(np.pi, 2) - exact):.6f}")
30print(f"Error (order 8): {abs(cos_approx(np.pi, 8) - exact):.6f}")
31 

Worked Trace: Rigorous Lagrange Error Bound for exe^x

Suppose we approximate e=e1e = e^1 using the Maclaurin polynomial Pk(1)=∑n=0k1n!P_k(1) = \sum_{n=0}^k \frac{1}{n!} and we require the approximation error to be strictly less than 10−610^{-6}

  1. Formulate the Lagrange Remainder: By Taylor’s Theorem, for f(x)=exf(x) = e^x the (k+1)(k+1)-th derivative is f(k+1)(x)=exf^{(k+1)}(x) = e^x The remainder at x=1x = 1 is: Rk(1)=ec(k+1)!(1−0)k+1=ec(k+1)!,for some c∈(0,1).R_k(1) = \frac{e^c}{(k+1)!} (1 - 0)^{k+1} = \frac{e^c}{(k+1)!}, \quad \text{for some } c \in (0, 1).

  2. Establish a Rigorous Upper Bound: Because exe^x is strictly increasing, c<1  ⟹  ec<e1<3c < 1 \implies e^c < e^1 < 3 (using the elementary bound e<3e < 3 Therefore: ∣Rk(1)∣<3(k+1)!.|R_k(1)| < \frac{3}{(k+1)!}.

  3. Determine the Required Degree kk: We require: 3(k+1)!<10−6  ⟺  (k+1)!>3×106=3,000,000.\frac{3}{(k+1)!} < 10^{-6} \iff (k+1)! > 3 \times 10^6 = 3{,}000{,}000.

  4. Factorial Growth Trace:

    • For k=8k = 8 (8+1)!=9!=362,880≤3,000,000(8+1)! = 9! = 362{,}880 \le 3{,}000{,}000 (insufficient).
    • For k=9k = 9 (9+1)!=10!=3,628,800>3,000,000(9+1)! = 10! = 3{,}628{,}800 > 3{,}000{,}000 (condition satisfied).
  5. Conclusion: A 9th-degree Taylor polynomial P9(1)=∑n=091n!P_9(1) = \sum_{n=0}^9 \frac{1}{n!} guarantees an error strictly bounded by 33,628,800≈8.27×10−7<10−6\frac{3}{3{,}628{,}800} \approx 8.27 \times 10^{-7} < 10^{-6} without needing to know the true value of ee in advance.

Counterexample & Failure Mode: Cauchy’s Smooth Non-Analytic Function

Does f∈C∞(R)f \in C^\infty(\mathbb{R}) imply that the Taylor series converges to f(x)f(x) Consider Augustin-Louis Cauchy’s classical function: f(x)={e−1/x2if x≠00if x=0f(x) = \begin{cases} e^{-1/x^2} & \text{if } x \neq 0 \\ 0 & \text{if } x = 0 \end{cases}

  1. Derivatives at the Origin: For x≠0x \neq 0 the nn-th derivative has the form f(n)(x)=Pn(1/x)e−1/x2f^{(n)}(x) = P_n(1/x) e^{-1/x^2} where PnP_n is a polynomial. Using the substitution u=1/xu = 1/x as x→0x \to 0 u→±∞u \to \pm\infty lim⁡x→0e−1/x2xk=lim⁡u→∞ukeu2=0for every integer k≥0.\lim_{x \to 0} \frac{e^{-1/x^2}}{x^k} = \lim_{u \to \infty} \frac{u^k}{e^{u^2}} = 0 \quad \text{for every integer } k \ge 0. By induction and the definition of the derivative, f(n)(0)=0f^{(n)}(0) = 0 for every n=0,1,2,…n = 0, 1, 2, \dots

  2. Taylor Series Collapse: The Maclaurin series of f(x)f(x) around a=0a = 0 is: ∑n=0∞f(n)(0)n!xn=∑n=0∞0⋅xn=0.\sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!} x^n = \sum_{n=0}^\infty 0 \cdot x^n = 0. This power series converges for every x∈Rx \in \mathbb{R} (radius of convergence R=∞R = \infty with sum identically zero.

  3. Breakdown Analysis: For any x≠0x \neq 0 f(x)=e−1/x2>0≠0=∑n=0∞f(n)(0)n!xnf(x) = e^{-1/x^2} > 0 \neq 0 = \sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!} x^n Thus, the Taylor series agrees with f(x)f(x) only at the single point x=0x = 0! The function is infinitely differentiable C∞C^\infty on all of R\mathbb{R} yet fails to be analytic CωC^\omega at the origin because the remainder term Rk(x)R_k(x) does not converge to zero as k→∞k \to \infty

Euler’s Formula via Maclaurin Series

By substituting ixix into the Maclaurin series of eze^z we can derive the fundamental connection between complex exponentiation and trigonometry.

Let z=ixz = ix The Maclaurin series for eixe^{ix} is:

eix=∑n=0∞(ix)nn!=1+ix−x22!−ix33!+x44!+ix55!−…e^{ix} = \sum_{n=0}^\infty \frac{(ix)^n}{n!} = 1 + ix - \frac{x^2}{2!} - \frac{ix^3}{3!} + \frac{x^4}{4!} + \frac{ix^5}{5!} - \dots

Grouping real and imaginary parts:

eix=(1−x22!+x44!−… )+i(x−x33!+x55!−… ).e^{ix} = \left( 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots \right) + i \left( x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots \right).

Recognizing the real part as the Maclaurin series for cos⁡(x)\cos(x) and the imaginary part as the Maclaurin series for sin⁡(x)\sin(x) we establish Euler’s Formula:

eix=cos⁡(x)+isin⁡(x).e^{ix} = \cos(x) + i\sin(x).

Worked example. At x=π/2x=\pi/2 the identity gives eiπ/2=ie^{i\pi/2}=i squaring gives eiπ=−1e^{i\pi}=-1 Separating the even and odd terms is valid because the exponential power series converges absolutely for every complex zz so its terms may be regrouped. This is an extension of the real-variable series, not a substitute for defining the complex exponential.

Section Exercises

Deep Practice

Determine radii and intervals of convergence, construct Taylor polynomials, and establish rigorous truncation error bounds via the Lagrange remainder.

Exercise 3.1.1: Radius and Interval of Convergence with Endpoint Analysis

Verificationapplication

Determine the radius of convergence RR and the exact interval of convergence (including endpoint behavior) for the power series ∑n=1∞(x−3)nn 2n\sum_{n=1}^\infty \frac{(x - 3)^n}{n\,2^n} (Theorem 3.1.2).

Verification Check

0 / 4 answered

Consider the power series ∑n=1∞(x−3)nn2n\sum_{n=1}^{\infty}\frac{(x-3)^n}{n 2^n}. Evaluate each statement regarding its radius and interval of convergence:

Classify each option as correct or incorrect, or leave uncertain options unanswered (“I don't know”) and verify at any time.

1
The radius of convergence is R=1R = 1 because the leading coefficient sequence is dominated by 1/n1/n.
2
The series has an infinite radius of convergence because factorial growth dominates the polynomial denominator n2nn 2^n.
3
The radius of convergence is R=2R = 2, determined by applying the ratio test limit ∣x−3∣/2<1|x-3|/2 < 1.
4
The series converges absolutely on the open interval (1,5)(1, 5) centered around the expansion point x0=3x_0 = 3.
HintExpand

After finding R=2R = 2 via the Ratio Test, test x=1x = 1 (alternating harmonic series) and x=5x = 5 (harmonic series) separately.

Worked solutionExpand
  1. Ratio test: Let an=(x−3)nn 2na_n = \frac{(x - 3)^n}{n\,2^n} Then lim⁡n→∞∣an+1an∣=lim⁡n→∞nn+1⋅∣x−3∣2=∣x−3∣2.\lim_{n \to \infty}\left|\frac{a_{n+1}}{a_n}\right| = \lim_{n \to \infty} \frac{n}{n+1}\cdot\frac{|x - 3|}{2} = \frac{|x - 3|}{2}. Convergence holds for ∣x−3∣2<1  ⟺  ∣x−3∣<2\frac{|x - 3|}{2} < 1 \iff |x - 3| < 2 so R=2R = 2 and the open interval is (1,5)(1, 5)
  2. Left endpoint x=1x = 1 The series becomes ∑n=1∞(−2)nn 2n=∑n=1∞(−1)nn\sum_{n=1}^\infty \frac{(-2)^n}{n\,2^n} = \sum_{n=1}^\infty \frac{(-1)^n}{n} which converges conditionally by the Alternating Series Test.
  3. Right endpoint x=5x = 5 The series becomes ∑n=1∞2nn 2n=∑n=1∞1n\sum_{n=1}^\infty \frac{2^n}{n\,2^n} = \sum_{n=1}^\infty \frac{1}{n} the harmonic series, which diverges.
  4. Exact interval of convergence: [1,5)[1, 5)

Verification criteria. Requires R=2R = 2 separate convergence checks at x=1x = 1 and x=5x = 5 and the half-closed interval [1,5)[1, 5)

Exercise 3.1.2: Second-Degree Taylor Polynomial and Remainder Bound

Constructionapplication

Construct the quadratic Taylor polynomial P2(x)P_2(x) of f(x)=xf(x) = \sqrt{x} centered at a=4a = 4 use it to approximate 4.2\sqrt{4.2} and bound the error ∣4.2−P2(4.2)∣|\sqrt{4.2} - P_2(4.2)| using Theorem 3.1.4.

HintExpand

Compute f(4),f′(4),f′′(4)f(4), f'(4), f''(4) for P2(x)P_2(x), then bound ∣f′′′(c)∣=38c−5/2|f'''(c)| = \frac{3}{8}c^{-5/2} on [4,4.2][4, 4.2] using the worst-case endpoint c=4c = 4.

Worked solutionExpand
  1. Derivatives at a=4a = 4
    • f(x)=x1/2  ⟹  f(4)=2f(x) = x^{1/2} \implies f(4) = 2
    • f′(x)=12x−1/2  ⟹  f′(4)=14f'(x) = \frac{1}{2}x^{-1/2} \implies f'(4) = \frac{1}{4}
    • f′′(x)=−14x−3/2  ⟹  f′′(4)=−132f''(x) = -\frac{1}{4}x^{-3/2} \implies f''(4) = -\frac{1}{32}
    • f′′′(x)=38x−5/2f'''(x) = \frac{3}{8}x^{-5/2}
  2. Quadratic Taylor polynomial (Definition 3.1.3): P2(x)=2+14(x−4)−164(x−4)2.P_2(x) = 2 + \frac{1}{4}(x - 4) - \frac{1}{64}(x - 4)^2. At x=4.2x = 4.2 x−4=0.2x - 4 = 0.2 P2(4.2)=2+0.24−0.0464=2+0.05−0.000625=2.049375.P_2(4.2) = 2 + \frac{0.2}{4} - \frac{0.04}{64} = 2 + 0.05 - 0.000625 = 2.049375.
  3. Lagrange remainder bound (Theorem 3.1.4): For some c∈(4,4.2)c \in (4, 4.2) ∣R2(4.2)∣=∣f′′′(c)∣3!(4.2−4)3=3/(8c5/2)6(0.2)3=(0.2)316 c5/2.|R_2(4.2)| = \frac{|f'''(c)|}{3!}(4.2 - 4)^3 = \frac{3/(8c^{5/2})}{6}(0.2)^3 = \frac{(0.2)^3}{16\,c^{5/2}}. Since c>4c > 4 c5/2>45/2=32c^{5/2} > 4^{5/2} = 32 so: ∣R2(4.2)∣<0.00816×32=0.008512=1.5625×10−5.|R_2(4.2)| < \frac{0.008}{16 \times 32} = \frac{0.008}{512} = 1.5625 \times 10^{-5}.

Verification criteria. Requires P2(x)P_2(x) numerical evaluation P2(4.2)=2.049375P_2(4.2) = 2.049375 and bounding c−5/2c^{-5/2} at the left endpoint c=4c = 4

Exercise 3.1.3: Uniform Error Bound for the Cubic Maclaurin Approximation of Sine

Proofsynthesis

Prove using Theorem 3.1.4 that for every x∈[−1/2,1/2]x \in [-1/2, 1/2] ∣sin⁡x−(x−x36)∣≤13840.\left|\sin x - \left(x - \frac{x^3}{6}\right)\right| \le \frac{1}{3840}.

HintExpand

Note that the even-order derivative f(4)(0)=sin⁡(0)=0f^{(4)}(0) = \sin(0) = 0, so P3(x)=P4(x)=x−x3/6P_3(x) = P_4(x) = x - x^3/6. Apply the degree-44 Lagrange remainder R4(x)R_4(x) with ∣f(5)(c)∣=∣cos⁡c∣≤1|f^{(5)}(c)| = |\cos c| \le 1.

Worked solutionExpand
  1. Exploit vanishing 4th term: For f(x)=sin⁡xf(x) = \sin x we have f(4)(0)=sin⁡0=0f^{(4)}(0) = \sin 0 = 0 so the 3rd- and 4th-degree Maclaurin polynomials coincide: P3(x)=P4(x)=x−x36.P_3(x) = P_4(x) = x - \frac{x^3}{6}.
  2. Apply Theorem 3.1.4 of order k=4k = 4 There exists cc between 00 and xx such that: sin⁡x−P4(x)=R4(x)=f(5)(c)5!x5=cos⁡c120x5.\sin x - P_4(x) = R_4(x) = \frac{f^{(5)}(c)}{5!}x^5 = \frac{\cos c}{120}x^5.
  3. Bound on [−1/2,1/2][-1/2, 1/2] Since ∣cos⁡c∣≤1|\cos c| \le 1 for all c∈Rc \in \mathbb{R} and ∣x∣≤1/2|x| \le 1/2 ∣sin⁡x−(x−x36)∣=∣R4(x)∣≤1120(12)5=1120×32=13840.\left|\sin x - \left(x - \frac{x^3}{6}\right)\right| = |R_4(x)| \le \frac{1}{120}\left(\frac{1}{2}\right)^5 = \frac{1}{120 \times 32} = \frac{1}{3840}.

Verification criteria. Requires recognizing P3(x)=P4(x)P_3(x) = P_4(x) writing R4(x)=cos⁡c5!x5R_4(x) = \frac{\cos c}{5!}x^5 and bounding ∣cos⁡c∣≤1|\cos c| \le 1 and ∣x∣5≤1/32|x|^5 \le 1/32

Exercise 3.1.4: Implementing the Maclaurin Series of the Exponential Function

Constructionapplication

Complete the Python implementation of the Maclaurin partial sum ∑n=0N−1xnn!\sum_{n=0}^{N-1} \frac{x^n}{n!} for exe^x

Code Exercise

1 token to supply

Complete the Maclaurin series function for e^x

def exp_maclaurin(x, terms):
  val = 0.0
  import math
  for n in range(terms):
      # General term is x^n / n!
      val += () / math.factorial(n)
  return val

References & Further Reading

  • Spivak, M. (2008). Calculus (4th ed.), Chapter 20 (“Approximation by Polynomial Functions”, including Lagrange and integral remainder forms) and Chapters 25–27 (complex power series and why singularities in C\mathbb{C} govern real radius of convergence). Publish or Perish.
  • Rudin, W. (1976). Principles of Mathematical Analysis (3rd ed.), Chapter 5 (Taylor’s Theorem, Theorem 5.15) & Chapter 8 (“Some Special Functions”, power series and Fourier series). McGraw-Hill.
  • Apostol, T. M. (1967). Calculus, Volume 1: One-Variable Calculus, with an Introduction to Linear Algebra (2nd ed.), Chapter 7 (“Polynomial Approximations to Functions”) and Chapter 11 (“Infinite Series and Improper Integrals”). Wiley.