I'm ploting the phase space of a pendulum problem using a symplectic Euler scheme.
$\qquad H = \frac{1}{2}p^2 - \cos q$, where $\dot{p}=-\sin q$ and $\dot{q}=p$
h=0.2; (*time step*)
p[0]=0.0; (*initial conditions*)
q[0]=0.5;
p[i_] := p[i] = p[i - 1] - h*Sin[q[i - 1]];
q[i_] := q[i] = q[i - 1] + h*p[i - 1] - h^2*Sin[q[i - 1]];
ListPlot[Table[{p[i], q[i]}, {i, 0, 100}], Frame -> True]
gives
Since the vector field is $2π$-periodic in q
, it is natural to consider q
as a variable on the circle $S^1$, I'd expect it to look something like
Any suggest how to do it?