[关闭]
@wudawufanfan 2016-10-30T13:18:04.000000Z 字数 5922 阅读 506

Chaos pendulum

pendulum angle-difference driving-force Poincare-section


Abstration

Chaos is a natural but complex phenomenon around the world.Around 100 years ago,French physicist Poincaré found that the Determinism of Newtonian Mechanics was not clear when investigating three-body problem.That means the initial condition will lead to a uncertain result which means chaos.The famous example is The Butterfly Effect.

Text

Now that we have a numerical method that is suitable for various versions of the simple pendulum problem, and armed with some understanding of what might happen, an external driving force and nonlinearity.In general, we have the equation of motion


Firstly,we use Euler method to figure out the problem.We set initial condition same except driving force

  1. import math
  2. import pylab as pl
  3. class harmonic:
  4. def __init__(self, w_0 = 0, theta_0=0.2, time_constant = 1, time_of_duration = 20, time_step = 0.04,g=9.8,length=1,q=1,F=5,D=2):
  5. # unit of time is second
  6. self.n_uranium_A = [w_0]
  7. self.n_uranium_B = [theta_0]
  8. self.t = [0]
  9. self.g=g
  10. self.length=length
  11. self.dt = time_step
  12. self.time = time_of_duration
  13. self.nsteps = int(time_of_duration // time_step + 1)
  14. self.q=q
  15. self.F=F
  16. self.D=D
  17. def calculate(self):
  18. for i in range(self.nsteps):
  19. tmpA = self.n_uranium_A[i] -((self.g/self.length)*math.sin(self.n_uranium_B[i])+1*self.n_uranium_A[i]-self.F*math.sin(self.D*self.t[i]))*self.dt
  20. tmpB = self.n_uranium_B[i] + self.n_uranium_A[i]*self.dt
  21. self.n_uranium_A.append(tmpA)
  22. self.n_uranium_B.append(tmpB)
  23. self.t.append(self.t[i] + self.dt)
  24. def show_results(self):
  25. pl.plot(self.t, self.n_uranium_B,label=' F=5')
  26. pl.xlabel('time ($s$)')
  27. pl.ylabel('angle(radians)')
  28. pl.legend(loc='best',frameon = True)
  29. pl.grid(True)
  30. a = harmonic()
  31. a.calculate()
  32. a.show_results()
  33. class diff_check(harmonic):
  34. def show_results2(self,style='b'):
  35. pl.plot(self.t, self.n_uranium_B,style,label=' F=10')
  36. pl.xlabel('time ($s$)')
  37. pl.ylabel('angle(radians)')
  38. pl.legend(loc='best',frameon = True)
  39. pl.grid(True)
  40. b=diff_check(w_0 = 0, theta_0=0.2, time_constant = 1, time_of_duration = 20, time_step = 0.04,g=9.8,length=1,q=1,F=10,D=2)
  41. b.calculate()
  42. b.show_results2('r')

QQ截图20161029195712.jpg

chapter3.12、3.13

problem3.13 ask us to find with time under the force
   

  1. import math
  2. import pylab as pl
  3. class harmonic:
  4. def __init__(self, w_0 = 0, theta_01=0.2,theta_02=0.2+0.001, time_of_duration = 400, time_step = 0.04,g=9.8,length=9.8,q=1/2,F=1.2,D=2/3):
  5. # unit of time is second
  6. self.n_uranium_A1 = [w_0]
  7. self.n_uranium_B1= [theta_01]
  8. self.n_uranium_A2 = [w_0]
  9. self.n_uranium_B2= [theta_02]
  10. self.a=[math.log(abs(theta_02-theta_01))]
  11. self.t = [0]
  12. self.g=g
  13. self.length=length
  14. self.dt = time_step
  15. self.time = time_of_duration
  16. self.nsteps = int(time_of_duration // time_step + 1)
  17. self.q=q
  18. self.F=F
  19. self.D=D
  20. def calculate(self):
  21. for i in range(self.nsteps):
  22. self.n_uranium_A1.append(self.n_uranium_A1[i] -((self.g/self.length)*math.sin(self.n_uranium_B1[i])+self.q*self.n_uranium_A1[i]-self.F*math.sin(self.D*self.t[i]))*self.dt)
  23. self.n_uranium_B1.append(self.n_uranium_B1[i] + self.n_uranium_A1[i+1]*self.dt)
  24. if self.n_uranium_B1[i+1]<-math.pi:
  25. self.n_uranium_B1[i+1]=self.n_uranium_B1[i+1]+2*math.pi
  26. if self.n_uranium_B1[i+1]>math.pi:
  27. self.n_uranium_B1[i+1]=self.n_uranium_B1[i+1]-2*math.pi
  28. else:
  29. pass
  30. self.n_uranium_A2.append(self.n_uranium_A2[i] -((self.g/self.length)*math.sin(self.n_uranium_B2[i])+self.q*self.n_uranium_A2[i]-self.F*math.sin(self.D*self.t[i]))*self.dt)
  31. self.n_uranium_B2.append(self.n_uranium_B2[i] + self.n_uranium_A2[i+1]*self.dt)
  32. if self.n_uranium_B2[i+1]<-math.pi:
  33. self.n_uranium_B2[i+1]=self.n_uranium_B2[i+1]+2*math.pi
  34. if self.n_uranium_B2[i+1]>math.pi:
  35. self.n_uranium_B2[i+1]=self.n_uranium_B2[i+1]-2*math.pi
  36. else:
  37. pass
  38. self.t.append(self.t[i] + self.dt)
  39. self.a.append(math.log(abs(self.n_uranium_B2[i+1]-self.n_uranium_B1[i+1])))
  40. def show_results(self):
  41. pl.plot(self.t, self.a)
  42. pl.xlabel('time ($s$)')
  43. pl.ylabel(' angle(radians)')
  44. pl.legend(loc='upper right',frameon = True)
  45. pl.grid(True)
  46. pl.show()
  47. a = harmonic()
  48. a.calculate()
  49. a.show_results()

QQ截图20161030120629.jpg

change the force to 0.5
QQ截图20161030120821.jpg

we can say

for ,pick two top points like(13.7903,-4.52358) and (39.3145,-7.32757) to calculate

for ,pick two top points like(14.5161,-3.33464) and (60.3226,-0.362945) to calculate

Poincare section

we plot  versus  only at times that are in phase with driving force,that is,dispaly the point when

  1. import math
  2. import pylab as pl
  3. class harmonic:
  4. def __init__(self, w_0 = 0, theta_0=0.2, time_of_duration = 10000, time_step = 0.04,g=9.8,length=9.8,q=1/2,F=1.2,D=2/3):
  5. # unit of time is second
  6. self.n_uranium_A = [w_0]
  7. self.n_uranium_B = [theta_0]
  8. self.t = [0]
  9. self.g=g
  10. self.length=length
  11. self.dt = time_step
  12. self.time = time_of_duration
  13. self.nsteps = int(time_of_duration // time_step + 1)
  14. self.q=q
  15. self.F=F
  16. self.D=D
  17. self.n_uranium_A2=[0]
  18. self.n_uranium_B2=[0]
  19. def calculate(self):
  20. for i in range(self.nsteps):
  21. self.n_uranium_A.append(self.n_uranium_A[i] -((self.g/self.length)*math.sin(self.n_uranium_B[i])+self.q*self.n_uranium_A[i]-self.F*math.sin(self.D*self.t[i]))*self.dt)
  22. self.n_uranium_B.append(self.n_uranium_B[i] + self.n_uranium_A[i+1]*self.dt)
  23. if self.n_uranium_B[i+1]<-math.pi:
  24. self.n_uranium_B[i+1]=self.n_uranium_B[i+1]+2*math.pi
  25. if self.n_uranium_B[i+1]>math.pi:
  26. self.n_uranium_B[i+1]=self.n_uranium_B[i+1]-2*math.pi
  27. else:
  28. pass
  29. self.t.append(self.t[i] + self.dt)
  30. for i in range(self.nsteps):
  31. if self.t[i]%(2*math.pi/self.D)<0.02:
  32. self.n_uranium_A2.append(self.n_uranium_A[i])
  33. self.n_uranium_B2.append(self.n_uranium_B[i])
  34. def show_results(self):
  35. pl.plot( self.n_uranium_B2,self.n_uranium_A2,'.')
  36. pl.xlabel('angle(radians)')
  37. pl.ylabel(' angle velocity')
  38. pl.legend(loc='upper right',frameon = True)
  39. pl.grid(True)
  40. pl.show()
  41. a = harmonic()
  42. a.calculate()
  43. a.show_results()

QQ截图20161030110343.jpg

problem 3.12 ask us to change phase by

so,I change the condition as followings

  1. if (self.t[i]-math.pi/4)%(2*math.pi/self.D)<0.02:

QQ截图20161030110852.jpg
we can see two figures are apparent with a little difference.

the overall figure rises compared with figure3.9 in the textbook.

Thanks

the people who discuss this problem with me

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