# Physics and Astronomy Labs/Radioactive decay with dice

This page is under construction. Content is likely to be revised significantly in the near future. |

## Lede[edit]

This will be the Lede. It should mention the application to radioactive dating in OpenStax Astronomy. Remove the header **Lede** when this has been written.

## images[edit]

## Excel Spreadsheet[edit]

Column **roll** denotes the number of rolls. We rolled 201 dice 18 times, removing the "one" each time. Column **exp** denotes the number of dice removed on each roll in our experiment. Columns **sim1** through **sim5** represent five simulations. Column **theor** represents the theoretical value one is most likely to obtain: the first value is 201 divided by 6, and each consecutive value is 5/6 times smaller, representing exponential decay.

Column **SEexp** is the square of the error associated with the experiment. For the first role, this is obtained as follows:

Columns **SE1** through **SE5** represent the squared errors associated with the 5 simulations.

These squared errors are summed at the last row. The values of SoS (Sum of Squares) represent a measure of how well the simulation or the experiment matched the theoretical ideal. If the experimental SoS sufficiently exceeded any of the simulated SoS values, we might wish to question the experimental method.

roll | exp | sim1 | sim2 | sim3 | sim4 | sim5 | theo | SEexp | SE1 | SE2 | SE3 | SE4 | SE5 |

1 | 33 | 33 | 27 | 29 | 35 | 37 | 33.50 | 0.25 | 0.25 | 42.25 | 20.25 | 2.25 | 12.25 |

2 | 25 | 34 | 25 | 28 | 30 | 23 | 27.92 | 8.51 | 37.01 | 8.51 | 0.01 | 4.34 | 24.17 |

3 | 21 | 18 | 22 | 27 | 23 | 23 | 23.26 | 5.13 | 27.71 | 1.60 | 13.96 | 0.07 | 0.07 |

4 | 18 | 20 | 26 | 24 | 17 | 15 | 19.39 | 1.92 | 0.38 | 43.74 | 21.28 | 5.70 | 19.24 |

5 | 17 | 18 | 14 | 21 | 13 | 14 | 16.16 | 0.71 | 3.40 | 4.65 | 23.47 | 9.96 | 4.65 |

6 | 14 | 13 | 20 | 13 | 15 | 12 | 13.46 | 0.29 | 0.21 | 42.73 | 0.21 | 2.36 | 2.14 |

7 | 11 | 13 | 9 | 15 | 14 | 8 | 11.22 | 0.05 | 3.17 | 4.92 | 14.30 | 7.73 | 10.36 |

8 | 13 | 6 | 9 | 12 | 9 | 10 | 9.35 | 13.33 | 11.22 | 0.12 | 7.03 | 0.12 | 0.42 |

9 | 12 | 9 | 9 | 6 | 6 | 16 | 7.79 | 17.72 | 1.46 | 1.46 | 3.21 | 3.21 | 67.39 |

10 | 9 | 5 | 3 | 3 | 5 | 4 | 6.49 | 6.29 | 2.23 | 12.20 | 12.20 | 2.23 | 6.21 |

11 | 5 | 6 | 4 | 4 | 11 | 7 | 5.41 | 0.17 | 0.35 | 1.99 | 1.99 | 31.24 | 2.53 |

12 | 4 | 4 | 6 | 6 | 1 | 6 | 4.51 | 0.26 | 0.26 | 2.22 | 2.22 | 12.31 | 2.22 |

13 | 2 | 4 | 3 | 5 | 2 | 3 | 3.76 | 3.09 | 0.06 | 0.57 | 1.54 | 3.09 | 0.57 |

14 | 1 | 4 | 3 | 1 | 4 | 4 | 3.13 | 4.54 | 0.76 | 0.02 | 4.54 | 0.76 | 0.76 |

15 | 2 | 5 | 6 | 3 | 2 | 3 | 2.61 | 0.37 | 5.72 | 11.50 | 0.15 | 0.37 | 0.15 |

16 | 1 | 3 | 1 | 1 | 3 | 3 | 2.17 | 1.38 | 0.68 | 1.38 | 1.38 | 0.68 | 0.68 |

17 | 1 | 2 | 2 | 0 | 0 | 2 | 1.81 | 0.66 | 0.04 | 0.04 | 3.28 | 3.28 | 0.04 |

18 | 0 | 0 | 3 | 1 | 0 | 1 | 1.51 | 2.28 | 2.28 | 2.22 | 0.26 | 2.28 | 0.26 |

sums | 201 | 67 | 97 | 182 | 131 | 92 | 154 |

## Matlab codes[edit]

To know if the random error is consistent with the laws of probability for such a decay process, we use matlab codes. These codes simulate any number of labs for an arbitrary number of dice.

### Simulates five virtual labs[edit]

this code simulates but we graphed in Excel |
---|

```
clear all;close all;clc;
Nworms = 5;
Nstart = 201;
Nstop = 18;
data = zeros(Nstop,Nworms);
for nworm=1:Nworms
ncurrent=Nstart; % initiate throws
for count = 1 : Nstop %iterates throws by all the students
n2remove=0;
for diceCount = 1:ncurrent
if rand < 1/6
n2remove=n2remove+1;
end % ends if
end % finish thowing all the dice
ncurrent=ncurrent-n2remove; %remove some dice
data(count,nworm)=n2remove; %record number left
end
end
``` |

### Simulates and also graphs[edit]

this code graphs in matlab |
---|

clear all;close all;clc; Nworms = 5; Nstart = 201; Y = [42 32 29 25 11 10 14 7 3 6 3 3 2 1 3 1 1] sizeArray =size(Y); Nstop = sizeArray(2); data = zeros(Nstop,Nworms); for nworm=1:Nworms ncurrent=Nstart; % initiate throws for count = 1 : Nstop %iterates throws by all the students n2remove=0; for diceCount = 1:ncurrent if rand < 1/6 n2remove=n2remove+1; end % ends if end % finish thowing all the dice ncurrent=ncurrent-n2remove; %remove some dice data(count,nworm)=n2remove; %record number left end end for wormcount = 1:Nworms x=[1:1:Nstop]; y=data(:,wormcount); plot(x,y,'r'); hold on; plot(x,Y,'o'); end |

### Collects data from a data file[edit]

This code allows the user to enter classroom data into an Excel file that can be opened by matlab.

matlab code that reads an excel file |
---|

clear all;close all;clc; Nworms = 5; Nstart = 201; Y = xlsread('engineersData.xlsx'); %It is necessary to save an Excel file with this name and extension, and %then place into "Current folder". This was done on a click and drag the %only time I have ever tried it. % The data in that file were: % 42 32 29 25 11 10 14 7 3 6 3 3 2 1 3 1 1 sizeArray =size(Y); Nstop = sizeArray(2); data = zeros(Nstop,Nworms); for nworm=1:Nworms ncurrent=Nstart; % initiate throws for count = 1 : Nstop %iterates throws by all the students n2remove=0; for diceCount = 1:ncurrent if rand < 1/6 n2remove=n2remove+1; end % ends if end % finish thowing all the dice ncurrent=ncurrent-n2remove; %remove some dice data(count,nworm)=n2remove; %record number left end end for wormcount = 1:Nworms x=[1:1:Nstop]; y=data(:,wormcount); plot(x,y,'r'); hold on; plot(x,Y,'o'); end |

### Future project(s)[edit]

Matlab codes have been used to make spagetti plots. In the future, it would be nice to also use matlab to perform the sum of squares analysis.This can be of ultimate usefulness because of radioactivity of some elements under the hood.

### HTW fall 19[edit]

```
22
21
21
16
10
11
6
```