x0 = a*(1+e) # initial position y0 = 0 vx0 = 0 # initial velocity vy0 = (M1*(1-e)/x0)**.5 """ Set initial conditions 0.025 to right of L4 point # lp = 4 # x0 = LP(lp,1) + 0.024 # y0 = LP(lp,2) # v = math.sqrt(x0**2+y0**2)*omega # th = math.atan2(y0,x0) # vx0 = v * math.cos(th+pi/2) # vy0 = v * math.sin(th+pi/2) """ NP = 1 # number of test particles = 1 # Set plotting flags for integrator rotatingFlag = True animateFlag = True trailFlag = True flags = (rotatingFlag, animateFlag, trailFlag) # plotting flags # Integrate vals = integrator([M1, M2], [x0, y0], [vx0, vy0], times, flags) # extract time, positions and velocities of test particle(s) t = vals[:,0] pos = vals[:,1:2*NP] vel = vals[:,2*NP+1:4*NP]
# th = math.atan2(y0,x0) # vx0 = v * math.cos(th+math.pi/2) # vy0 = v * math.sin(th+math.pi/2) NP = 2 # number of test particles = 2 ########## Set plotting flags for integrator rotatingFlag = True animateFlag = False trailFlag = True PoincareFlag = False flags = [rotatingFlag, animateFlag, trailFlag, PoincareFlag] # plotting flags ########## Integrate vals = integrator([M1, M2], [x0, y0, x0, y0 - 1e-8], [vx0, vy0, vx0, vy0], times, flags) t = vals[:, 0] pos = vals[:, 1:2 * NP] vel = vals[:, 2 * NP + 1:4 * NP] ########## Plot Lyapunov exponents as a function of integration time plt.subplot(1, 2, 1) d0 = math.sqrt((pos[0, 0] - pos[0, 2])**2 + (pos[0, 1] - pos[0, 3])**2) d = math.sqrt((pos[:, 0] - pos[:, 2])**2 + (pos[:, 1] - pos[:, 3])**2) gamma = math.log(d / d0) / t plt.loglog(t, gamma, 'b-') plt.ylabel('\lambda') plt.xlabel('time') plt.title(
x0 = a*(1+e) # initial position y0 = 0 vx0 = 0 # initial velocity vy0 = (M1*(1-e)/x0)**.5 """ Set initial conditions 0.025 to right of L4 point # lp = 4 # x0 = LP(lp,1) + 0.024 # y0 = LP(lp,2) # v = math.sqrt(x0**2+y0**2)*omega # th = math.atan2(y0,x0) # vx0 = v * math.cos(th+pi/2) # vy0 = v * math.sin(th+pi/2) """ NP = 1 # number of test particles = 1 # Set plotting flags for integrator rotatingFlag = True animateFlag = True trailFlag = True flags = (rotatingFlag, animateFlag, trailFlag) # plotting flags # Integrate vals = integrator(np.array([M1, M2]), np.array([x0, y0]), np.array([vx0, vy0]), times, flags) # extract time, positions and velocities of test particle(s) t = vals[:,0] pos = vals[:,1:2*NP] vel = vals[:,2*NP+1:4*NP]