Pseudo-spectral method explained
Pseudo-spectral methods,[1] also known as discrete variable representation (DVR) methods, are a class of numerical methods used in applied mathematics and scientific computing for the solution of partial differential equations. They are closely related to spectral methods, but complement the basis by an additional pseudo-spectral basis, which allows representation of functions on a quadrature grid. This simplifies the evaluation of certain operators, and can considerably speed up the calculation when using fast algorithms such as the fast Fourier transform.
Motivation with a concrete example
Take the initial-value problem
i
\psi(x,t)=l[-
+V(x)r]\psi(x,t), \psi(t0)=\psi0
with periodic conditions
. This specific example is the
Schrödinger equation for a particle in a potential
, but the structure is more general. In many practical partial differential equations, one has a term that involves derivatives (such as a kinetic energy contribution), and a multiplication with a function (for example, a potential).
In the spectral method, the solution
is expanded in a suitable set of basis functions, for example plane waves,
} \sum_n c_n(t) e^ .
Insertion and equating identical coefficients yields a set of ordinary differential equations for the coefficients,
cn(t)=(2\pin)2cn+\sumkVn-kck,
where the elements
are calculated through the explicit Fourier-transform
The solution would then be obtained by truncating the expansion to
basis functions, and finding a solution for the
. In general, this is done by
numerical methods, such as
Runge–Kutta methods. For the numerical solutions, the right-hand side of the ordinary differential equation has to be evaluated repeatedly at different time steps. At this point, the spectral method has a major problem with the potential term
.
In the spectral representation, the multiplication with the function
transforms into a vector-matrix multiplication, which scales as
. Also, the matrix elements
need to be evaluated explicitly before the differential equation for the coefficients can be solved, which requires an additional step.
In the pseudo-spectral method, this term is evaluated differently. Given the coefficients
, an inverse discrete Fourier transform yields the value of the function
at discrete grid points
. At these grid points, the function is then multiplied,
\psi'(xi,t)=V(xi)\psi(xi,t)
, and the result Fourier-transformed back. This yields a new set of coefficients
that are used instead of the matrix product
.
It can be shown that both methods have similar accuracy. However, the pseudo-spectral method allows the use of a fast Fourier transform, which scales as
, and is therefore significantly more efficient than the matrix multiplication. Also, the function
can be used directly without evaluating any additional integrals.
Technical discussion
In a more abstract way, the pseudo-spectral method deals with the multiplication of two functions
and
as part of a partial differential equation. To simplify the notation, the time-dependence is dropped. Conceptually, it consists of three steps:
f(x),\tilde{f}(x)=V(x)f(x)
are expanded in a finite set of basis functions (this is the
spectral method).
- For a given set of basis functions, a quadrature is sought that converts scalar products of these basis functions into a weighted sum over grid points.
- The product is calculated by multiplying
at each grid point.
Expansion in a basis
The functions
can be expanded in a finite basis
as
\tildef(x)=
\tildecn\phin(x)
For simplicity, let the basis be orthogonal and normalized,
\langle\phin,\phim\rangle=\deltanm
using the
inner product \langlef,g\rangle=
f(x)\overline{g(x)}dx
with appropriate boundaries
. The coefficients are then obtained by
\tildecn=\langle\tildef,\phin\rangle
A bit of calculus yields then
with
Vn-m=\langleV\phim,\phin\rangle
. This forms the basis of the spectral method. To distinguish the basis of the
from the quadrature basis, the expansion is sometimes called Finite Basis Representation (FBR).
Quadrature
For a given basis
and number of
basis functions, one can try to find a quadrature, i.e., a set of
points and weights such that
\langle\phin,\phim\rangle=
wi\phin(xi)\overline{\phim(xi)} n,m=0,\ldots,N
Special examples are the Gaussian quadrature for polynomials and the Discrete Fourier Transform for plane waves. It should be stressed that the grid points and weights,
are a function of the basis
and the number
.
The quadrature allows an alternative numerical representation of the function
through their value at the grid points. This representation is sometimes denoted Discrete Variable Representation (DVR), and is completely equivalent to the expansion in the basis.
cn=\langlef,\phin\rangle=
wif(xi)\overline{\phin(xi)}
Multiplication
The multiplication with the function
is then done at each grid point,
This generally introduces an additional approximation. To see this, we can calculate one of the coefficients
:
\tildecn=\langle\tildef,\phin\rangle=\sumiwi\tildef(xi)\overline{\phin(xi)}=\sumiwiV(xi)f(xi)\overline{\phin(xi)}
However, using the spectral method, the same coefficient would be
\tildecn=\langleVf,\phin\rangle
. The pseudo-spectral method thus introduces the additional approximation
\langleVf,\phin\rangle ≈ \sumiwiV(xi)f(xi)\overline{\phin(xi)}.
If the product
can be represented with the given finite set of basis functions, the above equation is exact due to the chosen quadrature.
Special pseudospectral schemes
The Fourier method
If periodic boundary conditions with period
are imposed on the system, the basis functions can be generated by plane waves,
} e^
with
kn=(-1)n\lceiln/2\rceil2\pi/L
, where
is the
ceiling function.
The quadrature for a cut-off at
is given by the
discrete Fourier transformation. The grid points are equally spaced,
with spacing
, and the constant weights are
.
For the discussion of the error, note that the product of two plane waves is again a plane wave,
with
. Thus, qualitatively, if the functions
can be represented sufficiently accurately with
basis functions, the pseudo-spectral method gives accurate results if
basis functions are used.
An expansion in plane waves often has a poor quality and needs many basis functions to converge. However, the transformation between the basis expansion and the grid representation can be done using a Fast Fourier transform, which scales favorably as
. As a consequence, plane waves are one of the most common expansion that is encountered with pseudo-spectral methods.
Polynomials
Another common expansion is into classical polynomials. Here, the Gaussian quadrature is used, which states that one can always find weights
and points
such that
holds for any polynomial
of degree
or less. Typically, the weight function
and ranges
are chosen for a specific problem, and leads to one of the different forms of the quadrature. To apply this to the pseudo-spectral method, we choose basis functions
\phin(x)=\sqrt{w(x)}Pn(x)
, with
being a polynomial of degree
with the property
w(x)Pn(x)Pm(x)dx=\deltamn.
Under these conditions, the
form an orthonormal basis with respect to the scalar product
\langlef,g\rangle=
f(x)\overline{g(x)}dx
. This basis, together with the quadrature points can then be used for the pseudo-spectral method.
For the discussion of the error, note that if
is well represented by
basis functions and
is well represented by a polynomial of degree
, their product can be expanded in the first
basis functions, and the pseudo-spectral method will give accurate results for that many basis functions.
Such polynomials occur naturally in several standard problems. For example, the quantum harmonic oscillator is ideally expanded in Hermite polynomials, and Jacobi-polynomials can be used to define the associated Legendre functions typically appearing in rotational problems.
References
- Orszag. Steven A.. Numerical Methods for the Simulation of Turbulence. Physics of Fluids. 1969. 12. 12. II-250. 10.1063/1.1692445.
- Book: Gottlieb. David. Orszag. Steven A.. Numerical analysis of spectral methods : theory and applications. 1989. Society for Industrial and Applied Mathematics. Philadelphia, Pa.. 978-0898710236. 5. print..
- Book: Hesthaven. Jan S.. Gottlieb. Sigal. Sigal Gottlieb. Gottlieb. David. Spectral methods for time-dependent problems. 2007. Cambridge Univ. Press. Cambridge [u.a.]. 9780521792110. 1. publ..
- Jie Shen, Tao Tang and Li-Lian Wang (2011) "Spectral Methods: Algorithms, Analysis and Applications" (Springer Series in Computational Mathematics, V. 41, Springer), .
- Book: Trefethen. Lloyd N.. Spectral methods in MATLAB. 2000. SIAM. Philadelphia, Pa. 978-0-89871-465-4. 3rd. repr..
- Book: Fornberg. Bengt. A Practical Guide to Pseudospectral Methods. 1996. Cambridge University Press. Cambridge. 9780511626357.
- Book: Boyd. John P.. Chebyshev and Fourier spectral methods. 2001. Dover Publications. Mineola, N.Y.. 978-0486411835. 2nd ed., rev..
- Book: Funaro. Daniele. Polynomial approximation of differential equations. 1992. Springer-Verlag. Berlin. 978-3-540-46783-0.
- de Frutos. Javier. Novo. Julia. A Spectral Element Method for the Navier--Stokes Equations with Improved Accuracy. SIAM Journal on Numerical Analysis. January 2000. 38. 3. 799–819. 10.1137/S0036142999351984.
- Book: Claudio. Canuto. M. Yousuff. Hussaini. Alfio Quarteroni. Alfio. Quarteroni. Thomas A.. Zang. Spectral methods fundamentals in single domains. 2006. Springer-Verlag. Berlin. 978-3-540-30726-6.
- Book: Press . WH . Teukolsky . SA . Vetterling . WT . Flannery . BP . 2007 . Numerical Recipes: The Art of Scientific Computing . 3rd . Cambridge University Press . New York . 978-0-521-88068-8 . Section 20.7. Spectral Methods . http://apps.nrbook.com/empanel/index.html#pg=1083.
Notes and References
- Orszag. Steven A.. Comparison of Pseudospectral and Spectral Approximation. Studies in Applied Mathematics. September 1972. 51. 3. 253–259. 10.1002/sapm1972513253.