# Numerical schemes, time integration algorithms and energy conservation

What does it mean when someone says a numerical scheme or a time integration algorithm is "energy conserving". How can a numerical scheme "gain" or "lose" or "conserve" energy apart from the numerical diffusion that is inherent.

-
Taking a good guess: maybe they mean that iteration is unitary: i.e. if one thinks of an algorithm as the iteration of an operator on input data, that operator's eigenvalues all have unit magnitude, so that roundoff errors do not grow. For example, energy conservation in Maxwell's equations means that the operator that propagates an EM field in one plane to the next in the Beam Propagation Method is unitary, and thus Maxwell's equations are numerically "easy". – WetSavannaAnimal aka Rod Vance Sep 5 '13 at 14:19
This question certainly does not belong on Physics.SE. We explicitly disavow numeric questions. It does belong on scicomp.se, but as that is a beta site I like to ask before migrating. Understand that in my opinion the alternative to migration is simple closing. – dmckee Sep 5 '13 at 22:11

"They" are probably talking about symplectic integrators.

Most numerical integrators for (partial) differential equations do not specifically consider the energy of the system; they are generic integrators capable of solving any set of DEs, and not all DE's have a concept like "energy".

When these are applied to a classical dynamics problem concerning some conservative system, one of their error modes tends to be that that system's energy is not conserved.

Symplectic integrators are specific to classical dynamics and are designed with conservative systems in mind. They eliminate this particular error mode, and guarantee that the system's energy will be conserved.

No numerical scheme is absolutely perfect; they of course have other error modes, such as round-off error (the one you mention).

-
I'd add that even symplectic integrators don't usually conserve energy from timestep to timestep; rather they ensure that the average energy change over a large time interval is small. This is pretty obvious if you use a symplectic method to integrate a simple two body orbital problem and plot the energy as a function of time; you should see it vary periodically (same period as the orbit). – Kyle Oman Sep 5 '13 at 15:24
@Kyle and Rody have you heard the word "energy" used in this context - I'm not questioning correctness: it would be good for the OP to know whether this is what he / she is talking about. Can you cite a reference for them? – WetSavannaAnimal aka Rod Vance Sep 6 '13 at 6:07
Also, it is interesting to view a symplectic integration as a non-equilibrium process, during which the system is perturbed by the switch from the original Hamiltonian to the shadow Hamiltonian. Also, I forgot a reference for the modified Hamiltonian: citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.7.7106 – Simeon Carstens Sep 6 '13 at 8:36
Sorry for spamming the comments. I'm still a little sleepy and writing before thinking. I wanted to make clear that "for symplectic integrators, the "conserved" energy varies periodically" from my first comment is afaik only true for periodic systems. I just wanted to refer to Kyle's comment and didn't quite think it through. The rest of my comments applies to systems of all kind. – Simeon Carstens Sep 6 '13 at 8:57