@Zemel-Yang
2016-11-13T12:16:24.000000Z
字数 2402
阅读 1117
python homework
In this excercise, we will discuss chaos further —— the period doubling phenomenon. Change the values of the drive amplitude , the pendulum period will also change. We still use the Poincare section to analyze the relation between and . Bifucation diagram is also included.
In mathematics, particularly in dynamical systems, a bifurcation diagram shows the values visited or approached asymptotically (fixed points, periodic orbits, or chaotic attractors) of a system as a function of a bifurcation parameter in the system. It is usual to represent stable values with a solid line and unstable values with a dotted line, although often the unstable points are omitted. Bifurcation diagrams enable the visualization of bifurcation theory.
Animation showing the formation of bifurcation diagram.
Problem 3.18
Calculate the Poincare section for the pendulum as it undergoes the period_doubling route to chaos. Plot versus , with one point plotted for each drive cycle, as in Figure 3.9. Do this for 1.4, 1.44, and 1.465, using the other parameters as given in connection with Figure 3.10. You should find that 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 periodn, the attractor will contain n discrete points.
Use Vpython to simulate the motion
Code
from visual import*from math import *scene.height,scene.width,scene.center=500,500,(0,-15,0)L=9.8r=2t=0dt=0.04g = 9.8w = 1q = 0.5F = 1.4 #1.44,1.465i= 0theta=0.2bracket=box(pos=(0,0.6*(-L-r),-2.5),length=1,width=0.5,height=25,material=materials.wood,color=color.yellow)seat=box(pos=bracket.pos-(0,bracket.height/2.0,-2.5),length=20,width=12,height=1,material=materials.marble,color=(200,256,256))cylinder(pos=(0,0,0.5),axis=(0,0,-3),radius=0.3)f=frame()ball=sphere(frame=f,pos=(L*sin(theta),-L*cos(theta),0),radius=r,material=materials.earth,color=color.orange)rope=cylinder(frame=f,pos=(0,0,0),axis=ball.pos,radius=0.2,material=materials.rough,color=(0.5,0.,0.5))while True:rate(25)theta=theta+w*dtf.rotate(origin=(0,0,0),axis=(0,0,1),angle=w * dt)t = t + dtw = w - (math.sin(theta) + q*w - F * math.sin(2.0/3*t)) * dt





