I'm not looking for specific physics. Energy is a very broad concept even in physics that includes not only Newtonian mechanics as you linked to, but also every other physical formulation. In Newtonian mechanics, if my understanding is correct, energy is conserved because all force fields involved are gradients. Is there a similarly simple generalized reason in modern physics?
My interest is that energy is a useful tool for analyzing physical systems. So a generalization of energy might be a useful tool for analyzing some mathematical or computational systems. Entropy has been generalized via math to apply to algorithms and such, and energy is somewhat related to entropy, so perhaps there is a like generalization.
If a system is given as a set of objects and states for those objects, together with a next-state function, I think a quantity called energy would have to have the following characteristics. It would have to be defined for a given next-state function and computed from any group of objects and states under that function. It would have to be invariant for all groups of objects and states under applications of the function. And it would have to depend sensitively on the objects and states of the system, in the sense that for any object of the system, removing the object, adding a new object, or changing the state of the object in an appropriate manner will change the energy of the system.
I think may be something to be said in this context about conversion of energy from one form to another, but I am unsure.
Mathematics is simply a systematic method of describing the relationships observed in physics - mathematics is more or less the language of physics.
This is not intended as a philosophical discussion, but I take the opposite view: physics is an instance of mathematics.