Module for Numerical Solution of O. D. E.

Numerical Methods for O. D. E.  using Mathematica. (c) John H. Mathews, 2003

Background.

    
Numerical methods are useful in constructing solutions to differential equations.
For illustration, we consider Euler's method and the Runge-Kutta Method.

Euler's Method.  To compute a numerical approximation for the solution of the initial value problem [Graphics:Images/NumericalSolutionDEMod_gr_1.gif] with [Graphics:Images/NumericalSolutionDEMod_gr_2.gif] over [Graphics:Images/NumericalSolutionDEMod_gr_3.gif] at a discrete set of points using the formula [Graphics:Images/NumericalSolutionDEMod_gr_4.gif] for  [Graphics:Images/NumericalSolutionDEMod_gr_5.gif].

Mathematica Subroutine (Euler's Method). Execute the following cell to make it active.

[Graphics:Images/NumericalSolutionDEMod_gr_6.gif]

Runge-Kutta Method of Order 4.  To approximate the solution of the initial value problem [Graphics:Images/NumericalSolutionDEMod_gr_7.gif]  with  [Graphics:Images/NumericalSolutionDEMod_gr_8.gif]  over  [Graphics:Images/NumericalSolutionDEMod_gr_9.gif].  Start with the initial point  [Graphics:Images/NumericalSolutionDEMod_gr_10.gif]  and generate the sequence of approximations  [Graphics:Images/NumericalSolutionDEMod_gr_11.gif]  by using the formula  

    [Graphics:Images/NumericalSolutionDEMod_gr_12.gif],  
where
    [Graphics:Images/NumericalSolutionDEMod_gr_13.gif]  

Mathematica Subroutine (Runge-Kutta Method). Execute the following cell to make it active.

[Graphics:Images/NumericalSolutionDEMod_gr_14.gif]

Example 1.  Consider the initial value problem  [Graphics:Images/NumericalSolutionDEMod_gr_15.gif]  with  y(0) = 1 over  [0, 0.95].
Use Euler's method and compute and graph a numerical solution.
1 (a).  Use 19 steps of size h = 0.05 , include the list of points.
1 (b).  Use 38 steps of size h = 0.025 , include the list of points.
1 (c).  Use 76 steps of size h = 0.0125 , omit the list of points.
1 (d).  Use 152 steps of size h = 0.00625 , omit the list of points.
1 (e).  Observe that the sequence of solutions (a)-(d) appear to be converging.

Solution 1.

Example 2.  Consider the initial value problem  [Graphics:Images/NumericalSolutionDEMod_gr_43.gif]  with  y(0) = 1 over  [0, 0.95].
Use the Runge-Kutta method and compute and graph a numerical solution.
2 (a).  Use 19 steps of size h = 0.05 , include the list of points.
2 (b).  Use 38 steps of size h = 0.025 , include the list of points.
2 (c).  Use 76 steps of size h = 0.0125 , omit the list of points.
2 (d).  Use 152 steps of size h = 0.00625 , omit the list of points.
2 (e).  Observe that the sequence of solutions (a)-(d) appear to be converging.

Solution 2.

Example 3.  Consider the initial value problem  [Graphics:Images/NumericalSolutionDEMod_gr_72.gif]  with  y(0) = 1 over  [0, 0.95].
Use Mathematica's built in procedure NDSolve  to compute a numerical solution, and then
use Mathematica's Evaluate function to plot the solution
Observe that we need not be aware how the computations are done.

Solution 3.

Example 4.  Consider the initial value problem  [Graphics:Images/NumericalSolutionDEMod_gr_78.gif]  with  y(0) = 1 over  [0, 0.95].  

Continue this investigation only if you feel comfortable with someone showing you that the "analytic solution" is represented with the following "special function."  

Be prepared that Mathematica will struggle to find the analytic solution.  
Pay no attention to the warning messages.

Solution 4.

Example 5.  Consider the initial value problem  [Graphics:Images/NumericalSolutionDEMod_gr_102.gif]  with  y(0) = 1 over  [0, 0.95].  
Expand the above "analytic solution" f[t] in a Taylor series about t=0.  
This will convince us that f[t] has the correct initial value.

Solution 5.

Example 6.  For those who are curious, we can do a little investigation regarding the Gamma function.
This might take some time getting comfortable, however many useful solutions of differential equations involves these functions.
First, an exploration regarding the Gamma function (which is o.k. for  x > 0).

Solution 6.

The Gamma Function.  

    The
Gamma function is usually defined by the following improper integral.

        
[Graphics:Images/NumericalSolutionDEMod_gr_150.gif]   when   [Graphics:Images/NumericalSolutionDEMod_gr_151.gif].

Example 7.  Use integration techniques to explore the Gamma function and obtain the identities
        [Graphics:Images/NumericalSolutionDEMod_gr_152.gif]
        [Graphics:Images/NumericalSolutionDEMod_gr_153.gif]
        [Graphics:Images/NumericalSolutionDEMod_gr_154.gif]  

Solution 7.

Example 8.  Consider the initial value problem   [Graphics:Images/NumericalSolutionDEMod_gr_247.gif]  with   [Graphics:Images/NumericalSolutionDEMod_gr_248.gif]  over  [0, 0.95].  
Find the vertical asymptote of  "analytic solution" f[t].
This will show where the "barrier" is located beyond which a numerical solution cannot be computed.

Solution 8.

Research Experience for Undergraduates


Converted by Mathematica      January 28, 2003