PDE Solver (Heat, Wave, Laplace)
Solve the heat, wave and Laplace equations by separation of variables, with the Fourier coefficients, the series solution and graphs of how it evolves.
About the PDE Solver (Heat, Wave, Laplace)
Separation of variables looks for solutions u = X(x)T(t). For the heat equation u_t = c²u_xx with u = 0 at x = 0 and x = L this gives X = sin(nπx/L) and T = e^(−c²n²π²t/L²); adding them with the half-range sine coefficients bₙ of the initial temperature f(x) matches u(x, 0) = f(x).
For the wave equation the time part is cos(nπct/L) and sin(nπct/L), fitted to the initial displacement and velocity. For Laplace's equation on a rectangle with u = f(x) on the top edge and 0 on the others, the y part is sinh(nπy/a)/sinh(nπb/a).
The formula
Heat: u = Σ bₙ sin(nπx/L) e^(−c²n²π²t/L²); bₙ = (2/L)∫₀ᴸ f(x) sin(nπx/L) dx
- Wave
- u = Σ sin(nπx/L)[bₙ cos(nπct/L) + Bₙ sin(nπct/L)]
- Laplace
- u = Σ bₙ sin(nπx/a) sinh(nπy/a)/sinh(nπb/a)
Worked example
Heat on (0, 1), c = 1, u(x, 0) = x(1 − x)
- bₙ = 4(1 − (−1)ⁿ)/(n³π³)
- u = Σ bₙ sin(nπx) e^(−n²π²t)
Questions people ask
How do I enter a plucked string?
As pieces: for a string of length 1 plucked to height h at the middle, enter 2h x, 0, 0.5 and 2h (1 − x), 0.5, 1.
Why sine series?
Because u = 0 at both ends; sin(nπx/L) vanishes at x = 0 and x = L for every n.