spectral.legendre_diff_matrix#
- spectral.legendre_diff_matrix(nodes: ndarray) ndarray[source]#
Return Legendre spectral differentiation matrix at arbitrary nodes.
Constructs the spectral differentiation matrix \(D\) such that \(D\mathbf{u}\) approximates \(\frac{du}{dx}\) at the collocation nodes. The matrix is computed using Vandermonde matrices without requiring explicit quadrature.
- Parameters:
- nodes
np.ndarray Collocation nodes
- nodes
- Returns:
np.ndarrayDifferentiation matrix of shape (N, N)
Notes
The differentiation matrix is constructed as
\[D = V_x V^{-1}\]where \(V\) is the Vandermonde matrix and \(V_x\) contains derivatives of the basis polynomials. This approach works for arbitrary node distributions.
References
Engsig-Karup, “Lecture 2: Polynomial Methods”