When the physics problem gives the two endpoints as a position and a time, that is as events, Hamilton's action principle applies. For example, imagine planning a trip to the Moon. During your voyage the Moon will continue its orbit around the Earth: it's a moving target. Hamiltion's principle for objects at positions q ( t ) is written mathematically as ( δ δ S ) T = 0 , w h e r e S [ q ] = d e f ∫ ∫ t 1 t 2 L ( q ( t ) , q ˙ ˙ ( t ) , t ) d t . The constraint T = t 2 − − t 1 means that we only consider paths taking the same time, as well as connecting the same two points q ( t 1 ) and q ( t 2 ) . The Lagrangian L = T − − V is the difference between kinetic energy and potential energy at each point on the path. Solution of the resulting equations gives the world line q ( t ) . Starting with Hamilton's principle, the local differential Euler–Lagrange equation can be derived for systems of fixed energy. The action S in Hamilton's principle is the Legendre transformation of the action in Maupertuis' principle.