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)N(t) in a radioactive sample by integrating dN/dt=−λN\mathrm{d}N/\mathrm{d}t = -\lambda N. Line 4 of the listing should read lam = np.log(2)/thalf, converting the stated half-life into the decay constant λ=ln⁡2/t1/2\lambda = \ln 2/t_{1/2}. Take the half-life t1/2=12.0 st_{1/2}=12.0\,\mathrm{s} and N0=1.0×106N_0 = 1.0\times10^6 nuclei at t=0t=0. Decay is taken as a pure exponential process with no daughter products, so the exact solution is N(t)=N0 e−λtN(t) = N_0\,e^{-\lambda t}, and exactly one half-life must halve the population. (a) State the exact fraction N(t1/2)/N0N(t_{1/2})/N_0 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.0050.005 (that is, 0.5%0.5\%). (b) Run at a step of Δt=0.001 s\Delta t = 0.001\,\mathrm{s}, the correct program returns N(12.0 s)/N0=0.4996N(12.0\,\mathrm{s})/N_0 = 0.4996. Show that the test in part (a) passes, quoting the margin. (c) Line 4 is changed to lam = 1.0/thalf (the ln⁡2\ln 2 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.0 st=12.0\,\mathrm{s}, and determine whether the known-answer test of part (a) passes or fails, quoting the printed difference.

Related theory

Browse the problem library