Give a second order ODE: $y''(t)+y(t)+g(y)=0, t>0$, with initial data $y(0)=0,y'(0)=1.$
Define $$E(t)=\frac{[y'(t)]^2}{2}+\frac{y^2(t)}{2}+\int_0^{y(t)}g(s)ds.$$
How to find a second order finite difference scheme such that $E(t)$ is conserved in the discretized level?
At first I think it should be $\frac{y_{n+1}-2y_n+y_{n-1}}{h^2}+\frac{y_{n+1}+y_{n-1}}{2}+g_n=0$, but can't be proved to be conserved.