Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct. 2, 2019
@author: nolte
Introduction to Modern Dynamics, 2nd edition (Oxford University Press, 2019)
Twist map
"""
import numpy as np
from scipy import integrate
from matplotlib import pyplot as plt
plt.close('all')
eps = 0.9
np.random.seed(2)
plt.figure(1)
for eloop in range(0,50):
rlast = np.pi*(1.5*np.random.random()-0.5)
thlast = 2*np.pi*np.random.random()
orbit = np.int(200*(rlast+np.pi/2))
rplot = np.zeros(shape=(orbit,))
thetaplot = np.zeros(shape=(orbit,))
x = np.zeros(shape=(orbit,))
y = np.zeros(shape=(orbit,))
for loop in range(0,orbit):
rnew = rlast + eps*np.sin(thlast)
thnew = np.mod(thlast+rnew,2*np.pi)
rplot[loop] = rnew
thetaplot[loop] = np.mod(thnew-np.pi,2*np.pi) - np.pi
rlast = rnew
thlast = thnew
x[loop] = (rnew+np.pi+0.25)*np.cos(thnew)
y[loop] = (rnew+np.pi+0.25)*np.sin(thnew)
plt.plot(x,y,'o',ms=1)
plt.savefig('StandMap')