A supplied program tracks the number of undecayed nuclei in a radioactive sample by…
PHYSICS · Subjective · Fermi University Physics · Computational Physics · Nuclear Physics · Research software practice, verification and validation
Computational Physics, Ch A workspace that can be rerun next year
Problem
A supplied program tracks the number of undecayed nuclei N(t) in a radioactive sample by integrating dN/dt=−λN. Line 4 of the listing should read lam = np.log(2)/thalf, converting the stated half-life into the decay constant λ=ln2/t1/2. Take the half-life t1/2=12.0s and N0=1.0×106 nuclei at t=0. Decay is taken as a pure exponential process with no daughter products, so the exact solution is N(t)=N0e−λt, and exactly one half-life must halve the population.
(a) State the exact fraction N(t1/2)/N0 remaining after one half-life, and use it to write a known-answer test as a single assert statement, testing the fraction against a tolerance of 0.005 (that is, 0.5%).
(b) Run at a step of Δt=0.001s, the correct program returns N(12.0s)/N0=0.4996. Show that the test in part (a) passes, quoting the margin.
(c) Line 4 is changed to lam = 1.0/thalf (the ln2 factor is dropped). Assuming the numerical integration remains as accurate relative to its own analytic solution as in part (b), find analytically the fraction the corrupted program returns at t=12.0s, and determine whether the known-answer test of part (a) passes or fails, quoting the printed difference.