A plucked string¶
A bump on a long string at five times: it splits into two halves that move apart.
import sympy as sp
import pdemagic as pm
x, t = sp.symbols("x t", real=True)
s = sp.Function("s")(x, t)
string = pm.Problem(
sp.Eq(s.diff(t, 2), 9 * s.diff(x, 2)),
domain=pm.FreeSpace(x),
time=(t, 0.0, 1.0),
initial={s: sp.exp(-(x**2)), s.diff(t): 0},
)
pm.solve(string).plot()
What it shows¶
The wave equation in one dimension, \(s_{tt} = 9\,s_{xx}\). It is of second order in time, so it needs the shape and the rate of change at the start: the string is let go from rest. The bump splits into two halves of half its height, which move apart with the speed 3 and keep their shape. In one dimension a plot of a problem in time draws five times at once.
What pdemagic decided¶
The planner chose exact propagation in Fourier space
(fourier_propagator): each of the 21 recorded times is exact in time.
In free space it also chose the box, from \(-8.3\) to \(8.3\), so that it
holds everything the waves reach by the end of the time span, with 96
points.