Lesson 7 of 15
Power Series
Power Series
A power series centered at (a) is:
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:
Common Power Series
| Function | Power series | Radius |
|---|---|---|
| (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:
eval_power_series(coeff_func, x, N)-- given a functioncoeff_func(n)returning the (n)-th coefficient, evaluate (\sum_{n=0}^{N} c_n \cdot x^n)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.