Skip to content

Sequences & Series

๐Ÿ”ข Sequences & Series

Infinite sequences and series allow us to approximate complex functions using simple polynomials. This is the foundation of many numerical algorithms.


๐ŸŸข 1. Sequences

A sequence is an ordered list of numbers {an}\{a_n\}.

  • Convergence: A sequence {an}\{a_n\} converges to LL if limโกnโ†’โˆžan=L\lim_{n \to \infty} a_n = L.
  • Divergence: If the limit doesnโ€™t exist or is infinite.

Common Sequences

  • Arithmetic: an=a1+(nโˆ’1)da_n = a_1 + (n-1)d.
  • Geometric: an=a1rnโˆ’1a_n = a_1 r^{n-1} (converges if โˆฃrโˆฃ<1|r| < 1 to 00).

๐ŸŸก 2. Infinite Series

An infinite series is the sum of a sequence: โˆ‘n=1โˆžan\sum_{n=1}^\infty a_n.

Geometric Series

โˆ‘n=0โˆžarn\sum_{n=0}^\infty ar^n converges if and only if โˆฃrโˆฃ<1|r| < 1. Sum=a1โˆ’r\text{Sum} = \frac{a}{1 - r}

Divergence Test

If limโกnโ†’โˆžanโ‰ 0\lim_{n \to \infty} a_n \neq 0, then the series โˆ‘an\sum a_n must diverge.


๐Ÿ”ด 3. Tests for Convergence

To determine if a series converges without finding its sum:

  1. Integral Test: Compare the series to โˆซ1โˆžf(x)dx\int_1^\infty f(x) dx.
  2. P-Series Test: โˆ‘1np\sum \frac{1}{n^p} converges if p>1p > 1.
  3. Comparison Test: Compare with a known convergent/divergent series.
  4. Ratio Test: limโกnโ†’โˆžโˆฃan+1anโˆฃ=L\lim_{n \to \infty} |\frac{a_{n+1}}{a_n}| = L. Converges if L<1L < 1, diverges if L>1L > 1.
  5. Alternating Series Test: For sums like โˆ‘(โˆ’1)nbn\sum (-1)^n b_n.

๐ŸŽฏ 4. Power Series and Taylor Series

A Power Series is a function of the form f(x)=โˆ‘n=0โˆžcn(xโˆ’a)nf(x) = \sum_{n=0}^\infty c_n (x - a)^n.

Taylor and Maclaurin Series

A Taylor Series represents a function f(x)f(x) as an infinite sum of its derivatives at a point aa: f(x)=โˆ‘n=0โˆžf(n)(a)n!(xโˆ’a)nf(x) = \sum_{n=0}^\infty \frac{f^{(n)}(a)}{n!} (x - a)^n

If a=0a = 0, it is called a Maclaurin Series: f(x)=f(0)+fโ€ฒ(0)x+fโ€ฒโ€ฒ(0)2!x2+โ€ฆf(x) = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \dots

Common Maclaurin Series

  • ex=โˆ‘xnn!=1+x+x22!+โ€ฆe^x = \sum \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \dots
  • sinโก(x)=โˆ‘(โˆ’1)nx2n+1(2n+1)!=xโˆ’x33!+โ€ฆ\sin(x) = \sum (-1)^n \frac{x^{2n+1}}{(2n+1)!} = x - \frac{x^3}{3!} + \dots
  • cosโก(x)=โˆ‘(โˆ’1)nx2n(2n)!=1โˆ’x22!+โ€ฆ\cos(x) = \sum (-1)^n \frac{x^{2n}}{(2n)!} = 1 - \frac{x^2}{2!} + \dots

๐Ÿ’ก Practical Example: Calculating Pi with a Series

The Gregory-Leibniz series for ฯ€/4\pi/4: ฯ€4=1โˆ’13+15โˆ’17+โ‹ฏ=โˆ‘n=0โˆž(โˆ’1)n2n+1\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \dots = \sum_{n=0}^\infty \frac{(-1)^n}{2n+1}

def estimate_pi(n_terms):
    pi_over_4 = 0
    for n in range(n_terms):
        pi_over_4 += ((-1)**n) / (2*n + 1)
    return pi_over_4 * 4

# More terms = more precision
print(f"PI (10 terms): {estimate_pi(10)}")
print(f"PI (10,000 terms): {estimate_pi(10000)}")

๐Ÿš€ Key Takeaways

  • Sequences are lists, series are sums.
  • Convergence tests tell us if an infinite sum is finite.
  • Taylor Series allow us to approximate any โ€œwell-behavedโ€ function with a polynomial.