Two-compartment intravenous bolus macro and micro constants
pk_two_compartment_constants
Works out the macro and micro constants of a two-compartment intravenous bolus model.
- Runs
- On the server
- Level
- Checked against a reference: exact arithmetic at 80 digits with an eigen-decomposition cross-check, scripts of the project's own, and a second implementation in Python by a separate agent of the same model family
What it is
Returns the macro (A, α, B, β) and micro constants (k10, k12, k21, CL, V1, Q, V2, Vss) of a 2-compartment IV bolus. Use when one set is known and the other is wanted, intravenous bolus only. Not for one compartment: use `pk_one_compartment_parameters`; it fits nothing to data. Refuses α not above β, A + B not positive, and A or B not positive (no positive micro set); a dose with its unit, every value with its unit.
Field: Pharmacokinetics and DMPK.
What it does
You give
given(required): Which set is supplied: macro (A, alpha, B, beta) or micro (clearance, centralVolume, intercompartmentalClearance, peripheralVolume).dose(required): The intravenous bolus dose. Must be above 0 mg.coefficientA: Macro: A, the coefficient of the fast exponential, C(t) = A·e^(−αt) + B·e^(−βt). Optional.alpha: Macro: the fast (larger) exponent α. Must be above 0 1/h. Optional.coefficientB: Macro: B, the coefficient of the slow exponential. Optional.beta: Macro: the slow (smaller) exponent β. Must be above 0 1/h. Optional.
and 4 more, listed below
No request is recorded for this tool.
Limits
- Pharmacokinetics and DMPK: research arithmetic on concentrations, times and parameters you supply; not a dosing, clinical, welfare or diagnostic authority.
- No tool here outputs or recommends a dose, and no result is a prediction for any person or animal.
- Conversions between macro and micro constants of a two-compartment model after an intravenous bolus, elimination from the central compartment, linear kinetics; the model is your assumption.
- Research arithmetic; not a dosing, clinical, welfare or diagnostic authority.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
It will not answer when
- the quantities supplied are not exactly the set `given` names.
- α is not above β: α is the larger exponent by convention, and α = β is not a two-compartment solution.
- A + B is not positive, so V1 = dose/(A + B) is not a volume.
- A or B is not positive: with α > β > 0 and A + B > 0, every micro constant is positive exactly when A > 0 and B > 0, since k21 − β = B(α − β)/(A + B) and α − k21 = A(α − β)/(A + B); A = 0 or B = 0 is a single exponential.
Every input, with its units10 inputs
given(required): Which set is supplied: macro (A, alpha, B, beta) or micro (clearance, centralVolume, intercompartmentalClearance, peripheralVolume).dose(required): The intravenous bolus dose. Must be above 0 mg.coefficientA: Macro: A, the coefficient of the fast exponential, C(t) = A·e^(−αt) + B·e^(−βt). Optional.alpha: Macro: the fast (larger) exponent α. Must be above 0 1/h. Optional.coefficientB: Macro: B, the coefficient of the slow exponential. Optional.beta: Macro: the slow (smaller) exponent β. Must be above 0 1/h. Optional.clearance: Micro: clearance from the central compartment (CL). Must be above 0 L/h. Optional.centralVolume: Micro: central volume (V1). Must be above 0 L. Optional.intercompartmentalClearance: Micro: intercompartmental clearance (Q). Must be above 0 L/h. Optional.peripheralVolume: Micro: peripheral volume (V2). Must be above 0 L. Optional.
Every refusal, with its code4 refusals
| Code | When |
|---|---|
INPUTS_NOT_THE_STATED_SET | the quantities supplied are not exactly the set `given` names. |
ALPHA_NOT_ABOVE_BETA | α is not above β: α is the larger exponent by convention, and α = β is not a two-compartment solution. |
CENTRAL_VOLUME_NOT_POSITIVE | A + B is not positive, so V1 = dose/(A + B) is not a volume. |
NO_POSITIVE_MICRO_CONSTANTS | A or B is not positive: with α > β > 0 and A + B > 0, every micro constant is positive exactly when A > 0 and B > 0, since k21 − β = B(α − β)/(A + B) and α − k21 = A(α − β)/(A + B); A = 0 or B = 0 is a single exponential. |
The calculation
The method's equations, constants and worked example.
Equation 1
A1(0) = dose, A2(0) = 0
from the micro form given, k10 = CL/V1, k12 = Q/V1 and k21 = Q/V2
| Symbol | Meaning |
|---|---|
CL | clearance, L/h |
Q | intercompartmental clearance, L/h |
V2 | peripheral volume, L |
A1 | amount in the central compartment, mg |
A2 | amount in the peripheral compartment, mg |
k10 | elimination rate constant, 1/h |
k12 | rate constant from central to peripheral, 1/h |
k21 | rate constant from peripheral to central, 1/h |
V1 | central volume, L |
C | central concentration, mg/L |
Source 1.
Equation 2
α = (S + √(S² − 4P))/2 and β = P/α, with S = k10 + k12 + k21 and P = k10·k21
| Symbol | Meaning |
|---|---|
α | fast exponent, 1/h |
β | slow exponent, 1/h |
S | sum of the exponents, 1/h |
P | product of the exponents, 1/h^2 |
Source 1.
Equation 3
A = (dose/V1)·(α − k21)/(α − β)
B = (dose/V1)·(k21 − β)/(α − β), with (α − k21)(k21 − β) = k12·k21
| Symbol | Meaning |
|---|---|
A | fast coefficient, mg/L |
B | slow coefficient, mg/L |
dose | the bolus dose, mg |
V1 | central volume, L |
Source 1.
Equation 4
V1 = dose/(A + B)
k12 = α + β − k21 − k10 = A·B·(α − β)²/((A + B)²·k21)
| Symbol | Meaning |
|---|---|
k10 | elimination rate constant from the central compartment, 1/h |
k12 | central-to-peripheral rate constant, 1/h |
k21 | peripheral-to-central rate constant, 1/h |
CL | clearance, L/h |
Q | intercompartmental clearance, L/h |
V2 | peripheral volume, L |
Vss | steady-state volume, L |
Source 1.
Equation 5
t½,α = ln 2/α
t½,β = ln 2/β
| Symbol | Meaning |
|---|---|
t½,α | half-life of the fast phase, h |
t½,β | half-life of the slow phase, h |
Source 2.
A definition, not a model: the equation states what the quantity means. A different convention gives a different number.
Worked example
Worked example: one case of pk-two-compartment-constants@2.0.2, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- given = micro
- dose = 100 mg
- clearance = 3 L/h
- centralVolume = 10 L
- intercompartmentalClearance = 6 L/h
- peripheralVolume = 40 L
Steps
- k10 = 0.3 1/h, from clearance, centralVolume; by equation 4; gives micro.k10.
- k12 = 0.6 1/h, from intercompartmentalClearance, centralVolume; by equation 4; gives micro.k12.
- k21 = 0.15 1/h, from intercompartmentalClearance, peripheralVolume; by equation 4; gives micro.k21.
- sum = 1.05 1/h, from k10, k12, k21; by equation 2.
- product = 0.045 1/h², from k10, k21; by equation 2.
- alpha = 1.0052343 1/h, from sum, product; by equation 2; gives macro.alpha.
- beta = 0.044765682 1/h, from product, alpha; by equation 2; gives macro.beta.
- A = 8.904344 mg/L, from dose, centralVolume, alpha, beta, k21; by equation 3; gives macro.A.
- B = 1.095656 mg/L, from dose, centralVolume, alpha, beta, k21; by equation 3; gives macro.B.
- alpha-half-life = 0.68953792 h, from alpha; by equation 5; gives macro.alphaHalfLife.
- beta-half-life = 15.483896 h, from beta; by equation 5; gives macro.betaHalfLife.
- vss = 50 L, from centralVolume, peripheralVolume; by equation 4; gives micro.steadyStateVolume.
The working, as the case writes it:
k10 = 0.3, k12 = 0.6, k21 = 0.15 1/h
α + β = 1.05, αβ = k10·k21 = 0.045
α, β = (1.05 ± √(1.1025 − 0.18))/2 = (1.05 ± 0.96046864)/2 = 1.00523432, 0.04476568 1/h
A = (dose/V1)(α − k21)/(α − β) = 10 × 0.85523432/0.96046864 = 8.904344 mg/L
B = 10 − A = 1.095656 mg/L
Answer
micro.k10 = 0.3 1/h
micro.k12 = 0.6 1/h
micro.k21 = 0.15 1/h
macro.alpha = 1.0052343 1/h
macro.beta = 0.044765682 1/h
macro.A = 8.904344 mg/L
macro.B = 1.095656 mg/L
macro.alphaHalfLife = 0.68953792 h
macro.betaHalfLife = 15.483896 h
micro.steadyStateVolume = 50 L
Where these values came from: our own exact-arithmetic script and a hand-worked case; closed form at 50 digits (quadratic for α, β = αβ/α, A = (dose/V1)(α − k21)/(α − β)); mpmath.eig on the rate matrix agrees within 5.9e-81 relative.
At build the tool returned this answer within the tolerance the file states: relative 1e-10 on every quantity, absolute 1e-20 below 1e-10 in the same unit; statuses, codes and units exact.
Sources
Bourne DWA. Basic Pharmacokinetics, online textbook (boomer.org/c/p4), Chapter 19, Multi-Compartment Pharmacokinetic Models
Used for: Two-compartment intravenous bolus macro and micro constants, each from the other. At: p. Chapter 19, page 2 (Intravenous Administration), section as stated in Bourne: Figure 19.2.1 (the scheme: central X1 and peripheral X2 linked by k12 and k21, elimination kel from X1) and Equation 19.2.1, dX1/dt = −kel·X1 − k12·X1 + k21·X2 (image Ch195.gif, SHA-256 06f8de991f16e60a90b9df11320d50722ad10f194f2e5cbca1803eb44eda4b33), kel being this record's k10; the peripheral equation, read from the scheme, A1(0) = dose, A2(0) = 0, C = A1/V1 and k10 = CL/V1, k12 = Q/V1, k21 = Q/V2 are the record's statement of that model (Clearance = V1·kel is printed on Chapter 19, page 5, Eq. 19.5.2); p. Chapter 19, page 2 (Intravenous Administration), section as stated in Bourne: α + β = kel + k12 + k21 and α·β = kel·k21 (the page's text) and Equation 19.2.5, α, β = ((α + β) ± √((α + β)² − 4·α·β))/2, α taking + so that α > β (image Ch196.gif, SHA-256 aeff2576ee77bfa734cf06e513aed440827d7265e375ae1e13f5b3235cfb9c4b); β = P/α is the record's numerical form, from the printed product α·β = kel·k21; p. Chapter 19, page 2 (Intravenous Administration), section as stated in Bourne: Equation 19.2.2, Cp = A·e^(−α·t) + B·e^(−β·t) (image Fig1907.png, SHA-256 7e0dd1bc3d8441b28b9d1b5130ce0847e2d70c5fd6605df0a472cf61ee474e9b), Equation 19.2.3 (Fig3023.gif, SHA-256 b9008a830e1157fab461b90925a5bb2a12f334d4324c74921a923c591422c6a3) and Equation 19.2.4, A = Dose·(α − k21)/(V1·(α − β)) and B = Dose·(k21 − β)/(V1·(α − β)) (Ch197.gif, SHA-256 79c9c4fcc4bd09c32b0214a3e7d98b1b36509ae617e263774d6145307a44fb5b; Ch198.gif, SHA-256 81c14a65c301a262444efe00aefa5cdafe5882bcd9ed9b525976a6cb8ab5f629); the identity (α − k21)(k21 − β) = k12·k21 is the record's derivation; p. Chapter 19, page 3 (Parameter Determination), section as stated in Bourne: Equation 19.3.6, k21 = (A·β + B·α)/(A + B), kel = α·β/k21 and k12 = α + β − k21 − kel (images Ch1914.jpg, SHA-256 ddcfe853b693cea253d36a720145b9a8b93471c19fba178406c31569bb0225e4; Ch1915.jpg, SHA-256 acefd83ec83ff8fae1391990e1bb520e93ab3cd8ba7055f88feeccb60421c04c; Ch1916.jpg, SHA-256 0cd9e70f75bf98273775258ff82c8c43e52bde77362bd7dad8a715bbe68fbf02); and on Chapter 19, page 5 (c19/c1905.php, its HTML as retrieved SHA-256 4e99d7e9f8ecf2016c9a6e64d1483b1a96250e179a998a8efd581857b4773520), V1 = Dose/(A + B) (Eq. 19.5.1, Ch1916.gif, SHA-256 6e190ba6737181fe12323219b6b80949847cef9f74a477ec1abc3bc45e3ffc60), Clearance = V1·kel (Eq. 19.5.2, Eqn1952.png, SHA-256 5354525891bde310b08b4a6085c24d53e70eef0c0bc79f04782f885ad4a472f4) and Vss = V1·(k12 + k21)/k21 (Eq. 19.5.3, Ch1919.gif, SHA-256 9debba0d67a906b228dfb797ce816b264f99c54bd2de29a8a4dfddf9bc42a06b). Q = k12·V1, V2 = Q/k21, Vss = V1 + V2 (the printed Vss rearranged) and k12 = A·B·(α − β)²/((A + B)²·k21) are the record's derivation, checked line by line in this project's scientific review.
Read in full, 17 November 2026Bourne DWA. Basic Pharmacokinetics, online textbook (boomer.org/c/p4), Chapter 4, One Compartment IV Bolus
Used for: Two-compartment intravenous bolus macro and micro constants, each from the other. At: p. Chapter 4, page 10 (Half-life of Elimination), section as stated in Bourne: Equation 4.10.4, ln2 = kel·t½ (image Fig040804.png, SHA-256 6d26d2ea52e1918837baff9f1dab22f67b5b91566e18a59b5d267a12006935a0), the half-life of a first-order process; applied by the record to α and β (Chapter 19, page 3 names 0.693/β the terminal half-life).
Read in full, 17 November 2026
How it is checked
- Level
Checked against a reference.
- Checked against
Our own exact-arithmetic script and a hand-worked case.
- Cases
No case set is linked to this version.
- Not checked
Infusion and oral parameterisations (not offered); molar doses (not offered in 1.0.0); whether a two-compartment model describes the caller's data. A constant that is above 0 on the stated values but comes out as exactly 0, subnormal or outside the double range (B from a tiny Q, whose k12·k21 underflows) is refused as RESULT_OUTSIDE_DOUBLE_RANGE, never served as 0.
What was not checked, in fullfrom the method records
- Infusion and oral parameterisations (not offered); molar doses (not offered in 1.0.0); whether a two-compartment model describes the caller's data.
- A constant that is above 0 on the stated values but comes out as exactly 0, subnormal or outside the double range (B from a tiny Q, whose k12·k21 underflows) is refused as RESULT_OUTSIDE_DOUBLE_RANGE, never served as 0.
- So is a constant formed through an intermediate that is above 0 on the stated values but comes out 0, subnormal or outside the double range (k12·k21, k10·k21, the smaller coefficient term, c0 and its products with the two terms; from the macro constants A·B and the products of k12's numerator and denominator), even where the constant itself is normal: it would carry fewer digits than stated.
- No reordering is attempted.
Changes to its methods0 changes
No change is logged for these method versions.