Half-Life Decay API
Radioactive (exponential) decay maths as an API, computed locally and deterministically. The decay endpoint computes how much of a substance remains after a given time, N(t) = N0·(1/2)^(t/T½) = N0·e^(−λt): from a half-life (or a decay constant or mean lifetime), an elapsed time and an optional initial amount, it returns the fraction and percent remaining, the remaining and decayed amounts, the number of half-lives elapsed, and — if you give an initial activity — the remaining activity, which decays by the same factor. The constant endpoint converts freely between the half-life T½, the decay constant λ = ln2/T½ and the mean lifetime τ = 1/λ = T½/ln2. The age endpoint reverses the decay to find the elapsed time from the fraction remaining, t = T½·log₂(1/fraction) — the basis of radiometric (carbon-14) dating — and accepts either a fraction or a remaining and initial amount. Time and half-life share one unit, and the results come out in that unit. Everything is computed locally and deterministically, so it is instant and private. Ideal for physics and chemistry education, nuclear-medicine and dosimetry tools, archaeology and geology dating, and pharmacokinetics and science apps. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is exponential decay; for the ideal gas law use a gas-law API and for the chemical elements use an elements API.
api.oanor.com/halflife-api