Integrating Differential Equations Numerically
Point-Slope methods - Euler's Method
If you don't like Laplace transforms you might prefer using a numerical method of integrating the differential equations that you might find in pharmacokinetic studies. Actually a computer program such as Boomer will do this for you but doing this once or twice using a calculator might be informative. There are a number of different types of numerical integration methods but the easiest to understand is probably the point-slope methods. (We will look at other methods later in the course.) Euler's method is the simplest of these point-slope type of numerical integration. If we have an initial amount or concentration (the point) and a differential equation (the slope) Euler's method could be used. As an example consider an IV Bolus dose and a linear one compartment mode. At time zero we have a Dose (X1(0)) and a slope expressed as the differential equation for a one compartment linear model:
This first step of Euler's method can be illustrated graphically as shown in Fig 2.9.1
Fig 2.9.1 A first step using Euler's method
In practice the method involves using this initial slope for a finite (small) stepsize (in the time direction). The method is then repeated for another stepsize using the result from the previous step as the new starting point. If we start with a dose of 100 mg, k1 of 0.25 hr-1 and a step size of 0.1 hour the amount of drug remaining is 97.5 mg as shown in Figure 2.9.2
Fig 2.9.2 One step with Euler's method
If this process is continued we can estimate the amount remaining at the time or times of interest. The calculation out to 1 hour is shown in Table 2.9.1.
| Table 2.9.1 Calculation of Amount Using Euler's Method |
| Time | Slope (mg/hr) | Δ X (mg) | X (mg) - Euler |
| 0 | | | 100.00 |
| 0.1 | -25.00 | -2.50 | 97.50 |
| 0.2 | -24.38 | -2.44 | 95.06 |
| 0.3 | -23.77 | -2.38 | 92.69 |
| 0.4 | -23.17 | -2.32 | 90.37 |
| 0.5 | -22.59 | -2.26 | 88.11 |
| 0.6 | -22.03 | -2.20 | 85.91 |
| 0.7 | -21.48 | -2.15 | 83.76 |
| 0.8 | -20.94 | -2.09 | 81.67 |
| 0.9 | -20.42 | -2.04 | 79.62 |
| 1 | -19.91 | -1.99 | 77.63 |
|
|
Using the integrated equation for this calculation gives an exact amount of 77.88 mg after 1 hour. This means Euler's method has an error rate of 0.32 % with this stepsize. With a stepsize of 0.05 hour (20 steps) the error is 0.16%. Even smaller steps and more steps would be needed to more accurate results. This might illustrate a limitation of Euler's method. Although the method is simple to implement very small stepsizes are needed to achieve accurate results. You can explore the effect of stepsize with the spreadsheet worksheet in Figure 2.9.3 below.
Figure 2.9.3 Spreadsheet Illustrating Euler's Method
Click on the figure to download the Exceltm Spreadsheet
Later, in Chapter 10, we will explore more efficient methods for numerical integration.
Practice Calculations using Euler's Method
References
Next Page
Copyright 2001-3 David W. A. Bourne (david@boomer.org)
This file was last modified:
Friday 07 Feb 2003 at 02:10 PM