Talk:Radioactives
From Wildeblood's "decays in a month" Black Hole BB thread
Contents
Overview
In case anyone is wondering, the three posts below are a conversation I had with Grok. They pertain to an idea that has popped up a few times: decaying cargo to add urgency/time-sensitivity to motivate the player, without faffing about in the contracts screens: you buy 1kg of unattainium at the producing planet, and try to get it to a buying planet as quickly as possible. When you reach the destination market, your 1 kg has become so-many grams. Whether there is still enough to make a profit depends almost solely on how quickly you got it there.
A good introduction to the mysteries of how Oolite defines commodities and the markets for them.
Something new for the player, something for the coder, something to annoy the purists. That's got to be good.
First post:
Half-Life in Radioactive Decay
Post by Wildeblood » Thu Jun 18, 2026 5:08 am
Wildeblood: A paragraph explaining the concept of half-life in radio-active decay, please.
Half-life in radioactive decay refers to the characteristic time interval required for half of the unstable atomic nuclei in a given sample of a radioactive isotope to undergo spontaneous decay, transforming into more stable daughter nuclei while emitting radiation (such as alpha particles, beta particles, or gamma rays).
This process follows an exponential decay law, where the number of remaining radioactive atoms at time t, denoted N(t), is given by N(t) = N₀ × (1/2)^(t / T½), with N₀ as the initial number and T½ as the half-life. Importantly, half-life is a probabilistic or statistical concept that applies reliably only to large ensembles of atoms; individual nuclei decay unpredictably, but the overall rate for a macroscopic sample is highly consistent and independent of external conditions like temperature, pressure, or chemical environment.
For example, carbon-14 has a half-life of approximately 5,730 years, meaning that after this period, half of the C-14 atoms in a sample will have decayed into nitrogen-14—enabling radiocarbon dating of organic materials up to about 50,000 years old. Uranium-238, by contrast, has a much longer half-life of roughly 4.5 billion years, which aligns with the age of the Earth and is used in geological dating.
Nuances include the fact that shorter half-lives correspond to more intense radioactivity (higher decay rates), raising safety and handling considerations, while longer ones imply persistence in the environment (as with some nuclear waste isotopes). The concept also extends beyond pure physics into applications like medical imaging (e.g., technetium-99m with a 6-hour half-life), cancer therapy, archaeology, and nuclear power. Edge cases arise in branched decay chains, where multiple half-lives describe sequential transformations, or in situations involving very small numbers of atoms where statistical fluctuations become significant. Overall, half-life provides a fundamental, quantifiable measure of nuclear instability, underpinning our understanding of both natural radioactive processes and human technological uses of radioactivity.
Second post:
Radioactive Decay with Very Small Numbers of Atoms
Post by Wildeblood » Thu Jun 18, 2026 5:45 am
-situations involving very small numbers of atoms where statistical fluctuations become significant.
Wildeblood: Describe this, please.
Statistical Fluctuations in Radioactive Decay with Very Small Numbers of Atoms
Radioactive decay is fundamentally a stochastic (random) process governed by quantum mechanics. Each unstable nucleus has a fixed probability of decaying per unit time, independent of its neighbors or external conditions, but the exact moment of decay for any single nucleus is unpredictable. The half-life concept and the smooth exponential decay law N(t) = N₀ × e^(−λt) (or equivalently using (1/2)^(t/T½)) emerge as excellent approximations only when dealing with large ensembles of atoms—typically on the order of 10¹⁰ or more, where the law of large numbers smooths out individual randomness into highly predictable average behavior.
When the number of radioactive atoms becomes very small (e.g., tens, single digits, or even a single atom), statistical fluctuations dominate, and the decay process appears discrete, erratic, and far less predictable. The continuous exponential curve breaks down into a series of sudden, random "jumps" as individual atoms decay one by one. This is a direct manifestation of the probabilistic nature of quantum mechanics at the microscopic scale.
Mathematical Description
The decay of a small number of atoms follows a Poisson process (or, more precisely for a fixed initial number, a binomial process that approximates Poisson for low probabilities).
- The probability that a single nucleus survives without decaying until time t is e^(−λt), where λ = ln(2)/T½ is the decay constant.
- For N₀ atoms, the expected number remaining is still given by the exponential formula, but the actual number fluctuates around this mean with a standard deviation of roughly √(expected number of decays).
- For very small N, the relative uncertainty (standard deviation divided by the mean) becomes large: σ / μ ≈ 1/√N. With N = 100 atoms, fluctuations are ~10%; with N = 4 atoms, they can be 50% or more.
In the extreme case of a single atom, there is no "half-life" in a deterministic sense for that specific atom. Instead, the time until decay follows an exponential distribution (memoryless property): the probability of decaying in the next interval is constant, regardless of how long it has already existed. The atom might decay in the next second or remain stable for many multiples of its half-life—the half-life only describes the average waiting time across many such identical atoms.
Real-World and Theoretical Examples
- Laboratory or Environmental Low-Activity Samples: In trace analysis or environmental monitoring, a sample might contain only a few dozen atoms of a rare isotope. Geiger counters or scintillation detectors might register decays as isolated clicks separated by long, irregular intervals. The time between detections can vary dramatically, making short-term count rates appear noisy or zero for extended periods, even though the long-term average matches the half-life prediction.
- Nuclear Medicine and Single-Atom Tracers: Some advanced imaging or targeted therapies use extremely low quantities of radioisotopes. Fluctuations can affect dosing precision or signal strength in detectors.
- Astrophysics and Cosmology: In studies of rare decay events or neutrino detection, experiments sometimes deal with minuscule effective numbers of potential decays. Similarly, in models of primordial nucleosynthesis or stellar processes, small-number statistics become relevant.
- Theoretical Single-Atom Case: Imagine one atom of a short-lived isotope like polonium-214 (half-life ~164 microseconds). Its decay time is random; repeated experiments with identical atoms would yield a distribution of lifetimes clustered around the mean but with enormous spread. This underpins demonstrations of quantum indeterminacy.
Implications and Nuances
- Measurement Challenges: Determining the half-life of isotopes with very small samples requires many repeated experiments or longer observation times to average out fluctuations. For ultra-rare decays (very long half-lives), experiments like those searching for proton decay must run for years with massive detectors to accumulate enough statistics despite the tiny probability per atom.
- Safety and Detection: In radiation protection or nuclear forensics, small numbers of atoms (e.g., contamination) can lead to highly variable exposure readings over short periods, complicating risk assessment.
- Connection to Broader Physics: These fluctuations illustrate the transition from quantum randomness to classical predictability. They relate to concepts like quantum jumps, the watchdog effect (frequent measurements can suppress decay via the quantum Zeno effect, though this is subtle), and limitations in simulating radioactive decay on classical computers versus quantum ones.
- Edge Cases:
- Branched Decay or Isomeric States: Multiple decay pathways amplify complexity in small samples.
- Extremely Short Half-Lives: Decays happen so quickly that even small numbers behave more like a burst, with fluctuations in timing less noticeable.
- Extremely Long Half-Lives: With tiny samples, you might observe zero decays over human timescales, making the material seem stable.
- Non-Poisson Deviations: In exotic systems (e.g., atoms in traps or under extreme conditions), collective effects or quantum entanglement could theoretically modify pure Poisson statistics, though these are rare and usually negligible.
In summary, while half-life remains a powerful average descriptor even for small samples, the regime of low atom counts highlights the intrinsic randomness of radioactive decay. This has practical consequences for experimental design, data interpretation, and technology, while philosophically reinforcing the probabilistic foundation of quantum physics. It reminds us that the elegant exponential curves we plot in textbooks are emergent phenomena, not fundamental behavior at the level of individual nuclei. If you'd like quantitative examples, simulations, or connections to specific isotopes/experiments, let me know!
Third post:
JavaScript functions for Radioactive Decay
Post by Wildeblood » Thu Jun 18, 2026 5:56 am
- I need one or more javascript functions that can simulate these statistical processes (for game use, not research-grade).
- I want to start with parameters half-life, quantity (in grams) & elapsed-time and have returned quantity-remaining.
- I also want a function to deal with the extreme cases, where quantity is number of nuclei, down to the single nucleus case where, given a half-life, I want a plausible prediction of a decay time.
Here are two well-commented JavaScript functions (plus helpers) tailored for game use. They balance simplicity, performance, and visual plausibility without aiming for scientific precision.
1. Main Function: Bulk Decay (grams → remaining grams)
{ /**
* Simulates radioactive decay for a bulk quantity (in grams).
* Uses deterministic exponential decay for large quantities (smooth curve).
* Automatically switches to stochastic simulation when the number of atoms gets small.
*
* @param {number} halfLife - Half-life in the same time units as elapsedTime (e.g., seconds, days, years).
* @param {number} initialMassGrams - Starting quantity in grams.
* @param {number} elapsedTime - Time that has passed.
* @param {number} [atomsPerGram=6.022e23 / 100] - Rough Avogadro-based estimate.
* Customize per isotope if you want (default is ~6e21 atoms/gram, reasonable for many elements).
* @returns {number} Remaining mass in grams (floored to avoid negative/tiny values).
*/
function radioactiveDecayMass(halfLife, initialMassGrams, elapsedTime, atomsPerGram = 6.022e21) {
if (elapsedTime <= 0) return initialMassGrams;
if (initialMassGrams <= 0) return 0;
const lambda = Math.log(2) / halfLife; // decay constant
const expectedFraction = Math.exp(-lambda * elapsedTime); // deterministic fraction remaining
// For large quantities → use fast deterministic formula
const expectedRemainingGrams = initialMassGrams * expectedFraction;
// Estimate number of atoms left (for deciding stochastic regime)
const expectedAtoms = expectedRemainingGrams * atomsPerGram;
// Threshold for stochastic simulation (tune for your game)
if (expectedAtoms > 500) {
return Math.max(0, expectedRemainingGrams);
}
// Small number regime → stochastic simulation return stochasticDecayGrams(halfLife, initialMassGrams, elapsedTime, atomsPerGram); }
2. Stochastic Helper (used internally, but exposed for direct use)
{
/**
* Stochastic simulation for small numbers of atoms.
* Each atom is treated individually with a random decay decision.
*/
function stochasticDecayGrams(halfLife, initialMassGrams, elapsedTime, atomsPerGram = 6.022e21) {
const lambda = Math.log(2) / halfLife;
const initialAtoms = Math.floor(initialMassGrams * atomsPerGram);
if (initialAtoms <= 0) return 0;
let remainingAtoms = 0;
// For each atom, calculate survival probability and roll
for (let i = 0; i < initialAtoms; i++) {
const survivalProb = Math.exp(-lambda * elapsedTime);
if (Math.random() < survivalProb) {
remainingAtoms++;
}
}
const remainingGrams = remainingAtoms / atomsPerGram;
return Math.max(0, remainingGrams); // prevent floating-point noise
}
Performance note: Looping over thousands of atoms is fine for occasional calls. For thousands of simultaneous decaying objects in a game, cache the deterministic result and only run stochastic when dropping below ~1,000 atoms.
3. Single Nucleus / Extreme Case: Predict Decay Time
/**
* Returns a plausible decay time for a single nucleus (or very small count).
* Uses the exponential distribution (correct statistical model).
*
* @param {number} halfLife - Half-life in your time units.
* @param {number} [numAtoms=1] - Number of atoms (defaults to single nucleus).
* @returns {number} Time until the next decay event (or first decay if numAtoms > 1).
*/
function predictDecayTime(halfLife, numAtoms = 1) {
if (halfLife <= 0) return 0;
const lambda = Math.log(2) / halfLife; // rate parameter
const minTime = 0;
// For multiple atoms: time until the FIRST decay (minimum of numAtoms exponentials)
if (numAtoms > 1) {
// Equivalent to exponential with rate = lambda * numAtoms
const effectiveLambda = lambda * numAtoms;
return -Math.log(1 - Math.random()) / effectiveLambda;
}
// Single atom: standard exponential waiting time
return -Math.log(1 - Math.random()) / lambda;
}
// Bulk example
const remaining = radioactiveDecayMass(5730, 1.0, 10000); // C-14, 1g, after 10k years
console.log(remaining.toFixed(6)); // something around 0.3g
// Extreme low-quantity example const tinyRemaining = radioactiveDecayMass(5730, 1e-20, 5000, 6.022e21); // very few atoms
// Single atom decay time prediction const decayIn = predictDecayTime(164e-6); // Polonium-214 microsecond half-life console.log(This atom will likely decay in ${decayIn.toFixed(6)} seconds);
Additional Utilities You Might Want
// Sample how many atoms decay in a time step (useful for particle effects, radiation bursts, etc.)
function sampleDecaysInInterval(halfLife, currentAtoms, deltaTime) {
const lambda = Math.log(2) / halfLife;
const expectedDecays = currentAtoms [i] (1 - Math.exp(-lambda [/i] deltaTime));
// Poisson approximation for small probabilities
return poissonRandom(expectedDecays);
}
// Simple Poisson sampler (good enough for games)
function poissonRandom(lambda) {
if (lambda <= 0) return 0;
let L = Math.exp(-lambda);
let k = 0;
let p = 1;
do {
k++;
p *= Math.random();
} while (p > L);
return k - 1;
}
Tuning Tips for Games
- Visual feel: You can add a small random jitter to the deterministic result for "natural variation" even at medium quantities.
- Seeding: Replace `Math.random()` with a seeded PRNG if you need deterministic replays.
- Performance: For huge numbers of atoms, stay in the deterministic branch longer (e.g., threshold 10,000).
- Edge cases handled: Zero/negative inputs, extremely short half-lives, extremely long elapsed times, tiny masses.
- Units: Keep time units consistent (seconds, game ticks, in-game years, etc.).
These functions give you smooth large-scale behavior with satisfying randomness when quantities get low — perfect for gameplay (resource decay, radiation hazards, sci-fi mechanics, etc.). Let me know if you want a version using game ticks, animation-friendly incremental updates, or integration with a specific game engine!
Links
•Decaying original: Half-Life in Radioactive Decay