Pharmacokinetic Modeling

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

One- and two-compartment pharmacokinetic models calculate the concentration of a drug in the body as a function of time for a given dosing scheme. There are two options for administering the drug: injection into compartment 1 (e.g., inject into the blood stream with a needle) or absorption into compartment 1 from compartment 2 (e.g., drug in stomach absorbed into blood stream). Select the mass of the dose, number of doses and intervals between doses with sliders. The objective is to select a dosing scheme so that as much of the drug as possible has a concentration between the effective dose and the toxic dose (the therapeutic window). The drug can be eliminated from compartment 1 (set rate constant with a slider) or transferred to compartment 2 (slider ). Similarly, in compartment 2 the drug can be eliminated (slider ) or transferred back to compartment 1 (slider ). Change the reaction order of the drug elimination kinetics with buttons. The areas under the curves correspond to the total exposure to the drug.

Contributed by: Nicholas R. Larson (June 2014)
With additional contributions by: Rachael L. Baumann, John L. Falconer and Nick Bongiardina
(University of Colorado Boulder, Department of Chemical and Biological Engineering)
Open content licensed under CC BY-NC-SA



The drug is well-mixed in either compartment. The drug is either administered as a rapid dose (i.e., bolus injection) or it absorbs into compartment 1. The constants and represent the rate transfer coefficients from compartment 1 to compartment 2 and vice versa, assuming a first-order transfer between them. Each compartment has its own elimination rate and . The absorption coefficient determines the rate at which the drug absorbs into compartment 1, and it assumes first-order absorption in the amount of the dose. The concentrations and time are intentionally left unit-less, but the system is dimensionally consistent. The drug elimination reaction order is .

When the dose absorbs into compartment 1, then the amount changes with time:


If there is no absorption and the dose is directly injected, then the dose amount is distributed within compartment 1 at the injection time. The first dose is at time zero, and the same mass is then injected for each subsequent dose.

Compartment 1:


where is the drug concentration in compartment 1, is the drug concentration in compartment 2 and is the volume of compartments 1 and 2.

Initial condition for compartment 1:

when absorption occurs

when absorption does not occur.

Compartment 2:


with initial condition .

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.