num::ode::debug::verify_symplectic_2form¶
Defined in header <ode/debug.hpp>
template <class Step>
void verify_symplectic_2form(
Step &&step, const vec<real> &q0, const vec<real> &p0, real h, real tol = 1e-6,
std::source_location loc = std::source_location::current());
Verify that one step preserves the symplectic 2-form \(\omega = dq \wedge dp\).
Two tangent vectors are propagated by finite differences, and their pairing \(\omega(u,v) = \delta q_u \cdot \delta p_v - \delta q_v \cdot \delta p_u\) must be unchanged.
Parameters¶
step: Callable(const vec<real> &q, const vec<real> &p, real h, vec<real> &q1, vec<real> &p1).q0: Position at which to test.p0: Momentum at which to test.h: Step size.tol: Relative tolerance on the preserved form.loc: Call site reported in the diagnostic.