[关闭]
@zy-0815 2016-10-31T05:16:16.000000Z 字数 2945 阅读 921

计算物理第七次作业Problem3.14


摘要

这次作业是继续课本上对Lyapunov指数的研究,但是对两个不同的变量有个轻微的减小,观察Lyapunov指数相对于初始值的变化。

背景介绍

此次作业是对混沌系统的进一步研究,即混沌系统对初始值的极端敏感性。

正文

在书上,系统的初始值为


因此初始程序为:

  1. import pylab as pl
  2. import math
  3. class pendulum:
  4. def __init__(self, time_step=0.04, theta=0.2,g=9.8,l=9.8,q =0.5,fd=1.2,wd=0.66666):
  5. self.ta=theta
  6. self.theta=[theta]
  7. self.pi= math.pi
  8. self.w = [0]
  9. self.q = q
  10. self.fd = fd
  11. self.wd = wd
  12. self.wo = g/l
  13. self.t = [0]
  14. self.dt = time_step
  15. def run(self):
  16. _time = 0
  17. while(self.t[-1]<=60):
  18. self.w.append(self.w[-1]-(self.wo*math.sin(self.theta[-1])+self.q*self.w[-1]-self.fd*math.sin(self.wd*self.t[-1]))*self.dt)
  19. tmp=self.w[-1]-(self.wo*math.sin(self.theta[-1])+self.q*self.w[-1]-self.fd*math.sin(self.wd*self.t[-1]))*self.dt
  20. self.theta.append(self.theta[-1] + tmp * self.dt)
  21. self.t.append(_time)
  22. _time += self.dt
  23. if (self.theta[-1] <= -math.pi):
  24. self.theta[-1] = self.theta[-1] + self.pi + math.pi
  25. if (self.theta[-1] >= math.pi):
  26. self.theta[-1] = self.theta[-1] - self.pi - math.pi
  27. def show_results(self):
  28. pl.plot(self.t,self. theta)
  29. pl.xlabel(" time($s$)")
  30. pl.ylabel("angle($radians$)")
  31. pl.title("angle versus time")
  32. pl.show()
  33. a=pendulum()
  34. a.run()
  35. a.show_results()

运行可得到初试结果为:
image_1b0chb4ht166c1fla1ppglgf1eb49.png-20.7kB

1、使q微量减小

此时可以对进行微量减小,如改变为,则程序为

  1. import pylab as pl
  2. import math
  3. class pendulum:
  4. def __init__(self, time_step=0.04, theta1=0.2,theta2=0.2,g=9.8,l=9.8,q1 =0.5,q2=0.499,fd=1.2,wd=0.66666):
  5. self.theta1=[theta1]
  6. self.theta2=[theta2]
  7. self.pi= math.pi
  8. self.w1 = [0]
  9. self.w2 = [0]
  10. self.dtheta=[math.fabs(theta1-theta2)]
  11. self.q1 = q1
  12. self.q2 = q2
  13. self.fd = fd
  14. self.wd = wd
  15. self.wo = g/l
  16. self.t = [0]
  17. self.dt = time_step
  18. def run(self):
  19. _time = 0
  20. while(self.t[-1]<=200):
  21. self.w1.append(self.w1[-1]-(self.wo*math.sin(self.theta1[-1])+self.q1*self.w1[-1]-self.fd*math.sin(self.wd*self.t[-1]))*self.dt)
  22. tmp1=self.w1[-1]-(self.wo*math.sin(self.theta1[-1])+self.q1*self.w1[-1]-self.fd*math.sin(self.wd*self.t[-1]))*self.dt
  23. self.theta1.append(self.theta1[-1] + tmp1 * self.dt)
  24. self.w2.append(self.w2[-1]-(self.wo*math.sin(self.theta2[-1])+self.q2*self.w2[-1]-self.fd*math.sin(self.wd*self.t[-1]))*self.dt)
  25. tmp2=self.w2[-1]-(self.wo*math.sin(self.theta2[-1])+self.q2*self.w2[-1]-self.fd*math.sin(self.wd*self.t[-1]))*self.dt
  26. self.theta2.append(self.theta2[-1] + tmp2 * self.dt)
  27. self.dtheta.append(math.log(math.fabs(self.theta1[-1]-self.theta2[-1])))
  28. self.t.append(_time)
  29. _time += self.dt
  30. if (self.theta1[-1] <= -math.pi):
  31. self.theta1[-1] = self.theta1[-1] + self.pi + math.pi
  32. if (self.theta1[-1] >= math.pi):
  33. self.theta1[-1] = self.theta1[-1] - self.pi - math.pi
  34. if (self.theta2[-1] <= -math.pi):
  35. self.theta2[-1] = self.theta2[-1] + self.pi + math.pi
  36. if (self.theta2[-1] >= math.pi):
  37. self.theta2[-1] = self.theta2[-1] - self.pi - math.pi
  38. def show_results(self):
  39. pl.plot(self.t,self.dtheta,"r")
  40. pl.xlabel(" time($s$)")
  41. pl.ylabel("log(d_angle)($radians$)")
  42. pl.title("log(d_angle) versus time")
  43. pl.show()
  44. a=pendulum()
  45. a.run()
  46. a.show_results()

运行结果为:
image_1b0chnfpf17c5fe5d201ubm11jcm.png-20.7kB
同理对于,运行结果为:
image_1b0ci08ucqia9ko1fgpvg416bt13.png-19.6kB

2、使进行微量减小

主程序依旧像上面一样,可以改变使得,带入后运行结果分别为:
image_1b0ciek3lddm1ve6vkn1u29q962a.png-25.4kB
image_1b0cifd4ia94luv63evve7192n.png-23.6kB

结论

由此可以看出,对于混沌系统,即使变量有着很轻微的变化,Lyapunov指数也会有很明显的变化,混沌系统对于初始值有着很高的敏感性。

致谢

感谢张梓桐同学对于程序不足之处的修改。

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