Series Solutions
Most second-order equations with variable coefficients, such as , have no solution in terms of elementary functions. The power-series method still solves them: assume , substitute, and turn the differential equation into a recurrence for the coefficients. This lesson derives recurrences for an Airy-type equation and a Hermite-type equation, shows when the series must converge, and computes the coefficients exactly with fractions.
It relies on Power Series and Taylor and Maclaurin Series. The survey course treats series in Power series.
The method
Write the solution as a power series about and differentiate term by term (allowed inside the radius of convergence):
Substitute, shift every sum so that each shows , and use the fact that a power series is zero only if every coefficient is zero. That yields one equation per power of , which is the recurrence. The first two coefficients and stay free: they are the two constants of a second-order equation.
A warm-up: for the coefficient of gives , so . Starting from , gives , which is ; starting from , gives . The method rediscovers the known answer.
An Airy-type equation:
This equation (Airy's equation) models light near a caustic and a quantum particle in a uniform field. Substituting:
The recurrence steps by three: feeds ; feeds ; and kills . The program generates exact coefficients and checks the truncated series against a numerical ODE solver.
from fractions import Fraction
import numpy as np
from scipy.integrate import solve_ivp
def airy_coeffs(c0, c1, N):
c = [Fraction(c0), Fraction(c1), Fraction(0)]
for n in range(1, N - 2):
c.append(c[n - 1] / ((n + 2) * (n + 1)))
return c
c = airy_coeffs(1, 0, 13)
print("c0..c12:", [str(v) for v in c])
series = lambda x, N: sum(float(cn) * x**n for n, cn in enumerate(airy_coeffs(1, 0, N)))
num = solve_ivp(lambda x, u: [u[1], x * u[0]], (0, 2), [1, 0], rtol=1e-12, atol=1e-12, dense_output=True)
for N in [4, 7, 10, 13, 25]:
print(f"N = {N:2d} terms y(2) ≈ {series(2.0, N):.8f}")
print("ODE solver y(2) =", f"{float(num.sol(2.0)[0]):.8f}")c0..c12: ['1', '0', '0', '1/6', '0', '0', '1/180', '0', '0', '1/12960', '0', '0', '1/1710720']
N = 4 terms y(2) ≈ 2.33333333
N = 7 terms y(2) ≈ 2.68888889
N = 10 terms y(2) ≈ 2.72839506
N = 13 terms y(2) ≈ 2.73078938
N = 25 terms y(2) ≈ 2.73088302
ODE solver y(2) = 2.73088302
The denominators grow like per three steps, much faster than the factorials of , so the series converges for every : 13 terms give four correct digits at and 25 terms match the solver to all eight printed decimals.
A Hermite-type equation and terminating series
Consider (Hermite's equation, central to the quantum harmonic oscillator). The coefficient of gives
When is a non-negative integer, the factor becomes zero at , and the series of matching parity stops: the solution is a polynomial. Up to a constant factor these are the Hermite polynomials .
from fractions import Fraction
import sympy as sp
def hermite_type(lam, N=12):
c0, c1 = (1, 0) if lam % 2 == 0 else (0, 1) # pick the parity that terminates
c = [Fraction(c0), Fraction(c1)]
for n in range(N - 2):
c.append(Fraction(2 * (n - lam)) * c[n] / ((n + 2) * (n + 1)))
return c
x = sp.symbols('x')
for lam in range(5):
p = sum(sp.Rational(cn.numerator, cn.denominator) * x**n for n, cn in enumerate(hermite_type(lam)))
H = sp.hermite(lam, x)
print(f"lambda={lam}: y = {sp.expand(p)} H/y = {sp.simplify(H / p)}")lambda=0: y = 1 H/y = 1
lambda=1: y = x H/y = 2
lambda=2: y = 1 - 2*x**2 H/y = -2
lambda=3: y = -2*x**3/3 + x H/y = -12
lambda=4: y = 4*x**4/3 - 4*x**2 + 1 H/y = 12
The ratio is a constant each time, so the series method produced the Hermite polynomials. For non-integer neither series terminates.
When does the series converge?
A point is an ordinary point of if and are analytic there (for polynomial coefficients: ). The key theorem:
Theorem. At an ordinary point the equation has two independent power-series solutions about , and each converges at least for , where is the distance from to the nearest singular point of or in the complex plane.
So has series about 0 with radius at least 1 (singularities at ), even though nothing goes wrong on the real line. At a singular point, such as for (Bessel's equation), plain power series can fail and the Frobenius method uses instead; it is beyond this lesson.
In software
- Special-function libraries.
scipy.special.airy,hermite, Bessel functions and others are evaluated with series near the origin and asymptotic expansions far away, exactly the recurrences above with careful floating-point control. - Physics and chemistry codes. Hermite polynomials are the wave functions of the quantum oscillator; Hermite–Gauss quadrature (
numpy.polynomial.hermite.hermgauss) uses their roots to integrate against , which appears in Gaussian-process and Bayesian ML code. - Automatic Taylor-series ODE solvers (the Taylor method in interval-arithmetic and astrodynamics libraries) generate coefficients by recurrences like these at every step.
Exercises
Exercise 1: Recognise the series
Use the series method on . Find the recurrence and identify the two solutions with , and with , .
Answer
; the solutions are and .
Solution
Exercise 2: A Gaussian appears
Find the recurrence for and sum the even solution with .
Answer
; the even solution is .
Solution
Exercise 3: A terminating Hermite series
For (), find the polynomial solution with , , and compare it with .
Answer
, and .
Solution
Exercise 4: Airy at (code)
With , , list the first four non-zero coefficients of the Airy-type series and evaluate the series at to 8 decimals using 30 terms.
Answer
, , , ; .
Solution
from fractions import Fraction
c = [Fraction(1), Fraction(0), Fraction(0)]
for n in range(1, 28):
c.append(c[n - 1] / ((n + 2) * (n + 1)))
print([str(v) for v in c[:10] if v != 0])
print(f"{float(sum(c)):.8f}")['1', '1/6', '1/180', '1/12960']
1.17229997
Exercise 5: Guaranteed radius
What radius of convergence is guaranteed for power-series solutions about 0 of ? About ?
Answer
At least 2 about 0, and at least about 1.
Solution
The singular points are the zeros of , namely . Their distance from 0 is 2. From 1 the distance is .
Test yourself
For , why does the recurrence relate to ?
- Because shifts the index down by 2 while shifts it up by 1, a gap of 3
- Because
- Because the equation is nonlinear
- Because Airy functions are periodic
When does the Hermite-type series for terminate?
- Always
- Never
- When is a non-negative integer (for the series of matching parity)
- When is negative
The equation is solved by power series about . What radius is guaranteed?
- 1
- 2
- 3
- 9