Lesson 7 of 15

Power Series

Power Series

A power series centered at (a) is:

n=0cn(xa)n\sum_{n=0}^{\infty} c_n (x - a)^n

where (c_n) are the coefficients.

Radius of Convergence

Every power series has a radius of convergence (R) such that:

  • The series converges absolutely for (|x - a| < R)
  • The series diverges for (|x - a| > R)

The radius can be found using the ratio test:

R=limncncn+1R = \lim_{n \to \infty} \left| \frac{c_n}{c_{n+1}} \right|

Common Power Series

FunctionPower seriesRadius
(e^x)(\sum x^n / n!)(\infty)
(1/(1-x))(\sum x^n)1
(\ln(1+x))(\sum (-1)^{n+1} x^n / n)1

Evaluating a Power Series

To evaluate at a point (x), compute the partial sum:

def eval_power_series(coeffs, x, N):
    return sum(c * x**n for n, c in enumerate(coeffs[:N+1]))

Your Task

Implement:

  1. eval_power_series(coeff_func, x, N) -- given a function coeff_func(n) returning the (n)-th coefficient, evaluate (\sum_{n=0}^{N} c_n \cdot x^n)
  2. estimate_radius(coeff_func, n) -- estimate the radius of convergence as (|c_n / c_{n+1}|)
Pyodide loading...
Loading...
Click "Run" to execute your code.