Variational integrators are numerical integrators for Hamiltonian systems derived from the Euler–Lagrange equations of a discretized Hamilton's principle. Variational integrators are momentum-preserving and symplectic.
Consider a mechanical system with a single particle degree of freedom described by the Lagrangian
L(t,q,v)=
1 | |
2 |
mv2-V(q),
where
m
V
\begin{align} Ld(t0,t1,q0,q1)&=
t1-t0 | |
2 |
\left[L\left(t0,q0,
q1-q0 | |
t1-t0 |
\right)+L\left(t1,q1,
q1-q0 | |
t1-t0 |
\right)\right]\\ & ≈
t1 | |
\int | |
t0 |
dtL(t,q(t),v(t)). \end{align}
Here we have chosen to approximate the time integral using the trapezoid method, and we use a linear approximation to the trajectory,
q(t) ≈
q1-q0 | |
t1-t0 |
(t-t0)+q0
between
t0
t1
v ≈ \left(q1-q0\right)/\left(t1-t0\right)
Ld(t0,t1,q0,q1)=
t1 | |
\int | |
t0 |
dtL(t,q(t),v(t))+l{O}(t1-
2, | |
t | |
0) |
our integrator will be second-order accurate.
Evolution equations for the discrete system can be derived from a stationary-action principle. The discrete action over an extended time interval is a sum of discrete Lagrangians over many sub-intervals:
Sd=Ld(t0,t1,q0,q1)+Ld(t1,t2,q1,q2)+ … .
The principle of stationary action states that the action is stationary with respect to variations of coordinates that leave the endpoints of the trajectory fixed. So, varying the coordinate
q1
\partialSd | |
\partialq1 |
=0=
\partial | |
\partialq1 |
Ld\left(t0,t1,q0,q1\right)+
\partial | |
\partialq1 |
Ld\left(t1,t2,q1,q2\right).
Given an initial condition
(q0,q1)
(t0,t1,t2)
q2
q2=q1+
t2-t1 | |
t1-t0 |
(q1-q0)-
(t2-t0)(t2-t1) | |
2m |
d | |
dq1 |
V(q1).
We can write this in a simpler form if we define the discrete momenta,
p0\equiv-
\partial | |
\partialq0 |
Ld(t0,t1,q0,q1)
and
p1\equiv
\partial | |
\partialq1 |
Ld(t0,t1,q0,q1).
Given an initial condition
(q0,p0)
q1
p1
q1=q0+
t1-t0 | |
m |
p0-
| |||||||||||||
2m |
d | |
dq0 |
V(q0)
and
p1=m
q1-q0 | |
t1-t0 |
-
t1-t0 | |
2 |
d | |
dq1 |
V(q1).
This is a leapfrog integration scheme for the system; two steps of this evolution are equivalent to the formula above for
q2