SpECTRE  v2025.08.19
Spectral::Chebyshev Class Reference

A collection of helper functions for Chebyshev polynomials. More...

#include <Chebyshev.hpp>

Static Public Member Functions

template<typename T >
static T basis_function_value (size_t k, const T &x)
 Value of the basis function \(\Phi_k(x) = T_k(x)\).
 
static double basis_function_normalization_square (size_t k)
 The normalization square \(c_k\) of the basis function \(\Phi_k(x)\), i.e. the definite integral of its square.
 
template<Quadrature quadrature>
static DataVector collocation_points (size_t num_points)
 Collocation points \(\{x_i\}\). More...
 
template<Quadrature quadrature>
static DataVector integration_weights (size_t num_points)
 Integration weights \(\{w_i\}\). More...
 
static Matrix indefinite_integral_matrix (size_t num_points)
 Matrix used to compute the modes of the indefinite integral from the modes of the integrand such that the constant of integration is determined by requiring the integral to be zero at \(x=-1\). More...
 
static Matrix definite_integral_matrix (size_t num_points)
 Row-vector used to compute the definite integral from the modes of the integrand. More...
 

Detailed Description

A collection of helper functions for Chebyshev polynomials.

Details

The Chebyshev polynomials are given by:

\[ T_n (x) = \cos(n \theta), \text{ } \theta = \arccos(x) \]

The Chebyshev expansion of a function \(f \in [-1,1] \) is given by:

\[ f(x) = \sum_{n=0}^{\infty} f_n T_n(x) \]

where

\[ f_n = \frac{1}{c_n} \int_{-1}^1 f(x) T_n(x) w(x) dx \]

where the weight function is \(w(x) = (1-x^2)^{-1/2}\) and the basis function normalization value is given by:

\begin{align*} c_n &=\begin{cases} \hfil \pi \hfil & \text{if } n = 0 \\ \hfil \frac{\pi}{2} \hfil & \text{otherwise} \end{cases} \end{align*}

If a function is discretized at \(N+1\) collocation points, the modal representation will have \(N+1\) spectral coefficients consisting of

\[ f_n \qquad \text{for } n = 0, \ldots, N \]

For more details about using Chebyshev polynomials see e.g. [28] and [75].

Member Function Documentation

◆ collocation_points()

template<Quadrature quadrature>
static DataVector Spectral::Chebyshev::collocation_points ( size_t  num_points)
static

Collocation points \(\{x_i\}\).

Details

The collocation points on the interval \([-1, 1]\) are given by

\begin{align*} x_i &=\begin{cases} \hfil - \cos \frac{(2i+1)\pi}{2N+2} \hfil & \text{for Quadrature::Gauss} \\ \hfil - \cos \frac{i \pi}{N} \hfil & \text{for Quadrature::GaussLobatto} \end{cases} \end{align*}

◆ definite_integral_matrix()

static Matrix Spectral::Chebyshev::definite_integral_matrix ( size_t  num_points)
static

Row-vector used to compute the definite integral from the modes of the integrand.

Details

Given the modes \(\tilde{f}_j\) of the integral (see indefinite_integral_matrix), the definite integral is given by evaluating the series at \(x=1\) and \(x=-1\) and taking the difference. Given that \(T_n(1) = 1\) and \(T_n(-1) = (-1)^n\), this means multiplying the indefinite_integral_matrix by the row-vector \(\{0, 2, 0, 2, \ldots \}\) which yields:

\begin{align*} \tilde{q}_i &=\begin{cases} \hfil -\frac{2}{n^2-1}, \hfil & \text{for } i \text{ even}\\ \hfil 0 \hfil & \text{for } i \text{ odd} \end{cases} \end{align*}

◆ indefinite_integral_matrix()

static Matrix Spectral::Chebyshev::indefinite_integral_matrix ( size_t  num_points)
static

Matrix used to compute the modes of the indefinite integral from the modes of the integrand such that the constant of integration is determined by requiring the integral to be zero at \(x=-1\).

Details

Chebyshev polynomials satisfy the identity:

\[ \int^x dy T_n (y) = \left\{ \frac{T_{n+1}(x)}{2(n+1)} + \frac{T_{n-1}(x)}{2(n-1)} \right\}, \qquad n \geq 2 \]

Thus the modes \(\tilde{f}_j\) of the integral are given as:

\begin{align*} \tilde{f}_i &=\begin{cases} \hfil \frac{f_{i-1}-f_{i+1}}{2i}, \hfil & \text{for } i > 1\\ \hfil f_0 - \frac{f_2}{2} \hfil & \text{for } i = 1 \end{cases} \end{align*}

where \(f_j\) are the modes of the integrand. \(\tilde{f}_0\) is a constant of integration, which we choose such that the integral is 0 at the left boundary of the domain ( \(x=-1\)). The condition for this is:

\[ \tilde{f}_0=\sum_{i=1}^{N}(-1)^{i+1}\tilde{f}_i \]

◆ integration_weights()

template<Quadrature quadrature>
static DataVector Spectral::Chebyshev::integration_weights ( size_t  num_points)
static

Integration weights \(\{w_i\}\).

Details

The integration weights are used to approximate the weighted integral \(Q[f]=\int f(x)w(x)\mathrm{d}x\approx \sum_k f_k w_k\). For Quadrature::Gauss, the weights are given by:

\[ w_i = \frac{\pi}{N+1} \]

For Quadrature::GaussLobatto, the weights are given by:

\begin{align*} w_i &=\begin{cases} \hfil \frac{\pi}{2N} \hfil & \text{for } j = 0, N\\ \hfil \frac{\pi}{N} \hfil & \text{for } j = 1, \ldots, N-1 \end{cases} \end{align*}

Note
These weights are used to compute the modes from the nodal values. They are not used to evaluate definite or indefinite integrals directly from the nodal values.

The documentation for this class was generated from the following file: