Radioactive decay

Question P6.5.7

Example E6.8 produced a comma-separated text file containing 10 simulations of the radioactive decay of an ensemble of 500 $\mathrm{^{14}C}$ nuclei. For each simulation column, the number of undecayed nuclei as a function of time, $N(t)$, is given; the grid of time points (in years) is in the first column.

Average the simulation data, which is available as 14C-sim.csv, and use NumPy's np.linalg.lstsq function to perform a linear least-squares fit. Retrieve the half-life of $\mathrm{^{14}C}$, $t_{1/2} = \tau\ln 2$, where: $$ N(t) = N(0)\mathrm{e}^{-t/\tau} \quad \Rightarrow \quad \ln[N(t)] = \ln[N(0)] - \frac{t}{\tau}. $$

Solution P6.5.7