Chapter 27

Numerical Integration

return to the Course index
previous | next

Comparison Between Integration Methods

  Runge-Kutta RKF45 Adam's Gear's
ka/kel = 1.0 15 2 2 2
ka/kel = 10 38 2 3 4
ka/kel = 100 174 7 14 4
ka/kel = 1000 * 50 110 4
Table 27.5.1 Table of Comparison between Various Numerical Integration Methods

The results in Table 27.5.1 were determined using Boomer some time ago when computers were much slower. All the methods except Gear's method slow considerably or fail(*) when the stiffness ratio gets above 100.

Example Boomer .BAT files (and the resulting .OUT files) demonstrating a simulation of a multi-compartment version of the model shown in Table 27.4.1 can be downloaded (Macintosh and Windows). The Runge-Kutta version (rk1.BAT) fails with too many steps when ka > 50. The Runge-Kutta-Fehlberg version (rkf100.BAT) starts to show problems with error messages when ka > 500. Gear's method (gear100.BAT) works with ka = 1.0 x 1012.

Notes on the Use of Different Integration Methods with Boomer

When differential equations are used in Boomer, by specifying rate constants as a parameter, the user is presented with the selection of an integration method.

 Method of Numerical Integration

 0) Classical 4th order Runge-Kutta
 1) Runge-Kutta-Gill
 2) Fehlberg RKF45
 3) Adams Predictor-Corrector with DIFSUB
 4) Gears method for stiff equations with PEDERV
 5) Gears method without PEDERV

 Enter choice (0-5) 

For ordinary compartmental problems choice 2 (Fehlberg RKF45) should be chosen as the most efficient. With stiff systems choice 5 (Gears method without PEDERV) is best.

Each of these numerical integration methods requires that the user specify an upper limit of the acceptable error, either as a relative or as an absolute error. In the case of the Fehlberg RKF45 method both types of error are requested.

 Enter Relative error term for
     Numerical integration (0.0001) 

 Enter Absolute error term for
     Numerical integration (0.0001) 

For each of the other methods only one error term is required (relative for Classical 4th order Runge-Kutta and the Runge-Kutta-Gill method and absolute for Adams Predictor-Corrector or Gears method). This can be important when editing a Boomer .BAT file. An additional line may need to be added if switching to the Fehlberg RKF45 method or a line may need to removed if switching from the Fehlberg RKF45 method.

A final point may need to be made regarding the specification of the absolute error term. At times the default value of 0.001 may be too small. Note that even though the concentration calculated may be quite small, for example, 1 - 10 mg/L the number calculated, internally, may be somewhat higher. For example, with a dose expressed as 1000 mg an absolute error of 0.0001 would mean a change in the 7th significant figure. This may stress the method and thus a larger absolute value may be more appropriate and necessary. The important thing is to consider how realistic the error value might be for the problem being studied.

Boomer Error Messages

In Boomer the Runge-Kutta method will reduce the step-size automatically if the error specified is exceeded. If this stepsize reduction is greater than a built-in limit an error message will be displayed.

 ** ERROR ** ISTEP =      20000


 *** Fatal error in RK ***
          restart option not selected
      Try another integration method
PAUSE  Press RETURN to quit statement executed

As indicated in the error message another integration method may be better.

The Runge-Kutta-Fehlberg may be quite efficient for compartmental pharmacokinetic models. However, with stiff systems the program will become inefficient and the error message below will indicate this problem.

 IFLAG NOT EQUAL TO 2     4
 Number of differential equations    20
 Value for line 1   -.2850E-04
 X value at beginning of interval    1.764    
 X value at end of interval    2.000    
 Relative error    .1000E-03
 Absolute error    .1000E-03

Adjustments to the requested error might help or alternately Gear's method may be used to complete the analysis.

Numerical Integration Methods in Phoenix™ NLME

Phoenix™ NLME provides a number methods for solving differential equations specified using Max ODE in the Run Options tab.

Uncheck Closed Form for Differential Equation

Figure 27.5.1 Uncheck Closed Form for DE Options

The Advanced Run Options tabs provides the ability to adjust the values of relative tolerance (RTOL), the absolute tolerance (ATOL) and the Maximum number of steps (MAXSTEP).

Select Max ODE method and Advanced for other Options

Figure 27.5.2 Select Max ODE method and Advanced for other Options

The Matrix Exponent method is the default, when applicable, and is a very efficient method for ordinary pharmacokinetically relevant systems of differential equations. The LSODE method is similar to Gear's method and is most appropriate with stiff systems. The LSODA method switches between the non-stiff Adam's method and a stiff system method similar to Gear's method. Two non-stiff methods are available. The DVERK method is a Runge-Kutta method based on Verner's 5-6 method and the DPRRI5 method is another Runge-Kutta method of order 4-5.


References
  1. Gear, C.W. 1971 "Algorithm 407 DIFSUB for Solution of Ordinary Differential Equations", Comm. ACM., 14, pp 185-190
  2. Gear, C.W. 1971 "The Automatic Integration of Ordinary Differential Equations", Comm. ACM., 14, pp 176-179
  3. Hindmarsh, A C, and Petzold, L R. LSODA, Ordinary Differential Equation Solver for Stiff or Non-Stiff System. NEA: N. p., 2005. Web.
  4. LSODA, the R Package https://rdrr.io/cran/deSolve/man/lsoda.html based on Fortran code by Linda R. Petzold and Alan C. Hindmarsh.
  5. LSODE, the R package https://rdrr.io/cran/deSolve/man/lsoda.html based on Fortran code by Alan C. Hindmarsh and Andrew H. Sherman.
  6. Radhakrishnan, K. and Hindmarsh, A. C. 1993 Description and use of LSODE, the Livermore solver for ordinary differential equations. doi:10.2172/15013302.

This page was last modified: Sunday, 28th Jul 2024 at 5:08 pm


Privacy Statement - 25 May 2018

Material on this website should be used for Educational or Self-Study Purposes Only


Copyright © 2001 - 2025 David W. A. Bourne (david@boomer.org)


Name the Drug
Name the Drug
A game to aid recognizing brand versus generic drug names
See how many names you can catch before you run out of lives
Download from the App Store