Example 1.  Consider the wave equation where  [Graphics:Images/FiniteDifferencePDEMod_gr_22.gif].  The string at rest has length  [Graphics:Images/FiniteDifferencePDEMod_gr_23.gif].  Assume that the initial position is

        [Graphics:Images/FiniteDifferencePDEMod_gr_24.gif].  

Use the finite difference method to solve the wave equation over the rectangle  [Graphics:Images/FiniteDifferencePDEMod_gr_25.gif].  Compare the solution with the exact solution:  

        [Graphics:Images/FiniteDifferencePDEMod_gr_26.gif].  

Solution 1.

Remark.  We will be using  [Graphics:../Images/FiniteDifferencePDEMod_gr_27.gif] .  This forces  [Graphics:../Images/FiniteDifferencePDEMod_gr_28.gif].

 

[Graphics:../Images/FiniteDifferencePDEMod_gr_29.gif]

Now set up the table of solutions.  Solve it.  Plot it.  

[Graphics:../Images/FiniteDifferencePDEMod_gr_30.gif]


[Graphics:../Images/FiniteDifferencePDEMod_gr_31.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_32.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_33.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_34.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_35.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_36.gif]
[Graphics:../Images/FiniteDifferencePDEMod_gr_37.gif]
[Graphics:../Images/FiniteDifferencePDEMod_gr_38.gif]
[Graphics:../Images/FiniteDifferencePDEMod_gr_39.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_40.gif]



[Graphics:../Images/FiniteDifferencePDEMod_gr_41.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_42.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_43.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_44.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_45.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_46.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_47.gif]



[Graphics:../Images/FiniteDifferencePDEMod_gr_48.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_49.gif]

[Graphics:../Images/FiniteDifferencePDEMod_gr_50.gif]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004