The variational integrator simulates a discrete mechanical systems. Given a known state (time tk − 1, configuration qk − 1, and discrete momentum pk − 1) and inputs (force inputs uk − 1 and next kinematic configuration ρk − 1), the integrator finds the next state:
(tk − 1, qk − 1, pk − 1), (uk − 1, ρk − 1) ⇒ (tk, qk, pk)
The integrator also finds the discrete constraint force variable λk − 1.
The variational integrator finds the next state by numerically solving the constrained Discrete Euler-Langrange (DEL) equation for qk and λk − 1:
pk − 1 + D1Ld(qk − 1, qk, tk − 1, tk − 1) + fd−(qk − 1, qk, uk − 1, tk − 1, tk) − DhT(qk − 1)λ̇k − 1
h(qk) = 0
and then calculating the new discrete momentum:
pk = D2Ld(qk − 1, qk, tk − 1, tk)
In trep
, we simplify notation by letting k = 2, so that we consider t1, q1, and p1 to be the previous state, and t2, q2, and p2 to be the new or current state.
L2 = Ld(q1, q2, t1, t2)
f2± = fd±(q1, q2, u1, t1, t2)
h1 = h(q1)
h2 = h(q2)