Вы находитесь на странице: 1из 28

ODE

- Initial Value Problems


- One-step Methods-
Dr.U.Oral nal
The Taylor - Series Method
Consider the following initial value problem (IVP).

The analytical solution is:


The Taylor - Series Method
The first term in the last equation is known from the initial condition.

We can find the coefficient of the second term by substituting x=0 and y=1 in the
equation for the first derivative:

The higher derivatives can be calculated by successively differentiating the


equation for the first derivative:

The solution may be written as follows:


The Taylor - Series Method
The solution is given by the table:

The error term of the Taylor series after the h4 term is:

The term cannot be computed due to the unknown value.

Hence the series can be truncated when the contribution of the last term is
negligible to the number of the decimal places to which we are working.
The Taylor - Series Method
Euler and Modified Euler Methods
Suppose that we have small enough h value, the Taylor series of y:

According to the Euler method the next value of the function can be computed a
follows:

Note that this is the local error. The global error is O(h).

For example, we have the following differential equation with the initial value
given:
Euler and Modified Euler Methods

As seen, the error is large! The method requires an extremely small step size to get
accurate results

The figure shows the computational strategy and suggest an improvement:


Euler and Modified Euler Methods
Let us check the error behaviour

For the given problem the derivative is

thus
Euler and Modified Euler Methods
By using the average of the slopes we can find an improved solution for yn+1

The above equation cannot be solved directly since it involves an unknown value.
Indeed the modified Euler method is a predictor - corrector method.
Euler and Modified Euler Methods
For a further improved accuracy, we can also recorrect the predicted value of the
next step:
Euler and Modified Euler Methods
The error of the modified Euler method can be find with Taylor series:

The second derivative may be replaced by the approximation:

Note that this is the local error. The global error is O(h2).
Runge - Kutta Methods
Let us first consider the second order Runge Kutta method for simplicity.

The increment to y is a weighted average of two estimates of the increment k1 and


k2.

We must find a scheme of choosing the four parameters, a, b, , .

Since

(*)
Runge - Kutta Methods
Substituting k1 and k2:

Since

After expanding the last term on right in Taylor series and retaining the first
derivatives we have:

Substituting this into the previous equation:


Runge - Kutta Methods

The last equation should be identical to the equation marked with *

Then:

The values can be chosen arbitrarily. If we take a=0.5, for example:

b=0.5, = 1, = 1
Runge - Kutta Methods
This corresponds to the modified Euler method presented previously.

The modified Euler method is a special case of the Runge - Kutta method.

Fourth-order Runge - Kutta method is also derived in a similar fashion. This time
the comparison with Taylor series gives 11 equations and 13 unknowns. Two
values can be chosen arbitrarily and equations can be solved.
Runge - Kutta Methods
Let us evaluate the same problem:
Runge - Kutta Methods
The global error of the method is O(h4).
Runge - Kutta Methods
- Runge - Kutta - Fehlberg Method -

To check whether the step size is right we can repeat the calculation with the
step size h halve and compare the results.

If the result does not change significantly it can be accepted

This is however computationally very expensive. 11 function evaluation is


required for one step.

Instead, the results of the fourth- and fifth-order Runge - Kutta methods can be
compared.
Runge - Kutta Methods
- Runge - Kutta - Fehlberg Method -

The method can be evaluated with the calculation of 6 function values.


Runge - Kutta Methods
- Runge - Kutta - Fehlberg Method -

The exact value y(0.1)==0.914512254.


Runge - Kutta Methods
Let us evaluate the same initial value problem:
Runge - Kutta Methods
- Runge - Kutta - Merson Method -
Comparison
Systems of Equations and Higher-Order equations
A higher-order equation has the following form:

We can express a second order equation as:

Since:

thus
Systems of Equations and Higher-Order Equations
For nth order differential equation:

We can convert it into a system of n first-order equations:


Systems of Equations and Higher-Order Equations
Suppose we have a pair of first order equations:
Systems of Equations and Higher-Order Equations
-Euler Predictor-Corrector Method-
Let us apply modified Euler method for the two equations. h=0.1.
Systems of Equations and Higher-Order Equations
-Runge-Kutta-Fehlberg Method-
Let us apply Runge-Kutta-Fehlberg method for the two equations. h=0.1.

Вам также может понравиться