[关闭]
@2014301020081 2016-10-09T07:22:53.000000Z 字数 2184 阅读 468

Computational Physics Chapter 1 problem 1.5

by defeng kong(2014301020081)

未分类


1.Abstract

Consider a decay problem with types of nuclei A and B.The corresponding rate equations are



question:take=1s,consider different initial conditions,such as=100,=0,Show that your numerical results are consistent with the idea that the system reaches a steady state in which andare constant.In such a steady state,the time derivatives andshould vanish.

2.Background

In the class of Computational Physics,we learn the algorithm ' to solve the decay problem and how to design and run the program.Now,we will use the way to solve it too.

3.the Main body

Gain the algorithm:

we have



we order NA_NB= have

initialize:

if=1s, =100,=0,we can also set that the time step is 0.05s;

  1. t=0
  2. NA_NB=100
  3. dt=0.05
  4. T=1

calculate:

  1. t=t+dt
  2. NA_NB=NA_NB-(NA_NB/T)*dt

store:

  1. x=[]
  2. y=[]
  3. x.append(t)
  4. y.append(NA_NB)

plot:

  1. plt.figure()
  2. plt.xlabel('t')
  3. plt.ylabel('NA-NB')
  4. plt.title('decay_NANB')
  5. plt.plot(x,y)
  6. plt.text(2,80,'Time Constant=1s' 'Time Step=0.05s')
  7. plt.show()

the whole code:

  1. import matplotlib.pyplot as plt
  2. x=[]
  3. y=[]
  4. t=0
  5. NA_NB=100
  6. dt=0.05
  7. T=1
  8. i=0
  9. while i<=100:
  10. x.append(t)
  11. y.append(NA_NB)
  12. t=t+dt
  13. NA_NB=NA_NB-(NA_NB/T)*dt
  14. i=i+1
  15. plt.figure()
  16. plt.xlabel('t')
  17. plt.ylabel('NA-NB')
  18. plt.title('decay_NANB')
  19. plt.plot(x,y)
  20. plt.text(2,80,'Time Constant=1s' 'Time Step=0.05s')
  21. plt.show()

4.Conclusion

the graph:

graph
From the graph,we can see when t=5,NA-NB0,it can be regarded as the steady state.we also think the NA-NB=0 when t is large.so we have NA=NB when in the steady state.so



because=0,=0,we will have
=constant=

5.Thanks

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