Conversion to a First-Order System
If a given system of ordinary differential equations (ODEs) involves derivatives higher than first order, then in order to apply a numerical solution method the ODEs must be converted to a system of first-order ODEs.
In Maple, the conversion of higher-order ODEs to a first-order system is handled automatically when a numerical solution is requested. In Matlab or any other purely numerical computation environment, the conversion to a first-order system must be done manually by the user.
Example 1: A 2nd-order ODE
Consider the following initial-value problem (IVP) appearing in Example 9.3 of the CS 370 Course Notes.
> |
|
> |
|
|
(1) |
with initial conditions
> |
|
|
(2) |
This can be converted to a first-order system as follows. Introduce a new set of dependent variables:
> |
|
|
|
(3) |
In terms of the new functions the original -order ODE becomes the following first-order system, where the last equation involves isolating the highest-order derivative on the left hand side of the original equation.
> |
|
|
|
(4) |
with initial conditions
> |
|
|
(5) |
This now takes the form of a standard first-order system:
> |
|
|
|
(6) |
where is a vector of dimension 2 and is a vector function of dimension 2 taking as arguments and the vector . Specifically,
> |
|
> |
|
|
(7) |
> |
|
> |
|
|
(8) |
The initial conditions are specified by the vector :
> |
|
> |
|
|
(9) |
Example 2: A 4th-order ODE
> |
|
> |
|
|
(10) |
with initial conditions
> |
|
|
(11) |
This can be converted to a first-order system as follows. Introduce a new set of dependent variables:
> |
|
In terms of the new functions the original -order ODE becomes the following first-order system, where the last equation involves isolating the highest-order derivative on the left hand side of the original equation.
> |
|
with initial conditions
> |
|
|
(14) |
This now takes the form of a standard first-order system:
> |
|
|
|
(15) |
where is a vector of dimension 4 and is a vector function of dimension 4 taking as arguments and the vector . Specifically,
> |
|
> |
|
|
(16) |
> |
|
> |
|
|
(17) |
The initial conditions are specified by the vector :
> |
|
> |
|
|
(18) |
Example 3: Novelty Golf Driving Range
Consider the following system of ODEs introduced in the CS 370 Course Notes (section 8.2) for the Novelty Golf Driving Range.
> |
|
> |
|
|
|
(19) |
with initial conditions
> |
|
|
(20) |
This can be converted to a first-order system as follows. Introduce a new set of dependent variables:
> |
|
In terms of the new functions the original system of ODEs becomes the following first-order system.
> |
|
with initial conditions
> |
|
|
(23) |
This now takes the form of a standard first-order system:
> |
|
|
|
(24) |
where is a vector of dimension 3 and is a vector function of dimension 3 taking as arguments and the vector . Specifically,
> |
|
> |
|
|
(25) |
> |
|
> |
|
|
(26) |
The initial conditions are specified by the vector :
> |
|
> |
|
|
(27) |
Forward Euler Method for a System
The Forward Euler Method we developed for a single first-order ODE is easily adapted for solving a system of first-order ODEs.
> |
|
Let us apply this procedure to solve the IVP of Example 1 above.
Define the system dynamics function.
> |
|
> |
|
|
(28) |
Values must be specified for the two parameters and .
> |
|
|
|
(29) |
The vector of initial conditions is
> |
|
|
(30) |
Specify the range of integration and the stepsize .
> |
|
|
(31) |
> |
|
|
(32) |
> |
|
Compare with the solution obtained by Maple for the original -order system.
> |
|
> |
|
|
(34) |
> |
|
|
(35) |
> |
|
|
(36) |
> |
|