[关闭]
@flyboy1995 2016-10-09T13:42:26.000000Z 字数 2541 阅读 45

第四次作业


作业1.5


摘要

本次作业研究的是两种放射性原子核A和B之间进行的衰变,原子核A会衰变成原子核B,而原子核B也会衰变成原子核A。题目要求我们研究A和B原子核的数量随时间的变换。并改变不同的初始条件后证实当系统稳定时,A和B原子核的数量是常量。


背景

题目原文:
1.5. Consider again a decay problem with two types of nuclei A and B, but now suppose that nuclei of type A decay into type B, while nuclei of type B decay into type A. Strictly speaking, this is not a "decay" process, since it is possible for the type B nuclei to turn back into type A. A better analogy would be a resonance in which a system can tunnel or move back and forth between two states A and B 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 the system of equations for the numbers of nuclei, and , as functions of time. Consider different initial confitions, such as =100, =0, etc., and take =1 s. Show that your numerical results are consistent with the idea that the system reaches a steady state in which and are constant. In such a steady state, the time derivatives and should vanish.


正文

编程思路与课堂上所讲大同小异,由题目所给条件及泰勒展开可得:



按课上所讲思路,代码如下:

  1. import pylab as pl
  2. class uranium_decay:
  3. def __init__(self, number_of_nuclei_A = 100, number_of_nuclei_B = 0 , time_constant = 1, time_of_duration = 5, time_step = 0.05):
  4. self.n_uranium_A = [number_of_nuclei_A]
  5. self.n_uranium_B = [number_of_nuclei_B]
  6. self.t = [0]
  7. self.tau = time_constant
  8. self.dt = time_step
  9. self.time = time_of_duration
  10. self.nsteps = int(time_of_duration // time_step + 1)
  11. print("Initial number of nuclei A ->", number_of_nuclei_A)
  12. print("Initial number of nuclei B ->", number_of_nuclei_B)
  13. print("Time constant ->", time_constant)
  14. print("time step -> ", time_step)
  15. print("total time -> ", time_of_duration)
  16. def calculate(self):
  17. for i in range(self.nsteps):
  18. tmp_A = self.n_uranium_A[i] - self.n_uranium_A[i] / self.tau * self.dt+self.n_uranium_B[i] / self.tau * self.dt
  19. tmp_B = self.n_uranium_B[i] - self.n_uranium_B[i] / self.tau * self.dt+self.n_uranium_A[i] / self.tau * self.dt
  20. self.n_uranium_A.append(tmp_A)
  21. self.n_uranium_B.append(tmp_B)
  22. self.t.append(self.t[i] + self.dt)
  23. def show_results(self):
  24. pl.plot(self.t, self.n_uranium_A)
  25. pl.plot(self.t, self.n_uranium_B)
  26. pl.xlabel('time ($s$)')
  27. pl.ylabel('Number of Nuclei A and B')
  28. pl.show()
  29. def store_results(self):
  30. myfile = open('nuclei_decay_data.txt', 'w')
  31. for i in range(len(self.t)):
  32. print'self.t[i], self.n_uranium_A[i], self.n_uranium_B[i], file = myfile'
  33. myfile.close()
  34. a = uranium_decay()
  35. a.calculate()
  36. a.show_results()

结论

当t=0时,原子核A的数量为100,原子核B的数量为0,时间常量设置为1。模拟结果如图所示:

当t=0时,原子核A的数量为100,原子核B的数量为20,时间常量设置为1。模拟结果如图所示:

由实验结果所得:原子核A和原子核B的数量会逐渐趋于一致,且两种原子核数量的变化率变为0。


致谢

感谢蔡浩老师将课堂ppt及代码传到网上给我们参考。

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