A first numerical problem: Radioactive decay

← Previous

Homework assignment

The following homework assignment will be due on Monday, 23.10..

  1. Create a directory for this and all future homework exercises. Since we will be re-using and recycling code it is worthwhile to consider only one directory for all homeworks. Also, as a word of warning: Last year's experience showed that using a developer's surface like IDLE is a good idea but may be dangerous.

    Before you submit your code, make sure that it runs on its own with commands like python mycode.py

  2. Download the existing code, consisting of Radioactive.py, DEq_Solver.py, and Read_Type.py.

    1. In Radioactive.py, fill the method "dx_dt(self,x,t)" such that it yields the r.h.s. of the differential equation.
    2. In addition, fill the method "analytical(self,x0,t)" such that it yields an analytical solution, if x0 is the number of atoms at the time t=0.
    3. Also, in the __init__ method, ensure that the input half-life is transformed to the time-constant τ.
  3. In DEq_Solver.py, fill the method "EulerStep(self)" such that it makes one time-step, from xi = x(ti) to xi+1 = x(ti+1).





Frank Krauss and Daniel Maitre
Last modified: Tue Oct 3 14:43:58 BST 2017