 The work of gravity on a body moving along a trajectory r(t) = ("x"(t), "y"(t), "z"(t)), such as the track of a roller coaster is calculated using its velocity, v=("v"x, "v"y, "v"z), to obtain
where the integral of the vertical component of velocity is the vertical distance.The work of gravity depends only on the vertical movement of the curve r(t).A horizontal spring exerts a force F = (−"kx", 0, 0) that is proportional to its deformation in the axial or "x" direction.