How much energy is stored in an object undergoing SHM?

For the pendulum example (i.e. the swing), this depends on how far the bob is from its lowest point.  When at the highest point, KE=0 and PE=maximum or mgh.  When the bob is at its lowest point, KE=max and PE=0.  So the total energy of the object is PE+KE... mgh+mv2/2.
For the spring, the amount of potential energy depends on the spring constant and the displacement; given by kx2/2., so the total energy of the object is kx2/2+mv2/2.


A spring with k=2000N/m is loaded with a 50Kg mass.  How much energy goesinto stretching the spring? (remember spring force=-kx)
The amount of energy depends on the extension of the spring, so we find this first...
x = f/k = (50Kg*9.8m/s/s)/(2000N/m) = .245m
The mass is just hanging in this question, not oscillating, so the energy is just the PE,
PE=mgh=50Kg*9.8m/s/s*.245m=120J


The mass from the above question is tugged downward .2m and released.  How fast does it go?
The mass will reach its maximum speed as it crosses the equilibrium point; assume that's what we are asked to find.
Since the KE maximum corresponds to the PE minimum, we see that the PE goesinto the KE, and the transfer is 100% at that point...
PE=KE
kx2/2=mv2/2..... kx2=mv2.....v=sqrt(kx2/m) = sqrt(2000N/m*.2m2/50Kg)=1.3m/s