PHYS291 Project Page

Simulating Radioactive Decay

by Amalie Ramdal
June 2020

Figure 1 - Illustration of diffrent number of nuclei decaying

Project Description

This project will investigate the randomness of radioactive decay, using the radioactive decay law and random numbers to simulate radioactive decay. I will look at how the number on radioactive nuclei and the simulated time intervals affect the simulation. Further a detector with dead time will be simulated. To make the simulations more general the half-life will be set to T1/2=1 for all the simulations.


The radioactive decay law states that the number of nuclei decaying must be proportional to the number of nuclei N and the time interval dt, this gives equation 1


where λ is the decay constant.

Assuming the number of nuclei is N0 at t=0 and integrating equation 1 gives equation 2


The decay constant λ can be calculated in terms of the half-life, given equation 3


Given equation 2 after some time t N/N0 = e-λt parts of the unstable nuclei will be left, and 1 - N/N0 = 1 - e-λt parts will have decayed. Therefore, the chance p for one nuclei to decay on the time t will be given by equation 4


For small time intervals t the same chance can be derived from the differential equation, equation 1, this gives equation 5


Equation 4 and 5 will be compared by different time intervals and different numbers of nuclei N.

To calculate the mean value of M measurements’ equation 6 is used, and to calculate the standard deviation s equation 7 is used



Further the simulation will take into account how a detector might work, to do this I set some criteria for the detector:

To correct for the dead time, equation 8 is used


where N is the estimated number of counts, if there where no dead time. Nm is the number counted by the detector, τ is the dead time and T is the time interval we are counting in.

Program Description

Download all the files for the project here:

visualize_decay_gif.C makes the gif in figure 1, the states of all the nuclei is stored in a vector, and illustrated in a 2D histogram. compare_N_and_t_1.C compares different numbers of nuclei N and different time intervals t, uses equation 4 for calculating the chance. compare_N_and_t_2.C does the same comparison as compare_N_and_t_1.C but uses equation 5 for calculating the chance. activity_to_file.C simulates activity and writes it to a file, it writes the time and the number of incoming particles. real_detector.C simulates how a detector with constant dead time works, it also uses equation 8 to estimate what the activity really is and has an ideal counter which count what really comes in to compare. The program writes the results to a file. plot_detected.C plots the result from the previous program.

Method and Results

The program visualize_decay_gif.C makes the gif in figure 1, which is just an illustration of how a sample of nuclei decays. The illustration assumes 100% abundance, and can be seen as cross section of a sample. For the lager number of nuclei on the right, it is much more predictable how big the fraction of decayed nuclei is when the number of nuclei to start is larger.

To compare the different numbers of nuclei the program compare_N_and_t_1.C was written, it also compares different time intervals for the simulation. To save execution time the vector “method” used in visualize_decay_gif.C was replaced by counting the number of nuclei left. To calculate the chance of decaying equation 4 was used, the number of nuclei N tested was {10,102,103,104,105 } with a constant time interval t=0.01 for the simulation. Also the time intervals {1,0.1,0.01,0.001,0.0001} with constant N=1000. The simulation was done 10 times for each value of N and t, N is added to the y-axis on a graph and t on the x-axis. A function is fitted to the graph, and one of the parameters is taken out which corresponds to λ and the half-life can be calculated from this parameter and equation 3. From these 10 measurements of the half-life equation 6 and 7 is used to calculate the mean value and the error, the result is shown in figure 2.

Figure 2 - Comparing diffrent values of N and t using equation 4 to calculate chance

To test if the chance in equation 5 would give a different result, the same thing was done in compare_N_and_t_2.C, only the calculation of chance was changed. The result is in figure 3.

Figure 3 - Comparing diffrent values of N and t using equation 5 to calculate chance

The programs activity_to_file.C, real_detector.C and plot_detected.C simulates how a detector can work. In figure 4, 5 and 6 the simulation time interval t is varied to show how too big time intervals can affect the simulation. For all the different t, the number of nuclei N=10000, the time counting was T=0.1 and the dead time was τ=0.001 (the dead time might be at bit big in the simulation, but it is easier to see how the time intervals affects the simulation then). The different t used was {0.001,0.0001,0.00001}, the result is shown in figure 4, 5 and 6. The blue line is the activity actually counted by the detector, the green line is the estimated activity using equation 8 and the data in the blue line, and the red line is the actual activity.

Figure 4 - Simulating detector with way to big simulation time interval t

Figure 5 - Simulating detector with a little to big simulation time interval t

Figure 6 - Simulating detector with small enought simulation time interval t

Discussion and Conclusion

From figure 2 the measured half-life does not seem to be much affected by the different numbers of nuclei, but it looks like the error has a big dependents on N. For the time interval t, there isn’t much of a difference between the various ones except for the largest time interval t=T1/2=1, which is way off. All of the above goes fore the result in figure 3, there isn’t any big difference in using equation 4 or 5. The time interval t=1 in figure 3 is further from the right value, but has a smaller error, in figure 2 the mean value is closer to the right one, but has a bigger error. From this I can not argue that one equation for calculating the chance of decay is better than the other.

In figure 4 the estimated activity from the “detector” is not close to the actual activity, the smaller time interval gives a better result in figure 5, but there is still quite a gap in the beginning. In figure 6, with the smallest simulation time interval, the difference is small and neither the estimated or the actual activity is bigger or smaller than the other over time. It looks like this type of simulation benefits from the smallest simulation time interval t as possible.