Approximations during the numerical integration may cause deviations in g and ˙ g. Also, initial values not satisfying the conditions g = 0 and ˙ g = 0 will cause a violation of the algebraic condition. The following shows the necessary modifications to the code based on the initial example.