spectral.solve_legendre_tau#
- spectral.solve_legendre_tau(epsilon: float, num_modes: int) ndarray[source]#
Solve Exercise A boundary value problem using Legendre tau method.
Solves:
\[-\varepsilon \frac{d^2u}{dx^2} - \frac{du}{dx} = 1, \quad u(0) = u(1) = 0\]- Parameters:
- Returns:
np.ndarrayModal coefficients
Notes
The tau method does not require the residual to vanish pointwise, but instead enforces the differential equation in a weighted sense with boundary conditions imposed through row replacement.
The analytical solution is:
\[u(x) = \frac{e^{-x/\varepsilon}+(x-1)-e^{-1/\varepsilon}x}{e^{-1/\varepsilon}-1}\]References
Engsig-Karup, “Lecture 5: Boundary Value Problems”, p. 14 Kopriva (2009), “Implementing Spectral Methods for PDEs”, p. 107