3 An explicit method
Guided by the fact that we only seek approximations to at -values that are a distance apart we could use a forward difference formula to approximate the derivative in the differential equation. This leads to
and we use this as the inspiration for the numerical method
For clarity we denote as . The procedure for implementing the method (called Euler’s method - pronounced “Oil-er’s method" - is summarised in the following Key Point.
Key Point 4
Euler’s method for approximating the solution of
is as follows. We choose a time step , then
In general, is approximated by .
This is called an explicit method, but the reason why will be clearer in a page or two when we encounter an implicit method. First we look at an Example.
Example 1
Suppose that is the solution to the initial value problem
Carry out two time steps of Euler’s method with a step size of so as to obtain approximations to and .
Solution
In general, Euler’s method may be written
and here
.
For the first time step we require
and therefore
For the second time step we require and therefore
We conclude that
where these approximations are given to 6 decimal places.
The simple, repetitive nature of this process makes it ideal for computational implementation, but this next exercise can be carried out by hand.
Task!
Suppose that is the solution to the initial value problem
Carry out two time steps of Euler’s method with a step size of so as to obtain approximations to and .
For the first time step we require and therefore
For the second time step we require and therefore
We conclude that
to six decimal places.
The following Task involves the so-called logistic approximation that may be used in modelling population dynamics.
Task!
Given the logistic population dynamic model
carry out two time steps of Euler’s method with a step size of to obtain approximations to and .
For the first time step we require and therefore
For the second time step we require
and therefore
We conclude that
Task!
The following initial value problem models the population of the United Kingdom, suppose that
where is the population in millions, is measured in years and corresponds to the year 1996.
-
Show that Euler’s method applied to this initial value problem leads to
where is the approximation to .
- Use a time step of equal to 6 months to approximate the predicted population for the year 2050.
In general where, in this case, hence
But will have come from the previous time step ( ) and will have come from the time step before that ( ). Repeatedly applying this observation leads to
since .
For a time step of 6 months we take (in years) and we require 108 time steps to cover the 54 years from 1996 to 2050. Hence
where this approximation is given to 3 decimal places.
3.1 Accuracy of Euler’s method
There are two issues to consider when concerning ourselves with the accuracy of our results.
- How accurately does the differential equation model the physical process?
- How accurately does the numerical method approximate the solution of the differential equation?
Our aim here is to address only the second of these two questions.
Let us now consider an example with a known solution and consider just how accurate Euler’s method is. Suppose that
We know that the solution to this problem is , and we now compare exact values with the values given by Euler’s method. For the sake of argument, let us consider approximations to at . The exact value is to 6 decimal places. The following table shows results to 6 decimal places obtained on a spreadsheet program for a selection of choices of .
Notice that the smaller is, the more time steps we have to take to get to . In the table above each successive implementation of Euler’s method halves . Interestingly, the error halves (approximately) as halves. This observation verifies something we will see in Section 32.2, that is that the error in Euler’s method is (approximately) proportional to the step size . This sort of behaviour is called first-order , and the reason for this name will become clear later.
Key Point 5
Euler’s method is first order. In other words, the error it incurs is approximately proportional to .