Skip to content

When does a polynomial fitted to a trajectory give a conserved quantity for the whole system? For a harmonic oscillator a quadratic fit recovers the energy. A cubic candidate passes every observation on the same training orbit and fails on a second orbit of the very same equation. Coupling in another oscillator then tests a different claim about the transfer of the genuine energy integral.

Required background. Density searches explains a bounded polynomial ansatz. Jacobi checks fixes the sign of a Hamiltonian time derivative.

Choose unit masses and dimensionless canonical variables. For an uncoupled oscillator x˙=p, p˙=−x\dot x=p,\ \dot p=-x fit

I(x,p)=ap2/2+bx2/2+cxp. I(x,p)=a p^2/2+b x^2/2+c xp .

On a sampled state the row of the derivative design matrix MM is (pp˙,xx˙,px˙+xp˙)(p\dot p,x\dot x,p\dot x+x\dot p). A candidate invariant gives a vector of coefficients in its nullspace. A constant basis function would give a zero column for any dynamics, so omit it. Sample the exact trajectory x=cos⁡t,p=−sin⁡tx=\cos t,p=-\sin t at t=2πj/32t=2\pi j/32, 0≤j<320\le j\lt32, with analytic derivatives. Kaiser, Kutz and Brunton, §IV-A, Eqs. (12)–(16), derivative library and zero-eigenvalue nullspace

The three columns are the sampled functions 12sin⁡(2t)\tfrac12\sin(2t), −12sin⁡(2t)-\tfrac12\sin(2t) and −cos⁡(2t)-\cos(2t). Discrete sine and cosine are orthogonal on this grid and each has squared norm 1616. Thus

MTM=(4−40−4400016).M^\mathsf{T}M=\begin{pmatrix} 4&-4&0\\-4&4&0\\0&0&16 \end{pmatrix}.

Its eigenvalues give the exact singular values 4,22,04,2\sqrt2,0 of MM. In binary64 the companion finds a smallest singular value of order 10−1610^{-16}. Normalizing its right singular vector by the first coefficient gives (1,1,0)(1,1,0) within 10−1510^{-15}. The same calculation on noisy measurements would also pick up errors in the estimated derivatives.

Test a second energy shell without changing the force

Section titled “Test a second energy shell without changing the force”

Freeze the fitted coefficients. Change the amplitude to 1.71.7 and shift the sample times by 0.1730.173. The maximum absolute derivative on these withheld data is about 7.3×10−167.3\times10^{-16} in the recorded calculation. For the exact vector (1,1,0)(1,1,0) conservation follows for all initial conditions, since the derivative of the general quadratic is (b−a)xp+c(p2−x2)(b-a)xp+c(p^2-x^2).

Why change the amplitude if more time samples are cheap? Suppose the candidate library also contains linear and cubic terms. It can then represent

J=x(x2+p2−1),J˙=p(x2+p2−1).J=x(x^2+p^2-1),\qquad \dot J=p(x^2+p^2-1).

The second formula uses ddt(x2+p2)=0\frac{d}{dt}(x^2+p^2)=0. On the training circle JJ and J˙\dot J vanish at every phase. On the withheld orbit the same candidate has J=3.213cos⁡tJ=3.213\cos t and J˙=−3.213sin⁡t\dot J=-3.213\sin t, where tt is phase measured from the positive xx axis. In particular, both orbits go through a point with x=0x=0 and J=0J=0. Measuring the slope there immediately distinguishes them. The figure follows the full phase dependence, with time in units of inverse angular frequency.

The cubic candidate is zero through the whole training orbit. On the withheld orbit it ranges from minus to plus 3.213, crossing zero with nonzero slope at a quarter period.

The candidate JJ along two exact uncoupled oscillator trajectories, parameterized by t/(2π)t/(2\pi) over one period. The dashed line uses radius 11, and the solid curve uses radius 1.71.7. The dots mark the common value at a quarter period. The plotted candidate, phase and radii are dimensionless.

Change the Hamiltonian and predict the failure

Section titled “Change the Hamiltonian and predict the failure”

Now take

Hλ=(p12+x12)/2+(p22+2x22)/2+λx1x2. H_\lambda=(p_1^2+x_1^2)/2+(p_2^2+2x_2^2)/2+\lambda x_1x_2 .

For ∣λ∣<2|\lambda|\lt\sqrt2 the quadratic potential is positive definite. Embed the first oscillator’s fitted I1=(p12+x12)/2I_1=(p_1^2+x_1^2)/2 unchanged. Its derivative is −λp1x2-\lambda p_1x_2. On the test state (x1,p1,x2,p2)=(0,1,1,0)(x_1,p_1,x_2,p_2)=(0,1,1,0) it is −0.10-0.10 for λ=0.10\lambda=0.10 and −0.05-0.05 for λ=0.05\lambda=0.05. These signs and ratios follow from the equations of motion. The derivative would vanish at a turning point with p1=0p_1=0, so samples confined to such points provide a weak test even of the changed system. The total Hamiltonian is conserved because the changes in the two oscillator energies cancel the derivative of λx1x2\lambda x_1x_2. Reproduce the fit, the false candidate and the coupling scan (Python)

The fitted first energy is therefore an exact integral of the original oscillator and fails as an integral of the coupled model. The coupled quadratic model can itself be diagonalized in normal coordinates. Losing a proposed integral tests that particular expression; determining integrability of the new dynamics requires examining the integrals suited to it.

  • Kaiser, E., J. N. Kutz, and S. L. Brunton (2018). “Discovering Conservation Laws from Data for Control.” 2018 IEEE Conference on Decision and Control, 6415–6421. DOI.