[关闭]
@Guibeen 2016-10-16T17:01:58.000000Z 字数 2941 阅读 556

第四次作业

姚贵斌 2014301020066


作业内容

problem1.5

Consider again a decay problem with two types of nuclei and , but now suppose that nuclei of type decay into ones of type , while nuclei of type decay into ones of type . Strictly speaking, this is not a "decay" process, since it is possible for the type nuclei to turn back into type nuclei. better analogy would better be a resonance in which a system can tunnel or move back and forth between two states and which have equal energies. The corresponding rate equations are



Where for simplicity we have assumed that the two types of decay are characterized by the same time constant, . Solve this system of equations fo the numbers of nuclei, and , as functions of time. Consider different initial conditions, such as ,etc.,and take =1s. Show that your numeral results are consistant with the idea that the system reaches a steady state in which and are costant. In such a steady state, the time derivatives and should vanish.

思路

仿照第一章课件中的方法。只是将原来的单种粒子变成两种粒子。

代码

  1. import pylab as pl
  2. class uranium_decay:
  3. """
  4. Simulation of radioactive decay
  5. Program to accompany 'Computational Physics' by Cai Hao
  6. """
  7. def __init__(self, number_of_nuclei_A = 100, number_of_nuclei_B= 0,\
  8. time_constant_A = 1, time_constant_B=1, time_of_duration = 10,\
  9. time_step = 0.05):
  10. # unit of time is second
  11. self.n1_uranium = [number_of_nuclei_A]
  12. self.n2_uranium = [number_of_nuclei_B]
  13. self.t = [0]
  14. self.tau1 = time_constant_A
  15. self.tau2 = time_constant_B
  16. self.dt = time_step
  17. self.time = time_of_duration
  18. self.nsteps = int(time_of_duration // time_step + 1)
  19. print("Initial number of nuclei A ->", number_of_nuclei_A)
  20. print("Initial number of nuclei B ->", number_of_nuclei_B)
  21. print("Time constant A ->", time_constant_A)
  22. print("Time constant B ->", time_constant_B)
  23. print("time step -> ", time_step)
  24. print("total time -> ", time_of_duration)
  25. def calculate(self):
  26. for i in range(self.nsteps):
  27. tmp1 = self.n1_uranium[i] - self.n1_uranium[i] /self.\
  28. tau1 * self.dt+self.n2_uranium[i] / self.tau2 * self.dt
  29. tmp2 = self.n2_uranium[i] - self.n2_uranium[i] /self.\
  30. tau2 *self.dt+self.n1_uranium[i] / self.tau1 * self.dt
  31. self.n1_uranium.append(tmp1)
  32. self.n2_uranium.append(tmp2)
  33. self.t.append(self.t[i] + self.dt)
  34. def show_results(self):
  35. pl.plot(self.t, self.n1_uranium)
  36. pl.plot(self.t, self.n2_uranium)
  37. pl.xlabel('time ($s$)')
  38. pl.ylabel('Number of Nuclei')
  39. pl.show()
  40. def store_results(self):
  41. myfile = open('nuclei_decay_data.txt', 'w')
  42. for i in range(len(self.t)):
  43. print(self.t[i], self.n1_uranium[i], file = myfile)
  44. print(self.t[i], self.n2_uranium[i], file = myfile)
  45. myfile.close()
  46. a = uranium_decay()
  47. a.calculate()
  48. a.show_results()
  49. a.store_results()

结果

结论

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注