Spring Motion Applet
This applet calculates and animates the position of a spring in motion. You will find some input examples below the applet.
Size: | Larger | Large | Default |
(Resolution) | (1150 x 800) | (1000 x 700) | (850 x 600) |
This spring motion applet was created by student Malcolm Kotok, as part of an interdisciplinary directed study, under the guidance of professors Aaron Heap (Mathematics) and Doug Baldwin (Computer Science) at SUNY Geneseo. The ultimate goal of the directed study was to create an applet that illustrates the motion of a spring, modeled by a second-order differential equation known as the Model of Harmonic Motion:
m x'' + d x' + k x = f(t) |
If an object of mass m > 0 is attached to a spring and set in motion, its vertical position x(t) at any time t is affected by several forces. In addition to gravity, there is the spring force, damping force (such as air resistance), and a possible external force. Controlling these forces are the spring constant k > 0, the damping constant d ≥ 0, and an external forcing function f(t).
The original version of the program (found here) did not allow for an external forcing term, which led to a homogeneous differential equation that is easily solved. That applet had an extra feature of actually providing the solution to the differential equation, which would be a function representing the position of the object hanging from the spring as time goes by. The current version does not provide an explicit formula for the solution to the differential equation, but does provide a graph of the solution.
To use the applet, simply input the constants m > 0, d ≥ 0, and k > 0. You may also input almost any type of function (using t as a variable) in the text box on the right-hand side of the differential equation. You can also change the initial conditions t0, x0, and v0 or the window size for the graph. After inputting the values you want to use, hit the 'SOLVE' button to plot the solution and hit the 'Animate' button to set the spring in motion.
Here we provide a few simple examples to help you get started. For each of these, you can use the default initial conditions t0 = 0, x0 = 5, and v0 = 0.
Example 1: Let's begin by using m = 5, d = 1, k = 10, and no external forcing term (f(t) = 0.) This is a simple example of underdamped motion. If we change the damping constant to d = 15, we get an example that is overdamped.
Now we consider some nontrivial external forces by entering various functions into the box on the right-hand side of the differential equation, creating an inhomogeneous differential equation.
Example 2: Use m = 5, d = 1, and k = 10, but this time use an external force f(t) = sin t. Notice how the external force affects the motion of the spring and actually allows the oscillation to continue indefinitely and eventually maintain a steady amplitude. If you check the box labeled "Forcing Term" below the graph, the forcing term will also be plotted, and we can see that eventually the oscillation of the spring coincides with the oscillation of the external force. Now change the spring constant to k = 5 and notice how the behavior of the spring changes.
We can also have an external forcing term that is a piecewise continuous function. We can obtain the unit step function at t = a, often denoted as ua(t), using step(t-a).
Example 3: Use m = 5, d = 1, and k = 10. We can use a simple step function such as f(t) = 3step(t-25), or we can obtain other piecewise continuous functions such as f(t) = sin(t-35)step(t-35). Again, notice how the external force affects the motion of the spring in each case. Also notice how the behavior changes slightly if we change the spring constant to k = 5.
Example 4: Use m = 5, d = 1, and k = 5, and try each of the following external forcing terms: