I understand that the Leapfrog Integrator is used to find an integral for Newton's Laws of Motion and that the Equation of Motion are given by:
$$\frac{dx}{dt} = v$$ and $$\frac{dv}{dt} = F(x) = -\frac{dU(x)}{dx}$$
where $U(x)$ is the Potential Energy at $x$ and $F(x)$ is the force on the particle at $x$. The Leapfrog Integrator itself is:
$$x_{k + \frac{1}{2}} = x_{k} + \frac{h}{2}p_{k}$$
$$p_{k + 1} = p_{k} + hf(x_{k + \frac{1}{2}}, t + \frac{h}{2})$$
$$x_{k + 1} = x_{k + \frac{1}{2}} + \frac{h}{2}p_{k + \frac{1}{2}}$$
How would you go about finding the Equations of Motion for two particles with co-ordinates $x_{1}$ and $x_{2}$ that are connected by a string and move in two dimensions with a Potential Energy given by:
$$U(x_{1}, x_{2}) = |x_{1} - x_{2}| + |x_{1}|^4 + 3|x_{2}|^4$$
What would be the Equations of Motion be in this case? Also how do they fit into the Leapfrog Integrator provided?
Thanks!
Firstly, you define the Hamiltonian of the system, which corresponds to the total energy, that is, kinetic energy plus potential energy. In your case it reads
$H(p,q) = \frac{p^2}{2} + U(q)$,
where $p$ is the momentum and $q=\binom{x_1}{x_2}$ is the position (note that $p$ and $q$ are vectors). Then, you derive the equation of motion by computing
$\dot{p} = -\frac{\partial H}{\partial q},\quad \dot{q} = \frac{\partial H}{\partial p}$
(it could be useful to replace the absolute value $\vert x \vert$ by $\sqrt{(x)^2}$).
In this case you obtain
$\dot{q} = p, \quad \dot{p} = \frac{1}{\Vert q \Vert}q + \binom{4q_1^3}{12q_2^3} = f(q)$
Finally, you invoke the Leapfrog scheme, which reads
$$p_{k+1/2} = p_k + \frac{h}{2}f(q_k),$$ $$q_{k+1} = q_k + hp_{k+1/2},$$ $$p_{k+1} = p_{k+1/2} + \frac{h}{2}f(q_{k+1}).$$