(* \input mathlily
\heading{Introducing D'Alembert's solution of the wave equation}
\synopsis{These commands are primarily intended to be typed in as a
demonstration, rather than input as a file.}
\section{Discussion}
*)
(* This demonstration deals with a function of the form $B(x-t)$.
We verify that it solves the two-variable wave equation,
$${\partial ^2u\over\partial x^2} ={\partial ^2u\over\partial
t^2}\,.$$
Then we plot $B(x-t)$ as a function of $x$ for a sequence of
values of $t$ and animate the results, verifying that the solution
represents a traveling wave. *)
(* \section{Demonstration} *)
(* \subsection{Define the basic function.} *)
(* We choose an example that has a
localized peak and approaches 0 at the sides, since that will
best demonstrate the traveling-wave behavior.
(Generally speaking, we use lower case for {\sl
Mathematica\/} variable names, to avoid possible conflicts with
built-in {\sl Mathematica\/} function names.) *)
b[z_] := 1/(1 + z^2)
(* \subsection{Verify the differential equation.} *)
(* Calculate a second derivative. *)
D[b[x-t], {x,2}]
(* Subtract the corresponding derivative with respect to the other
variable. *)
% - D[b[x-t], {t,2}]
(* \newpage *)
(* \subsection{Plot and animate.} *)
(* First try a single plot. *)
Plot[b[x-1], {x,-10,10}]
(* Animation is hardware-dependent. *)
(* [[ On a Sun-3 running SunView: *<
<{0, 1.2}],
{t,-12,12,2}]
>* The plots will briefly appear individually, then the animation
will start. ]] *)
(* [[ On a NeXT: *)
Do[Plot[b[x-t], {x,-10,10}, PlotRange->{0, 1.2}],
{t,-12,12,2}]
(* This will display all the plots sequentially. Use the mouse to
mark the large bracket (at right of the window) surrounding the
entire list of plots. Then click on the menu item ``graphs" and the
submenu item ``animate selected graphics". Use the buttons at the
bottom of the animation display window to slow down the animation
for clarity. ]] *)
(* \endlily *)