Example 1. Consider
the wave equation where
. The
string at rest has length
. Assume
that the initial position is
.
Use the finite difference method to solve the wave equation over
the
rectangle
. Compare
the solution with the exact solution:
.
Solution 1.
Remark. We will be
using
. This forces
.
Now set up the table of solutions. Solve it. Plot it.
![[Graphics:../Images/FiniteDifferencePDEMod_gr_31.gif]](../Images/FiniteDifferencePDEMod_gr_31.gif)
Observation. The numerical solution to the P.D.E. was computed on a "grid" in a matrix. Hence, we have "lost" the connection between the "x" and "t" variables when plotting the solution. This problem is independent of the software used. If "tick marks" corresponding to "x" and "t" are necessary, then it would be necessary to rewrite these commands in the software to handle this particular situation. Otherwise, the automatic graphing of lists of data will automatically decide what numbers to put on the "axes." We don't have complete control of computers yet.
Compare the numerical solution with the analytic solution.
![[Graphics:../Images/FiniteDifferencePDEMod_gr_41.gif]](../Images/FiniteDifferencePDEMod_gr_41.gif)
To see the "numerical approximations" enter the command
below.
Note. This command
display values truncated to three decimal places. If this
is not done then the table will be very wide and you would need to
scroll a long way to see the table entries.
![[Graphics:../Images/FiniteDifferencePDEMod_gr_50.gif]](../Images/FiniteDifferencePDEMod_gr_50.gif)
(c) John H. Mathews 2004