A fast and well-conditioned spectral method

Sheehan Olver, Alex Townsend · DOI

Abstract

A spectral method is developed for the direct solution of linear ordinary differential equations with variable coefficients. The method leads to matrices which are almost banded, and a numerical solver is presented that takes O(m^2n) operations, where m is the number of Chebyshev points needed to resolve the coefficients of the differential operator and n is the number of Chebyshev coefficients needed to resolve the solution to the differential equation. We prove stability of the method by relating it to a diagonally preconditioned system which has a bounded condition number, in a suitable norm. For Dirichlet boundary conditions, this implies stability in the standard 2-norm. An adaptive QR factorization is developed to efficiently solve the resulting linear system and automatically choose the optimal number of Chebyshev coefficients needed to represent the solution. The resulting algorithm can efficiently and reliably solve for solutions that require as many as a million unknowns.

Introduction

Spectral methods are often considered the "gold standard" for solving differential equations when high precision is required. They offer super-algebraic convergence, meaning the error decreases faster than any power of $1/n$. However, traditional spectral approaches, such as the Tau-method or collocation, have historically been hampered by two major drawbacks: high computational complexity ($O(n^3)$ for $n$ unknowns) and extreme ill-conditioning. As the number of points or the order of the derivative increases, the resulting linear systems become hypersensitive to numerical errors, with condition numbers growing as $O(n^{2N})$.

This paper introduces a revolutionary spectral method that bridges the gap between the high accuracy of global spectral methods and the computational efficiency of local methods like finite differences. By utilizing a specific hierarchy of polynomial bases, the authors produce "almost banded" matrices that remain well-conditioned even as the resolution increases.

The Core Innovation: Ultraspherical Basis Switching

The mathematical foundation of this method is the use of ultraspherical (Gegenbauer) polynomials to represent different orders of derivatives. In traditional methods, a single basis (like Chebyshev) is used for everything. In this new approach, the $k$-th derivative of a function is represented in a specific ultraspherical basis $C^{(k)}$.

This strategic choice of bases ensures that the differentiation operator remains a simple, sparse diagonal matrix. To facilitate this, the authors developed:

  1. Banded Conversion Operators: These allow for efficient movement between different ultraspherical bases.
  2. Banded Multiplication Operators: These handle variable coefficients within the differential equation without destroying the sparsity of the system.

When combined, the differential operator becomes a banded matrix. Boundary conditions are incorporated via "boundary bordering," which adds a few dense rows at the top of the matrix. The resulting "almost banded" structure is the key to the method's efficiency.

Algorithmic Efficiency and Stability

To solve the resulting linear systems, the authors present a specialized Adaptive QR Factorization. This solver is designed specifically for the almost-banded structure, operating in $O(m^2n)$ time—where $m$ is the complexity of the variable coefficients. A standout feature of this solver is its ability to perform "lazy evaluation," automatically determining the optimal number of coefficients ($n_{opt}$) required to reach machine precision. This ensures the algorithm never performs more work than is strictly necessary.

Crucially, the paper provides a proof of stability. By relating the method to a diagonally preconditioned system, the authors demonstrate that the condition number remains bounded as $n \to \infty$. This is a significant departure from classical spectral methods, where numerical stability typically "explodes" as resolution is added.

Key Results and Benchmarks

The method was evaluated against several challenging benchmark problems in numerical analysis:

  • Scalability: The algorithm solved an Airy equation problem requiring 2 million unknowns in under 11 seconds on a 2011-era iMac.
  • High-Order Robustness: The method maintained machine precision (errors $\approx 10^{-15}$) for 10th-order differential equations, a task that is usually catastrophically ill-conditioned for standard spectral solvers.
  • Singular Perturbations: It successfully resolved problems with extremely thin boundary layers (down to $\epsilon = 10^{-13}$), significantly outperforming MATLAB’s built-in sparse LU solvers in both speed and reliability.

Limitations and Future Directions

While the method represents a major advancement, some areas remain for future exploration. Currently, the "bandedness" of multiplication operators can be lost in non-linear ODEs if not handled carefully, though Newton iteration remains a viable path. Additionally, while the authors suggest that tensor products could extend this method to high-dimensional PDEs on rectangular domains, the implementation for complex geometries (such as disks or triangles) and 3D spaces remains an open challenge.

Conclusion

This work proves that the perceived trade-off between the global accuracy of spectral methods and the local sparsity of finite elements is a myth. By choosing the correct polynomial basis for each derivative, it is possible to create a solver that is both exponentially accurate and computationally lean, capable of handling problems with millions of degrees of freedom on standard consumer hardware.

Summary updated

BibTeX
@article{olver2013fast,
  author = {Sheehan Olver and Alex Townsend},
  title = {{A fast and well-conditioned spectral method}},
  journal = {SIAM Rev.},
  year = {2013},
  doi = {10.1137/120865458},
}
Figure