Power Series Review
Equations with variable coefficients, such as or , usually have no solutions in elementary functions. But their solutions can still be written as power series, and many of the famous special functions of physics (Airy, Bessel, Legendre) are defined that way. This lesson reviews the series tools we need; for the full theory see Power Series and Taylor and Maclaurin Series.
Power series and their radius of convergence
A power series about is
There is a radius of convergence : the series converges for and diverges for . The ratio test often finds it: when the limit exists.
Inside the radius a power series can be differentiated and integrated term by term, and the result has the same radius:
A function equal to its Taylor series near is called analytic at . Polynomials, , , are analytic everywhere; is analytic except at , and its series about 0 has radius 1.
Shifting the index
Solving ODEs with series means combining sums with different powers. The trick is to shift the index so that every sum is written with the same power :
(Replace by and adjust the starting value.) Two power series are equal on an interval only if all their coefficients are equal; that identity principle turns an ODE into a recurrence for the coefficients.
A first example:
Put . Then , so
from fractions import Fraction
import math
a = [Fraction(1)]
for k in range(10):
a.append(a[k] / (k + 1))
print("coefficients:", [str(c) for c in a[:7]])
x = 1.5
partial = sum(float(c) * x**k for k, c in enumerate(a))
print(f"partial sum at x = {x}: {partial:.8f}, e^x = {math.exp(x):.8f}")coefficients: ['1', '1', '1/2', '1/6', '1/24', '1/120', '1/720']
partial sum at x = 1.5: 4.48168660, e^x = 4.48168907
Series with SymPy
sp.series expands a known function; dsolve with a power-series hint expands the unknown solution of an ODE.
import sympy as sp
x = sp.symbols("x")
print(sp.series(sp.exp(-x**2), x, 0, 9))
print(sp.series(1 / (1 + x**2), x, 0, 9))
y = sp.Function("y")
print(sp.dsolve(y(x).diff(x) - y(x), hint="1st_power_series", n=6))1 - x**2 + x**4/2 - x**6/6 + x**8/24 + O(x**9)
1 - x**2 + x**4 - x**6 + x**8 + O(x**9)
Eq(y(x), C1 + C1*x + C1*x**2/2 + C1*x**3/6 + C1*x**4/24 + C1*x**5/120 + O(x**6))
The series of has radius 1 even though the function is smooth on the whole real line: the obstruction is the complex singularity at . Radii of convergence are decided in the complex plane, which matters in the next lesson.
In software
- Libraries evaluate special functions (
scipy.special.airy,jv,erf) with power series near 0, asymptotic expansions for large arguments, and recurrences in between. - Automatic differentiation tools can produce Taylor coefficients of solutions directly ("Taylor-mode AD"), the modern version of the series method.
Exercises
Exercise 1: Radius
Find the radius of convergence of .
Answer
.
Solution
. It is the geometric series .
Exercise 2: Shift the index
Rewrite as a sum of .
Answer
.
Solution
Set : the term becomes , and corresponds to . Rename to .
Exercise 3: A recurrence (code)
Solve , with a power series. Which function is it?
Answer
, odd coefficients 0: .
Solution
gives and . So , , : the coefficients of in powers of .
from fractions import Fraction
a = [Fraction(1), Fraction(0)]
for k in range(1, 9):
a.append(2 * a[k - 1] / (k + 1))
print([str(c) for c in a])['1', '0', '1', '0', '1/2', '0', '1/6', '0', '1/24', '0']
Test yourself
What is the radius of convergence of the Maclaurin series of ?
- 0
- 1
- 2
equals…
Why does the Maclaurin series of have radius 1?
- Because of the singularities at in the complex plane
- Because the function is not defined at
- It has infinite radius
- Because of rounding