SHM of a horizontal spring
This activity belongs to the GeoGebra book The Domain of the Time.
This animation simulates simple harmonic motion (SHM) in real time, ignoring friction, of a horizontal spring. The animation uses the minimum of formulas (no trigonometry or differential calculus), only making the necessary changes in the vectors that govern the movement.
A mass m, represented by the blue point M, is at the end of a spring with a constant elasticity k. You can choose both constants within a range in the left panel.
At the start, the construction shows the blue point M at rest: the spring exerts no force on it. Drag M to the right to stretch the spring. The distance you drag it will determine the amplitude. Notice that as you drag M, the theoretical period does not change, as it does not depend on the amplitude. The reason is that with a greater amplitude, the restoring force of the spring will be stronger, so in the end M will complete each oscillation in the same amount of time (we will demonstrate this isochronism in the next activity).
This separation from the rest position will cause the spring to resist, producing an acceleration a (in green) whose direction is always towards the rest position. This acceleration is not constant, but at each position of M, it is proportional to the distance x from M to the rest point (Hooke's law).
Press the button to activate the animation. The acceleration a causes M to acquire a variable velocity v (in red). Its magnitude is proportional to the elasticity k and the distance x, and inversely proportional to the mass m. That is, |a| = k/m x.
- We know that the spring’s force is, on one hand, equal to the mass times acceleration: m |a|, and on the other hand, proportional to the distance x traveled: k x. From this, we deduce that |a| = k/m x.
SCRIPT FOR SLIDER anima
# Calculate the elapsed seconds dt; add one second if t1(1) < tt
SetValue(tt, t1(1))
SetValue(t1, First(GetTime(), 3))
SetValue(dt, (t1(1) < tt) + (t1(1) − tt)/1000)
# Move M (we use an auxiliary vector to retain the value of vt before updating the value of v)
SetValue(aux, v)
SetValue(v, v + dt a)
SetValue(M, M + dt v)
# Record the period time and the number of complete oscillations
SetValue(reg, If(x(aux) > 0 ∧ x(v) < 0, Append(t, reg), reg))
SetValue(osci, If(x(aux) > 0 ∧ x(v) < 0, osci + 1, osci))
Author of the activity and GeoGebra construction: Rafael Losada.