Integrate ODE with Leapfrog

93 Views Asked by At

$f:\mathbb{R}^n\to\mathbb{R}$ is a function with gradient $g(x)$ and Hessian $H(x)$.
My initial conditions are $(x_0, v_0)$. I would like to discretize this system of ODEs $$ \begin{align} \dot x(t) &= v(t) \\ \dot v(t) &= a(x(t), v(t)) && \text{where } \qquad a(t, x(t)) = - \frac{v(t)^\top H(x(t)) v(t)}{||g(x(t))||} g(x(t)) \end{align} $$ How can I do that? According to Wikipedia I could use the Leapfrog integrator, which would look like this $$ \begin{align} v_{t + \delta/2} &= v_t + \frac{\delta}{2} a(x_t, v_t) \\ x_{t + \delta} &= x_t + \frac{\delta}{2} v_{t+\delta/2} \\ v_{t + \delta} &= v_{t+\delta/2} + \frac{\delta}{2}a(x_{t+\delta}, v_{t+\delta}) \end{align} $$ However it seems that the leapfrog can't be used for cases where the acceleration depends on the velocity? Is this true? In that case, what would a good scheme look like? In the notes I am reading they use $$ \begin{align} x_{t+\delta/2} &= x_t + \frac{\delta}{2} v_t \\ v_{t+\delta} &= v_t + \delta a(x_{t+\delta/2}, v_t) \\ x_{t+\delta} &= x_{t+\delta/2} + \frac{\delta}{2}v_{t+\delta/2} \end{align} $$