Just for the fun of it, I’d like to show the derivation of equations for a block of mass, , oscillating on a vertical spring with constant,
. I’m sure there are several ways to go about doing this, but I haven’t found any on the internet that do so for a general situation algebraically. So here’s the set-up we will analyze.

We will assume that a motion detector has been placed below this system, with the bottom of the block attached to the unstretched spring at position 0, the equilibrium position is at position 2 and that the origin is at the motion detector on the table below position 3. If the block is pulled up a distance to position 1 and released, we get a graph that looks like this:

Which we could represent with the general equation:
Since the amplitude is , that term can stay
. We know from math that the vertical compression term,
, is the angular velocity of the system,
. Since the graph is in phase starting from the maximum value,
is zero and can be ignored. The value of
would be how high position 2 is above the origin, which we designate as
. Therefore our equation for the vertical position as function of time would be:
If we display the graph of velocity vs. time, we see a graph that looks like this:

We can represent this equation as:
For us, the amplitude is , the period is the same as above, is the
term would be the same as for position.
and
are both zero. So the equation begins to simplify to:
From calculus, we know that:
So our final equation for velocity is:
I’m well aware that we could have done the analysis of velocity using a phase shift instead of switching from cosine to sine, as I had a professor in college that would not allow us to use the “evil” cosine function at all. However, most calculus texts show the derivative of sine as switching to cosine {and cosine to sine} over using phase shifts.
The graph of acceleration vs. time looks like this

We can represent the amplitude with the maximum acceleration, , and since it has the same phase as the other graph, can be represented as:
Since we know from calculus:
Our final equation for acceleration vs. time is:
Now to the fun of deriving the equations for energy as a function of time. We know that kinetic energy is:
If we substitute our equation for velocity from above, we get:
If we multiply out, we get:
We know from trigonometry:
If we substitute this trig identity into our equation, we get:
After multiplying through to simplify, we get:
We know the period of a mass on a spring from our experiment is:
From Unit 7, we know that at object moving in a circle at constant speed has a speed of:
From Unit 8, we learn that we can relate linear velocity to angular velocity by:
Therefore, we can say that:
Which we can simplify to:
If we now plug in our equation from the experiment in Unit 9, we get:
Which simplifies to:
If we plug this into our equation for velocity, we get:
Which simplifies to:
The graph of this would look like this:

We know that gravitational energy is:
Where represents the height above our zero position. Since we using the table as our zero,
is at zero, so:
If we plug in our equation for position vs. time from above, we get:
Which can be rewritten to give us the final equation for gravitational energy:
If we make a graph of gravitational energy vs. time we get:

We know that spring energy is:
where represents how much the spring has been deformed. For this event, that would mean:
If we substitute our equation for position vs. time, we get:
If we rearrange by grouping the position terms together, we see:
If we multiply out the squared quantity inside the brackets, we get:
Multiplying through by yields:
From trigonometry, we have the identity:
If we substitute this identity into our equation for spring energy:
If we multiply out the term at the end, and clump similar terms together, we get:
The graph of spring energy vs. time would look like this:

Since the total energy is:
We can add up the three equations to get our total energy. By looking at the graphs for each energy vs time, the combination may be distorted since they each have a different scale. If we plot all three on the same graph, with the same scale, we get something like this:

If we arrange the three equations strategically, we get:
The first thing that should jump out is the two terms at the far right, and
. They are the exact same term. Since the first has a “-” and the last has a “+”, these terms cancel out. The term in the middle, we see:
Which can be rewritten as:
If we focus in on the terms inside the square brackets we see:
The first term is the force of gravity on the block. The second term is the spring force on the block when it is at the equilibrium position, which is labelled position on the original diagram. At that position, these two forces are equal and opposite in direction, thus:
What’s left for the total energy is:
We can see that one of the terms repeats, so we can simplify this equation to be:
The second term, , represents the gravitational energy at the equilibrium position. The last term,
, represents the spring energy at the equilibrium position.
The first term, , represents the work done to lift the block from equilibrium by the amplitude
. Since all the cosine and sine terms have cancelled out, we are left with:
Thus the if we assume no dissipated energy, the total energy would remain constant over time since all three terms are each constant with respect to time.