PHYS 252

Always hand in:
  1. written solutions to any questions
  2. a paper print-out of well-commented code. Include a multiline comment at the top of your code with (i) the assignment name, (ii) your name, and (iii) the date you handed in all elements of the assignment
  3. paper print-out of output (graph or text)
  4. also, e-mail me (y-lithwick@northwestern.edu) the code with your name and the exercise number in the subject line

Assignment #3
[5 pts, due 2pm, April 5]

  1. Reproduce Figure 1.2 from Computational Physics.
    1. Solve the radioactivity problem and calculate N(t) for N(0)=100, τ=1, and Δt= 0.5, 0.2, and 0.05.
    2. Plot your results and the analytical solution all on the same graph and comment. You can make a plot with gnuplot as follows: make three output files with different Δt, named "out_pt5.dat", "out_pt2.dat", "out_pt05.dat", and a fourth output file with the exact solution called "outex.dat". Then type into gnuplot:
      plot "out_pt5.dat" with points 7	[And enter return, then:]
      replot  "out_pt2.dat" with points 6   	[return]
      replot "out_pt05.dat" with points 5	[return]
      replot "outex.dat" with lines 		[return]
      If you do not put all the files in the same directory, you will have to switch directories before each replot. You could also plot everything with a 1-line "plot" command.
  2. Modified from Exercise 1.4 from Computational Physics. Consider a radioactive decay problem involving two types of nuclei, A and B, with populations NA and NB. Suppose that A decay to B, which then decay, according to equations 1.11 here: [pdf]. Solve with the Euler method. Set τA=1, and consider cases with τB bigger and smaller than 1. Create plots and explain your results, for both short and long time behaviors, when τA >> τB, and when τA << τB. I would like the explanation to as math-free as possible, so that it will make sense to a man on the street. (You may write your response with Notepad, or some editor, or with a pen. But if the latter, please write clearly.)
    1. For the radioactivity problem of question 1, make a plot that shows how the error in your calculated N scales with Δt after one step of size Δt, and write the answer on your graph. Explain.
    2. Make a second plot that shows how the error in your calculated N(t=5) scales with Δt, and write the answer on your graph. Explain.