[关闭]
@2014301020081 2016-10-31T03:31:50.000000Z 字数 1729 阅读 541

Computational Physics Chapter 3 problem3.12

by defeng kong(2014301020081)

未分类


摘要:

本文先得出F=1.2时混沌系统角速度随角度变化的图像即figure3.8右图,然后比较受力在最小值,和1/8周期处的庞加莱截面。

背景

3.12

In constructing the Poincare section in figure 3.9 we plotted points only at times that were in phase with the dirve force, that is,at time t=2pi n/D,where n is an interger. at these values of t the driving force passed through zero . however,we could just as easily have chosen to make the plot at times correaponding to a maximum of the drive force,or the time pi/8out-of-phase with this force,etc.construct the poincare sections for these cases and compare them with figure3.9

正文

代码为

  1. import pylab as pl
  2. from math import sin,pi
  3. g=9.8
  4. l=9.8
  5. class pendulums:
  6. def _init_(self,F,q,time_step=0.04,init_w=0,init_rad=0.2,dri=2.0/3):
  7. self.w=[init_w]
  8. self.rad=[init_rad]
  9. self.t=[0]
  10. self.dt=time_step
  11. self.dri=dri
  12. self.F=F
  13. self.q=q
  14. self.w1=[init_w]
  15. self.rad1=[init_rad]
  16. def calculate(self):
  17. while(self.t[-1]<400):
  18. self.w.append(self.w[-1]-((g/l)*sin(self.rad[-1])\
  19. +self.q*self.w[-1]-self.F*sin(self.dri*self.t[-1]))*self.dt)
  20. self.rad.append(self.rad[-1]+self.w[-1]*self.dt)
  21. if self.rad[-1]>pi:
  22. self.rad[-1]=self.rad[-1]-2*pi
  23. elif self.rad[-1]<-pi:
  24. self.rad[-1]=self.rad[-1]+2*pi
  25. self.t.append(self.t[-1]+self.dt)
  26. n=self.t[-1]*self.dri/(2*pi)-0.5/2
  27. if abs(n-round(n))<0.001:
  28. self.w1.append(self.w[-1]-((g/l)*sin(self.rad[-1])\
  29. +self.q*self.w[-1]-self.F*sin(self.dri*self.t[-1]))*self.dt)
  30. self.rad1.append(self.rad[-1]+self.w[-1]*self.dt)
  31. def show_results(self):
  32. pl.plot(self.rad, self.w)
  33. #pl.axis([0,60,-3,3])
  34. pl.axis([-4,4,-3,3])
  35. pl.show()
  36. def show_results(self):
  37. pl.plot(self.rad1, self.w1)
  38. #pl.axis([0,60,-3,3])
  39. pl.axis([-4,4,-3,3])
  40. pl.show()
  41. a= pendulums()
  42. a._init_(1.2,0.5)
  43. a.calculate()
  44. a.show_results()
  45. a= pendulums()
  46. b._init_(1.2,0.5)
  47. b.calculate()
  48. b.show_results1()

F=1.2时角速度随角度变化图像(运行时间为400s的效果图):
F=1.2时w随角度变化图像
两类
上图中是受力在1/8周期和受力最小处的比较(绿线:1/8,蓝线:受力最小)

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