Periodic orbit on a torus


Author: GC

Date: June 30, 2016

Previous Hénon map

Next Poincaré-Birkhoff points


We plot a periodic orbit of a hamiltonian system on a torus $T^2$.



Periodic orbit on a torus




Source code

#!/usr/bin/env python3.5

"""
Program to visualize a periodic orbit on a torus
"""


# Scientific libraries
from matplotlib import pyplot as plt
import numpy as np
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import proj3d


# Torus
angle = np.linspace(0, 2 * np.pi, 60)
theta1, theta2 = np.meshgrid(angle, angle)
r, R = 0.7, 1.8
X = (R + r * np.cos(theta2)) * np.cos(theta1)
Y = (R + r * np.cos(theta2)) * np.sin(theta1)
Z = r * np.sin(theta2)

# Hamiltonian system in action and angular variables
omega1 = 7
omega2 = 2
t = np.arange(0, 50, 0.01)
theta1 = omega1*t
theta2 = omega2*t
x = (R + r * np.cos(theta1)) * np.cos(theta2)
y = (R + r * np.cos(theta1)) * np.sin(theta2)
z = r * np.sin(theta1)

# figure
fig = plt.figure()
ax = fig.gca(projection = '3d')
ax.set_axis_off()
ax.set_xlim3d(-1.5, 1.5)
ax.set_ylim3d(-1.5, 1.5)
ax.set_zlim3d(-1, 1)
ax.plot_surface(X, Y, Z, color = 'yellow',alpha=0.05, rstride = 3, cstride = 3)
ax.plot(x,y,z, 'cyan')
plt.show()


Previous Hénon map

Next Poincaré-Birkhoff points