spectral.solve_legendre_collocation#
- spectral.solve_legendre_collocation(epsilon: float, num_nodes: int) tuple[ndarray, ndarray][source]#
Solve Exercise A boundary value problem using Legendre-Gauss-Lobatto collocation.
Solves:
\[-\varepsilon \frac{d^2u}{dx^2} - \frac{du}{dx} = 1, \quad u(0) = u(1) = 0\]The collocation method enforces the differential equation exactly at the collocation nodes (Legendre-Gauss-Lobatto points). This nodal approach naturally incorporates boundary conditions at the endpoints.
- Parameters:
- Returns:
- xi
np.ndarray Collocation nodes
- coeffs
np.ndarray Modal coefficients
- xi
Notes
Legendre-Gauss-Lobatto points include the domain endpoints, making them natural for imposing Dirichlet boundary conditions. The spectral differentiation matrix is constructed directly at these nodes.
The same coordinate transformation as the tau method applies: \(x = \frac{1}{2}(t + 1)\).
References
Engsig-Karup, “Lecture 5: Boundary Value Problems”, p. 39