Why is my banana glowing?

(modeling a system that evolves in time)

Student names

Work in pairs, and put the names of both people in your group here! (If you're in a group of 3, just move your chairs so you can work together.)

Learning Goals (Why are we asking you to do this?)

Lots of systems (physical, biological, economic, social, etc...) evolve in time, and you have to figure out how to change things at the next time based on what happened before. Today, we're doing that using radioactivity and compare our models to some data. This type of modeling is going to make us think about:

  • How to make a system move forward in time using loops
  • How to work with numpy arrays to do interesting and useful things
  • How to think about a model in relation to experimental data, and to decide if your model isn't quite good enough (ooh! foreshadowing!)

Radioactivity

The word "radioactivity" conjures up many images - perhaps a nuclear reactor (or a nuclear reactor accident, such as Fukushima...), or perhaps MSU's very own National Superconducting Cylotron Laboratory, or NSCL. What the word "radioactivity" refers to is particles that are emitted from the nuclei of some atoms, which are unstable due to the fundamental properties of the nucleus. Depending on the nucleus, the particles emitted can be highly energetic photons, electrons, or 'alpha particles' (helium nuclei).

Not all nuclei are radioactive; many elements, like normal hydrogen ($^1\mathrm{H}$) or carbon ($^{12}\mathrm{C}$), are extremely stable, and their nuclei do not spontaneously emit particles. However, isotopes of these elements are radioactive - $^3\mathrm{H}$, or tritium, is a hydrogen atom with two extra neutrons in the nucleus, and which has a "half-life" of 12.32 years, and $^{14}\mathrm{C}$, the isotope of carbon used to estimate the ages of old artifacts by archeologists using a technique called carbon dating, has a "half-life" of 5,730 years. The "half-life" is the time that it takes for half of a sample of that element to decay. In other words, if you start out with a number of atons of $^{14}\mathrm{C}$ equal to $N_0$, after some amount of time t you would have:

$N(t) = N_0 2^{-\frac{t}{t_{1/2}}}$

left, where $t_{1/2}$ in this equation is the half-life of $^{14}\mathrm{C}$, 5,730 years. Radioactive isotopes have a tremendous range of half-lives, with values measured from around $10^{-23}$ seconds to more than $10^{22}$ years! The study of these isotopes - which ones can and can't decay, how long they take to decay, and what they produce when they do decay - can tell you a tremendous amount about the basic properties of matter (take a tour of the NSCL some time and you'll hear all about it!)

Also, it's worth noting that radioactivity is naturally occurring, and plenty of things that you interact with in everyday life are a little bit radioactive. A relatively common isotope of potassium is radioactive, so anything that contains potassium - like bananas! - creates detectable amounts of radioactivity. There are also radioactive isotopes in granite (which is used to make floors, counter tops, and lots of other things), cigarettes, the clay in kitty litter, and a lot of types of old pottery and glassware.


A mysterious stranger... and an even more mysterious substance

You happen to be wandering down a dark alley just north of campus after the bars close on a Friday. A mysterious man gives you a chunk of some material of unknown properties. He tells you that it is "kinda radioactive, maybe...", but that it's very late and he just woke up in this alley. You can't help but notice that it's warm to the touch, and it has a lovely green glow. By the time you look up, he has disappeared in a puff of smoke. You clearly can't give the sample back to him, but don't think it's safe to leave it in the alley.

For the moment, let's assume that it has a half-life $t_{s}$ (which you'll determine later) and you have 1 kg of it.

First, work out some things on your group's whiteboard:

  1. How much of a sample of material should be remaining after T seconds?
  2. How many decays should there be per second at that time?

Hint 1: $\frac{d}{dx} 2^x = 2^x \mathrm{ln}(2)$, and don't forget the chain rule!

Hint 2: What's the relationship between $\frac{dN}{dt}$ and the measured number of decays per second?

Check with an instructor before you move on!

Next: make two plots, one with the amount of time that should be remaining as a function of time, and a second with the expected decays per second as a function of time!


