I am having some trouble obtaining the elastic potential energy and gravitational potential energy of a simple mass spring system.
In this experiment, masses attached to a spring were dropped from a position in which the spring had not be extended. For example, the 20g mass had an equilibrium position of $y=-34.00cm$ and it reached a maximum vertical displacement of $y=-35.83cm$.
Based on this, I found the amplitude of oscillation to be $17.92cm$
Then, using the spring constant and the mass, I determined the natural frequency: $\omega=21.21 rad{\cdot}s^{-1}$
I was able to create the following inital value problem: $$y(t)=c_{1}\cos({\omega}t) + c_{2}\sin({\omega}t)$$ $$y(0)=0$$ $$A=17.92\times 10^{-3}m$$
I solved it by To begin the solution considering the case $y=0$: $$y(t)=c_{1}cos(({\omega})(0)) + c_{2}sin(({\omega})(0))$$
$$y(0)=c_{1}$$
$$0=c_{1}$$
Now, I used the amplitude to determine that $c_{2}=17.91\times 10^{-3}$
Skipping a few simple steps, I created to the following function:
$$y(t)=17.92\times 10^{-2}\cos(21.21t)-17.92\times 10^{-2}$$
Now, onto the elastic potential energy,
$$E_{e}=\frac{k\times y(t)^2}{2}$$
$$E_{e}=\frac{(9)(17.92\times 10^{-2}\cos(21.21t)-17.92\times 10^{-3})^2}{2}$$
$$E_{e}=0.15-0.29 \cos(21.21 t)+0.14 \cos^2(21.21 t)$$
This function does not at all resemble what it should look like, a simple periodic function.
I have a feeling that my problem is due to my assigned coordinate system.
Any help at all would be immensely appreciated.

