Runge-Kutta conservation of quadratic invariants (source code)

= Runge-Kutta conservation of quadratic invariants
{c}
{title2=$b_i a_{ij}+b_j a_{ji}=b_i b_j$}

For stage states $Y_i=y_n+h\sum_ja_{ij}k_j$ and a vector field with $Y_i^Tk_i=0$, expansion of the new squared norm gives $\|y_{n+1}\|^2-\|y_n\|^2=-h^2\sum_{i,j}M_{ij}k_i^Tk_j$, where $M_{ij}=b_i a_{ij}+b_j a_{ji}-b_i b_j$. Hence $M=0$ preserves the <quadratic form> exactly for every well-defined step. The same argument with a fixed symmetric matrix in the inner product preserves any quadratic invariant of the vector field. In particular it preserves the Euclidean norm for a <skew-symmetric matrix> differential equation.