Calculus · matrix exponential
Matrix ODEs and the Padé Approximation
A linear matrix ordinary differential equation has the form x′(t) = A x(t), with a constant square matrix A and a starting vector x(0) = x₀. Its solution is x(t) = exp(At) x₀, where exp(At) is the matrix exponential, defined by the same power series as the scalar exponential: I + At + (At)²/2! + (At)³/3! + …. Everything hinges on evaluating that matrix reliably, and the Padé approximation is the standard way.
Why not simply sum the series? For matrices with large entries the terms grow enormously before they shrink, cancellation destroys digits, and the sum may need hundreds of terms. A rational approximation reaches the same accuracy with a few matrix products and one linear solve.
The Padé idea
A Padé approximation replaces exp(z) by a ratio of two polynomials, p(z)/q(z), chosen to agree with the series to the highest possible order. The [1/1] form is (1 + z/2)/(1 − z/2). The [2/2] form is
(1 + z/2 + z²/12) / (1 − z/2 + z²/12)
For a matrix, z becomes A and the division becomes a linear solve, so exp(A) ≈ q(A)⁻¹ p(A). The solve is a job for the LU factorization, run once and reused for every right-hand side.
A scalar check
Take z = −1, where exp(−1) = 0.367879. The [1/1] form gives 0.5/1.5 = 0.333333, an error of 0.035. The [2/2] form gives (1 − 0.5 + 0.083333)/(1 + 0.5 + 0.083333) = 0.583333/1.583333 = 0.368421, an error of 0.0005. Going from [1/1] to [2/2] improved the answer by almost two orders of magnitude, which shows how quickly the diagonal approximants converge near zero.
A matrix check: rotation
Let A = [[0, 1], [−1, 0]]. The ODE x′ = Ax describes rotation: the exact exponential is the rotation matrix [[cos t, sin t], [−sin t, cos t]]. For t = 1 that is [[0.5403, 0.8415], [−0.8415, 0.5403]].
Apply the [1/1] form with z = A. The numerator is I + A/2 = [[1, 0.5], [−0.5, 1]], and the denominator is I − A/2 = [[1, −0.5], [0.5, 1]], whose inverse is (1/1.25) × [[1, 0.5], [−0.5, 1]]. Multiplying the inverse by the numerator gives 0.8 × [[1, 0.5], [−0.5, 1]]², and the square is [[0.75, 1], [−1, 0.75]]. The result is [[0.6, 0.8], [−0.8, 0.6]].
That matrix is a true rotation, since 0.6² + 0.8² = 1, only through the angle arctan(0.8/0.6) = 0.9273 instead of 1. The approximation preserves the length of the vector exactly, which is a structural property of the diagonal Padé form for skew-symmetric matrices. A truncated power series would lose it, and a trajectory computed from one would spiral outward or inward.
Scaling and squaring
Padé approximants are accurate only when the norm of A is modest. The usual remedy is scaling and squaring. Pick an integer s so that ‖A‖/2ˢ is small, approximate exp(A/2ˢ) by a Padé form, then square the result s times, using exp(A) = (exp(A/2ˢ))^(2ˢ). The squarings multiply any rounding error somewhat, so s is kept as small as the accuracy target allows.
For the scalar case z = −1 with s = 1, the [1/1] form at −0.5 gives 0.75/1.25 = 0.6, and squaring gives 0.36, closer to 0.3679 than the unscaled 0.3333. The gain is visible even with the crudest form.
Stepping an ODE
For repeated steps of size h, compute E = exp(hA) once. Then x(h) = E x₀, x(2h) = E x(h), and so on, each step a single matrix-vector product. When A changes with time, the single exponential no longer applies and a different integrator is needed.
Stiff problems, those with eigenvalues of very different magnitudes, suit this approach well, because the exponential treats fast decaying modes exactly where explicit time steppers must use tiny steps.
Related reading
The exponential relates the eigenvalues of A to the behavior of the solution: complex eigenvalues give oscillation, negative real parts give decay. For the decomposition behind that, see Schur factorization. Rational approximations of functions in general appear in the continued fractions page, and the neighboring methods are collected under interpolation and calculus.