PHARM/PCS V5 · Procedure 48 Special Methods
Differential Equations
Solve a first-order differential equation numerically by the fourth-order Runge-Kutta method, for kinetic models that have no closed-form answer.
What it computes
Solves a first-order ODE dy/dx = f(x, y) numerically using the fourth-order Runge-Kutta method. Enter the right-hand side of the equation in terms of x and y, using * for multiplication (for example, -0.5*y or x*y - 3).
Inputs and outputs
You provide
- The right-hand side of dy/dx, written in x and y with * for multiplication
- Starting values x0 and y0
- The step size h and the last x value
PHARM/PCS reports
- The solution y at each step from x0 to the last x value
- A plot of the solution curve
When to use it
The general-purpose escape hatch: when a model has no closed-form solution and you need to integrate it numerically. Useful for custom pharmacokinetic or kinetic models beyond the standard forms in Procedures 24-32.
Reading the results
Fourth-order Runge-Kutta is accurate for smooth, well-behaved equations but takes fixed steps: too large a step loses accuracy, and stiff systems (very fast and very slow components together) can misbehave regardless. If halving the step size noticeably changes the answer, your step is too big, so shrink it until the solution stabilizes.
Equations in plain arithmetic
The 1986 program took its equations in BASIC syntax. V5 accepts the same arithmetic operators, so an equation such as x − 2*y works as written, and standard functions such as exponentials and square roots are available.
This page describes the procedure. Calculations run inside the licensed PHARM/PCS V5 application. PHARM/PCS is a trademark of MCS Scientific LLC.