Modelling the Motion of a Spring using Differential Equations

This is a translated excerpt from a highschool project (SRO) on this very topic.

In this post, I’ll account for a method for modelling the motion of a weight hanging freely in a spring. In this post, we’ll only consider the case, where the damping factor of the spring is 0, because that’s easier to model (in a future post, we’ll consider the case where damping factor is >0).

Looking at a weight hanging in a spring, we get the following diagram:


Since the weight is in equilibrium, the upward force from the spring must be equal to the force from the gravity. The force of gravity acting on the weight is just F = m \cdot g. According to Hooke’s Law, the force of a spring is given as F = k \cdot s, where k is some constant and s is the distance the spring has been stretched. Using this knowledge we get the identity m \cdot g = k \cdot s, which can also be expressed as m \cdot g - k \cdot s = 0.

We observe that at given time t, the upward force of the spring is k \cdot (s + x), where sis the distance to the equilibrium point, and x is the extra distance the weight has moved relative to s. This means the net force at any given time of the weight is m \cdot g - k \cdot (s + x), which is also the same as m \cdot g - k \cdot s - k \cdot x, and using our previous identity we simply get -k \cdot x.

We know the force of any given time on an object is given as F = m \cdot a. This can also be expressed as F = m \cdot \frac{d^2 \cdot x}{d \cdot t^2}. This allows us to derive that m \cdot \frac{d^{2} \cdot x}{d \cdot t^{2}} = -k \cdot x . Simplifying this expression, we get \frac{d^{2} \cdot x}{d \cdot t^{2}} + \frac{k}{m} \cdot x = 0 .

This is just a linear second-order differential equation, which we solve and allows us to get the equation describing the motion of the spring. We get s(t) = c_1 \cdot \cos(\sqrt{\frac{k}{m}} \cdot t) + c_2 \cdot \sin(\sqrt{\frac{k}{m}} \cdot t).

Great, we now have a method for describing the weight’s motion, but what about those nasty constants? We observe that s(0) = x, since the weight has been stretched a distance of x from its equilibrium, when released. This means that c_1 \cdot \cos(\sqrt{\frac{k}{m}} \cdot 0) + c_2 \cdot \sin(\sqrt{\frac{k}{m}} \cdot 0) = 0. Because \sin(0) = 0, and because the \cos(0) = 1, we get c_1 = x.

Excellent, now we’ve found c_1, but what about c_2? To do this, we look at the derivate of this function. We get \frac{d}{dt} s(t) = - c_1 \cdot \sqrt{\frac{k}{m}} \cdot \sin(\sqrt{\frac{k}{m}} \cdot t) + \sqrt{\frac{k}{m}} \cdot \cos(\sqrt{\frac{k}{m}} \cdot t). Let’s look at the initial acceleration of the weight. We get \frac{d}{dt} s(0) = - c_1 \cdot \sqrt{\frac{k}{m}} \cdot \sin(\sqrt{\frac{k}{m}} \cdot 0) + \sqrt{\frac{k}{m}} \cdot \cos(\sqrt{\frac{k}{m}} \cdot 0). Simplifying this expression we get \frac{d}{dt} s(0) = c_2 \cdot \sqrt{\frac{k}{m}}.

We now have a complete equation describing the motion of the weight:

s(t) = x \cdot \cos(\sqrt{\frac{k}{m}} \cdot t) + \frac{\frac{d}{dt} s(0)}{\sqrt{\frac{k}{m}}} \cdot \sin(\sqrt{\frac{k}{m}} \cdot t)

This is part of a high school project, which can be read here (in Danish):

Now, time for the fun part. We model this in Flash, and get the following simulation:

Here is a screenshot from the simulation:



Comment on this article

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s