[关闭]
@zy-0815 2016-11-13T22:07:09.000000Z 字数 5432 阅读 1267

张梓桐计算物理第八次作业

1 Problem

Problem 3.18,3.20

2 Abstract

With the dicusssion the Euler method in calculating projectile movement of a cannon shell,in the passage,we are going to talk about the Euler-Cromer method of the better calculation of oscillatory under damped and external force.After we have calculated the Poincare Section of external force only at ,now we turn to differnet situations of the various of ,in order to see the differnece and changes between them inside.

3 Background

Now we start to figure out the movement rule of a damped and forced pendulum.With the basic knowledge of Newtoon second law and the definition of , we have the following equation:


where is the module of the external force with unit,and is the frequency of external force,also with unit.
Here we introduce the variables to transfer the secdonary differential equation into firs-order differential equation:


Now we rewrite the physics formula into precodes,notcing the Euler-Cromer method,rather than Euler method,which will lead to a divergence in the infinity.

All above is just simple backgrounds of the problem.Here we are going to talk about the way to construct the bifurcation figure.

4 Main body

Program to calculate the Ponicare Section is no longer needed to be illustrated ,you can refer to my last assignment.
Here are program to draw the Bifurcation plot:

  1. import math
  2. import pylab as pl
  3. import numpy as np
  4. class oscillatory_motion:
  5. def __init__(self,Fd=1.2,OmegaD=2./3,q=0.5,intial_theta=0.2,intial_omega=0,time=1000,step=1000):
  6. self.Fd=Fd
  7. self.OmegaD=OmegaD
  8. self.intial_theta=intial_theta
  9. self.intial_omega=intial_omega
  10. self.step=step
  11. self.cycle=2*math.pi/OmegaD
  12. self.dt=self.cycle/step
  13. self.time=time
  14. self.Theta=[self.intial_theta]
  15. self.originTheta=[self.intial_theta]
  16. self.Omega=[self.intial_omega]
  17. self.Time=[0]
  18. self.q=q
  19. def run(self):
  20. while self.Time[-1]<self.time:
  21. tmp_Omega=self.Omega[-1]+(-math.sin(self.Theta[-1])-self.q*self.Omega[-1]+self.Fd*math.sin(self.OmegaD*self.Time[-1]))*self.dt
  22. self.Omega.append(tmp_Omega)
  23. tmp_Theta=self.Theta[-1]+tmp_Omega*self.dt
  24. self.originTheta.append(tmp_Theta)
  25. while tmp_Theta<-math.pi:
  26. tmp_Theta=tmp_Theta+2*math.pi
  27. while tmp_Theta>math.pi:
  28. tmp_Theta=tmp_Theta-2*math.pi
  29. self.Theta.append(tmp_Theta)
  30. tmp_Time=self.Time[-1]+self.dt
  31. self.Time.append(tmp_Time)

Above are the general program to do calculation.
Next will be the addtional section for Bifuraction Plot.

  1. #This section is used to caluclate and store the data of theta after 300 periods of driving foce and a fixed driving force
  2. def Bifurcation_Plot(init_NUMBER=0,F_D=1.2,frequency=2./3,friction=0.5,color='black',slogan=''):
  3. tmp_variable=oscillatory_motion(Fd=F_D,OmegaD=frequency,q=friction,time=400*2*math.pi/frequency,)
  4. tmp_variable.run()
  5. Theta=[]
  6. for i in range(100):
  7. Theta.append(tmp_variable.Theta[(300+i+init_NUMBER)*tmp_variable.step])
  8. Fd=[F_D]*len(Theta)
  9. return (Fd,Theta)

Here are the order to possess:

  1. #Set the intial F_D to be 1.35 and with a interval of 0.001, end with F_D =1.5,other situation can be adapted from this origin program as you wish
  2. tmp_FD=[]
  3. tmp_theta=[]
  4. for i in np.arange(1.35,1.5,0.001):
  5. a=Bifurcation_Plot(F_D=i,frequency=2./3)
  6. tmp_FD.extend(a[0])
  7. tmp_theta.extend(a[1])
  8. pl.scatter(tmp_FD,tmp_theta,s=0.1,label=r'$\Omega_D=2/3$')
  9. pl.legend()

5 Results

5.1 Part 1

Firstly let's take a glimpse of situation.
2.png-39.4kB
And here are the details of the plot:
3.png-33.8kB
4.png-30.1kB

Secondly,Let's look at the differnent time choosing for in-phase to out of phase and out of phase:
5.png-63.5kB

Thirdly,we are going to show the Poincare Plot for various
This plot contains ,,
1.png-27.1kB

5.2 Part 2

Now we'd like to talk about the Bifuration figure:
We choose the and
7.png-25kB
Next are some details:
8.png-18kB
9.png-17.6kB

Here are the plots with different
18.png-351.8kB

Now we change the fricition factor to
17.png-288.5kB

6 Vpython display

For this part the source code is(a definition in the oscillatory_motion class)

  1. from __future__ import division
  2. from visual import *
  3. from math import *
  1. q=0.5
  2. l=9.8
  3. g=9.8
  4. f=2/3
  5. dt=0.04
  6. theta0=0.2
  7. omega0=0
  8. ceil=box(pos=(0,5,0),size=(5,0.5,2),material=materials.bricks)
  9. ball=sphere(pos=(l*sin(theta0),5-l*cos(theta0),0),radius=1,material=materials.emissive,color=color.green)
  10. ball.omega=omega0
  11. ball.theta=theta0
  12. ball.t=0
  13. ball.F=0.5
  14. string=curve(pos=[ceil.pos,ball.pos],color=color.yellow)
  15. po=arrow(pos=ball.pos,axis=(10*ball.omega*cos(ball.theta),10*ball.omega*sin(ball.theta),0),color=color.yellow)
  16. while True:
  17. rate(100)
  18. ball.omega=ball.omega-((g/l)*sin(ball.theta)+q*ball.omega-ball.F*sin(f*ball.t))*dt
  19. angle_new=ball.theta+ball.omega*dt
  20. while angle_new>pi:
  21. angle_new-=2*pi
  22. while angle_new<-pi:
  23. angle_new+=2*pi
  24. ball.theta=angle_new
  25. ball.pos=(l*sin(ball.theta),5-l*cos(ball.theta),0)
  26. string.pos=[ceil.pos,ball.pos]
  27. po.pos=ball.pos
  28. po.axis=(10*ball.omega*cos(ball.theta),10*ball.omega*sin(ball.theta),0)
  29. ball.t=ball.t+dt

6.1 GIF 1

Here are the gif for this code():
There is barely chaos for low
2016-11-13 21_50_06.gif-1007.2kB

6.2 GIF 2

Here are the gif for this code():
You can see obviously chaos in this gif
2016-11-13 22_03_26.gif-292.8kB

7 Thanks

1.Wang shixing for his frame of program
2.Wu yuqiao for his frame of Vpython program
3.LATEX

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