In [ ]:
# put your code here!  add additional cells if necessary.

When you get home, you ask your roommate, who conveniently happens to work in a nuclear chemistry lab, to measure some of the properties of this odd material that you've been given. When she comes home that night, she says that she managed to purify the sample and measure its radioactive decay rate (which is to say, the number of decays over some period of time) and the total amount of stuff as a function of time. Since you have to use two different machines to do that, it's in two different files. She also mentions that she didn't have time to do any more because somebody else in the lab had forgotten to clean out the two machines, so she had to do a quick cleanup job before making the measurements.


In [ ]:
# this block of code reads in the data files.  Don't worry too much about how they 
# work right now -- we'll talk about that in a couple of weeks weeks!

import numpy as np

'''
count_times = the time since the start of data-taking when the data was 
               taken (in seconds)
count_rate = the number of counts since the last time data was taken, at 
               the time in count_times
'''

count_times = np.loadtxt("count_rates.txt", dtype=int)[0]
count_rates = np.loadtxt("count_rates.txt", dtype=int)[1]

'''
sample_times = the time since the start of data-taking when the sample 
                 was measured (in seconds)
sample_amounts = the number of atoms left of the mysterious material at 
                 the time in sample_times
'''

sample_times = np.loadtxt("sample_amount.txt", dtype=int)[0]
sample_amounts = np.loadtxt("sample_amount.txt", dtype=int)[1]

Using the four numpy arrays created in the cell above, plot the measured count rates as a function of time and, on a separate plot, plot the measured sample amounts as a function of time. What do you notice about these plots, compared to the ones from your analytic estimate? Also, if you inspect the data, approximately what is the initial amount of sample and the half-life? (Hint: when you plot, make sure you plot points rather than a line!)


In [ ]:
# put your code here!  add additional cells if necessary.

Next, using just the count rates and the measured initial amount of the substance (i.e., just the array count_rates and the first value in sample_amounts), estimate what the amount of sample should be as a function of time. Make a plot of this. (Note: you should work your model out on the whiteboard first!)


In [ ]:
# put your code here!  add additional cells if necessary.

Based on the plot in the previous cell, what do you think is going on?

put your answer here!

How might you modify your model to emulate this behavior? In other words, how might you modify the equation for decay rate to get something that matches the observed decay rate?

put your answer here!


More complex data manipulation and visualization

We're now going to try to do something to the decay rate data that you worked with above, to try to get a more accurate understanding of the decay rate and whatever is adding confusion to your modeling. What you're going to do is:

  1. "Smooth" the decay rate data over multiple adjacent samples in time to get rid of some of the noise. Try writing a piece of code to loop over the array of data and average the sample you're interested in along with the N samples on either side (i.e., from element i-N to i+N, for an arbitrary number of cells). Store this smoothed data in a new array (perhaps using np.zeros_like() to create the new array?).
  2. Plot your smoothed data on top of the noisy data to ensure that it agrees.
  3. Create a new array with an analytic equation that describes for the decay rate as a function of time, taking into account what you're seeing in point (2), and try to find the values of the various constants in the equation. Plot the new array on top of the raw data and smoothed values. Does this expression, and the constants that you decided on, give reasonable results?

In [ ]:
# put your code here!  add additional cells if necessary.

Feedback on this assignment

Please fill out the form that appears when you run the code below. You must completely fill this out in order for your group to receive credit for the assignment!


In [ ]:
from IPython.display import HTML
HTML(
"""
<iframe 
	src="https://goo.gl/forms/F1MvFMDpIWPScchr2?embedded=true" 
	width="80%" 
	height="1200px" 
	frameborder="0" 
	marginheight="0" 
	marginwidth="0">
	Loading...
</iframe>
"""
)
How to submit this assignment

Log into the course Desire2Learn website (d2l.msu.edu) and go to the "In-class assignments" folder. There will be a dropbox labeled "Day 6". Upload this notebook there (as well as pictures of the whiteboard, etc.). You only have to upload one notebook per pair - just make sure that everybody's name is at the top of the notebook!