For a simple harmonic oscillator total energy is conserved unless friction forces are applied to the system. Essentially oscillatory motion will continue forever and energy interchanges between potential energy and kinetic energy. For vertical oscillating spring elastic pe and gravitational pe. Kinetic energy varies with time, because v(t) varies with time. Essentially velocity of harmonic motion is subbed into k = 1/2mv2. Kinetic energy is at a maximum at the minimum displacement since that is where the maximum speed occurs. The vertically oscillating spring has potential energy contributions from both gravity and elastic potential energy. The same equations can be used to describe the motion. Potential energy maximum at the extremes of the displacement maximum ke at the zero of displacement. In the torsion pendulum we have a restoring torque which acting in the opposite direction of an angular displacement. This is similar to hooke"s law (k = kappa =torsional constant)