[关闭]
@zhongwei1234 2017-12-13T14:08:05.000000Z 字数 1790 阅读 43

计算物理第七次作业 论精度不能太高也不能太低

==

钟伟 2015301020164

《计算物理》第三章第四节T3.18


一. 课题
Calculate Poincare sections for the pendulum as it undergoes the period-doubling route to chaos. Plot versus θ, with one point plotted for each drive cycle. Do this for F =1.4, 1.44, and 1.465, using the other parameters as given in connection with Figure 3.10. You should find after removing the points corresponding to the initial transient the attractor in the period-1 regime will contain only a single point. Likewise, if the behavior is period n, the attractor will contain n discrete points.


二.实验分析

如书上3.10 的图一样, F=1.35 时摆的共振频率与驱动力同步,当值变为1.44时,周期变长了一倍,即频率缩短为原来的;同理, 继续增大驱动力到F=1.465, 有周期变为1.35时的四倍。根据题目,画出的相空间的庞加莱截面的θ值应该分别是1,2,4个点。
我先用程序画出书上FIGURE.3.10的图

  1. q=0.5
  2. l=g=9.8
  3. Ω_d=2/3
  4. Δt=0.0001
  5. w_list=[]
  6. θ_list=[]
  7. t_list=[]
  8. t=0
  9. w=0
  10. θ=0.2
  11. F=1.44
  12. while t<100:
  13. w=w-((g/l)*math.sin(θ)+q*w-F*math.sin_d*t))*Δt
  14. θ=θ+wt
  15. if θ>=math.pi:
  16. θ=θ-2*math.pi
  17. elif θ<-math.pi:
  18. θ=θ+2*math.pi
  19. t=tt
  20. θ_list.append(θ)
  21. t_list.append(t)
  22. plt.figure(figsize=(10,10))
  23. plt.title('θ-t')
  24. plt.xlabel('t/s')
  25. plt.ylabel('θ(rad)')
  26. plt.plot( t_list_list,'-',lw=2,color='black')
  27. plt.show()

再者画出相空间图以及加上循环结构运行出庞加莱截面。天真以为能出结果

  1. for n in range(5,21):
  2. if abs(t-2*math.pi*n_d)<0.005 and t>2*math.pi*n_d :
  3. theta_list.append(θ)
  4. omiga_list.append(w)

先看三个w-t的图取前一百秒 并画出相空间图
1.png
3.png
5.png

周期很明显
然后看看我的庞家莱截面
2.png
4.png
6.png

完全不按预计出牌
一气之下画一下相空间图
7.png
8.png
9.png

10.png

11.png

12.png

后面三个图与前面三个的不同是去掉tranisent前的点,于是少了之前阻力起作用不规则的点,剩下的点是有规律的周期运动

不过我之前画庞加莱截面已经考虑过这个问题,确实把起始运动的点去掉了

三.结果修正 找出问题 原来是精度 不能太高也不能太低

1.先看
缩小精度变0.001 删掉 and t>2*math.pi*n/Ω_d 语句
Paste_Image.png
这就是精度step太高,误差太大,多了几个点
现加上 t<2*math.pi*n/Ω_d 语句
Paste_Image.png
很明显 这都是取值离散造成的 一点偏差对θ取值影响挺大的θ-t图斜率有的地方很大
这可以认为只有一个点了
2.
Paste_Image.png

Paste_Image.png
还是比较完美 无论用t<2*math.pi*n/Ω_d 还是t>2*math.pi*n/Ω_d语句
注意语句
plt.ylim(1,3)
plt.xlim(-3,3)
的作用,要不然确实很多有微小差距的点

Paste_Image.png

Paste_Image.png

真正的挑战在
Paste_Image.png
没有出现预期的四个点 哪怕是四群点 事实是只有三群
果断把观察周期延长到200s
Paste_Image.png
果然四群点

现在加上t<2*math.pi*n/Ω_d 语句

Paste_Image.png
效果不佳增加step精度0.0001 加t<2*math.pi*n/Ω_d
计算了很久
TIM图片20171101170939.png
用t>2*math.pi*n/Ω_d或不用
TIM图片20171101171113.png

TIM图片20171101171119.png


四. 总结

计算机算的离散性导致这个问题图较难画,有必要把一个点的尺度放大并加上t>2*math.pi*n/Ω_d或t>2*math.pi*n/Ω_d语句

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