Only do this assignment if you are not doing a project.
Please turn in this assignment by emailing them to me . Please use the subject of "Physics 222 HW6" for this assignment (if you use the link above, the subject will be added automatically). Please attach the source code to any programs that you write for this assignment. If you write more than one program, attach each separately. When answering the questions themselves feel free to answer directly in the body of your message (or attach your answers).
In this problem, you will examine a nuclear decay chain where nuclear species 1 decays into nuclear species 2 which decays into nuclear species 3 which decays into species 4. The equation for representing the number of particle of species 1 is:
dN1 = -λ1 N1 dtwhere N1 is the number of nuclei of type 1 as a function of time λ1 is the nuclear decay constant for the nuclear (λ= ln(2)/t1/2 - where t1/2 is the half-life). The equations for species 2 and 3 are similar:
dN2 = λ1 N1 dt - λ2 N2 dt
dN3 = λ2 N2 dt - λ3 N3 dtexcept now these nuclei are both created and destroyed by radiation.
Activity is a quantity that tells you how many decays of a certain type occur in a given time. Activity is
A = λ Nfor each type of nuclei.
In this assignment, you will write a program that reads in information about a nuclear decay chain, solves the differential equations above numerically, and then plots the number of each nuclei as a function of time, and the activity as a function of time. Your program will also determine at what time the activity of each nuclei is a maximum, and when the overall activity of the sample is a maximum.
The input files that your program will read will have the following format. The first line will have the total number of time steps that your program should run, followed by the length of each time step in seconds. The following lines will have 3 pairs of lines — 1 pair for each of the nuclei. The first line will have the name of the nuclear species and the next line will have the half-life in seconds followed by the number of nuclei of that type at t=0.
The input files that you need are rad1, rad2, rad3, and rad4.
For plotting for this program, you will have a lot of data points, but I don't want you to plot them all. In fact, you should plot the data in the form of lines, but use no more than 100 data points for each line. Instead of plotting every point that you calculate, your program should chose a representative sampling of the points to plot. Also, your program should create two plots for each run - one of the activities of each nuclei and the total activity as a function of time, and another of the number of each species as a function of time. Make sure that the lines on your plots are labelled. Consider using pls->mtex (man plmtex) and pls->ptex (man plptex) for labelling the lines and pls->col0 (man plcol0) to make your lines different colors.
N1(t) = 0
N2(t) = N2(t=0) e-λ2 t
N3(t) = N2(t=0)(1 - e-λ2 t)Plot these equations for that case and compare it to your program's plot.