Ordinary differential equations
We now discuss the numerical solution of ordinary differential equations. These include the initial value problem, the boundary value problem, and the eigenvalue problem. Before proceeding to the development of numerical methods, we review the analytical solution of some classic equations.
The assignment of boundary conditions at two separate points is called a two point boundary value problem, in contrast to the initial value problem where the boundary conditions are prescribed at only a single point. Two-point boundary value problems typically require a more sophisticated algorithm for a numerical solution than initial value problems.
Numerical methods: initial value problem
We begin with the simple Euler method, then discuss the more sophisticated RungeKutta methods, and conclude with the Runge- Kutta-Fehlberg method, as implemented in the MATLAB function ode45.m. Our differential equations are for , where the time is the independent variable, and we will make use of the notation . This notation is still widely used by physicists and descends directly from the notation originally used by Newton.
Modified Euler method
This method is of a type that is called a predictor-corrector method. It is also the first of what are Runge-Kutta methods. As before, we want to solve (7.3). The idea is to average the value of at the beginning and end of the time step. That is, we would like to modify the Euler method and write
The obvious problem with this formula is that the unknown value appears on the right-hand-side. We can, however, estimate this value, in what is called the predictor step. For the predictor step, we use the Euler method to find
The corrector step then becomes The Modified Euler Method can be rewritten in the following form that we will later identify as a Runge-Kutta method:
Second-order Runge-Kutta methods
We now derive all second-order Runge-Kutta methods. Higher-order methods can be similarly derived, but require substantially more algebra.
Adaptive Runge-Kutta Methods
As in adaptive integration, it is useful to devise an ode integrator that automatically finds the appropriate . The Dormand-Prince Method, which is implemented in MATLAB’s ode45.m, finds the appropriate step size by comparing the results of a fifth-order and fourth-order method. It requires six function evaluations per time step, and constructs both a fifth-order and a fourth-order method from these function evaluations.