Calculate gravitational or elastic potential energy from mass, height, gravity, or spring values for physics and engineering problems.