Calculus is the study of the infinite. While derivatives and integrals use infinite processes to find slopes and areas, sequences and series study infinite processes directly. How can you add up an infinite number of things and get a finite answer? This question is at the heart of Zeno’s paradoxes and modern data compression.
Limits of Sequences
A sequence is an infinite list of numbers . We are interested in its convergence: does the sequence eventually settle down to a specific value ?
In computer science, every iterative algorithm (like Newton’s method or Gradient Descent) is a sequence. We need to prove that these sequences converge to the correct solution.
Infinite Series: Summing to Infinity
A series is the sum of the terms of a sequence: .
A series converges if the sequence of its partial sums converges to a finite limit.
The Geometric Series
The most famous convergent series is the geometric series:
This formula is used to calculate the “Present Value” of future cash flows in finance and the “Multiplier Effect” in economics.
Taylor Series: Polynomials for Everything
The ultimate application of series is the Taylor Series. It allows us to represent transcendental functions () as infinite polynomials.
This is how calculators and computers compute . They don’t have a giant lookup table; they use the first few terms of the Taylor series to get as much precision as needed.
Interactive Lab
import numpy as np
import matplotlib.pyplot as plt
def taylor_exp(x, n):
"""Approximate e^x using first n terms of Taylor series at a=0."""
approx = 0
factorial = 1
for i in range(n):
if i > 0: factorial *= i
approx += (x**i) / factorial
return approx
x_val = 1.0
print(f"Exact e^{x_val}: {np.exp(x_val)}")
for n in [1, 3, 5, 10]:
print(f"Taylor (n={n}): {taylor_exp(x_val, n)}")
# Visualizing approximation
x = np.linspace(-2, 2, 100)
plt.plot(x, np.exp(x), 'k', label='Exact exp(x)')
plt.plot(x, taylor_exp(x, 3), '--', label='n=3 Approximation')
plt.plot(x, taylor_exp(x, 5), ':', label='n=5 Approximation')
plt.ylim(-1, 8)
plt.legend()
plt.title("Taylor Expansion of e^x")
plt.grid(True)
plt.show()
python
1import numpy as np
2import matplotlib.pyplot as plt
3
4def taylor_exp(x, n):
5"""Approximate e^x using first n terms of Taylor series at a=0."""
A Power Series only converges for within a certain “Radius of Convergence.” Outside this range, the series explodes to infinity. Knowing this limit is vital for ensuring the stability of electronic filters and signal processing algorithms.
Exercises
Knowledge Check
Does the series 1 + 1/2 + 1/4 + 1/8 + ... converge? If so, to what?
Answer: Yes, it converges to 2.
This is a geometric series with first term a=1 and ratio r=1/2. Sum = a/(1-r) = 1/(1-0.5) = 2.
Does the series 1 + 1/2 + 1/4 + 1/8 + ... converge? If so, to what?
Knowledge Check
Why is the Taylor series of sin(x) particularly efficient for computers?
Answer: It only uses odd powers, and the signs alternate, causing it to converge very quickly near zero.
The alternating nature and the fast-growing factorial in the denominator ensure that the approximation reaches high decimal precision with very few terms.
Why is the Taylor series of sin(x) particularly efficient for computers?
Knowledge Check
What happens to a power series outside its radius of convergence?
Answer: It diverges (the values blow up).
The radius of convergence defines the 'safe' area where the infinite sum results in a finite number. Beyond this boundary, the addition of terms leads to infinity.
What happens to a power series outside its radius of convergence?