This study focuses on the motion of a mass-spring system undergoing simple harmonic motion (SHM) in the absence of damping. Such a system exhibits oscillatory motion, where the restoring force of the spring is proportional to the position
x(t)
, as described by Hooke's law:
F(t)=-kx(t)
, where
k
is the spring constant. The governing equation of motion is derived from Newton's second law:
m
2
d
x
d
2
t
=-kx(t)
(1)
where
m
is the mass of the block. Dividing through by
m
, this simplifies to:
2
d
x
d
2
t
=-
2
ω
x(t)
(2)
where
ω=
k/m
is the angular frequency of the system. The solution to this equation depends on the initial conditions, including the initial position
x(0)=
x
0
and the initial velocity
x'(0)=
v
0
. Let us begin by creating a graphical representation of a mass-spring system.
Design static elements (wall, ground, boards) and create an oscillating spring with an attached mass:
Create a 3D visualization showing the stretched spring, mass, labeled axis, and initial conditions for the given system:
In[16]:=
Show
Out[16]=
Extract and assign the value of ϕ using Chop to eliminate any numerical noise:
Formulate the position, velocity, and acceleration as time-dependent functions:
Set frame ticks, axes labels, and labels for position, velocity, and acceleration:
Formulate the kinetic and potential energies as time-dependent functions:
Generate a plot of kinetic energy and potential energy versus time, including labeled axes, legends, and grid lines for clarity:
Use Manipulate to dynamically display the spring-mass system, energies, position, velocity, and acceleration plots, along with a time slider to track real-time changes over one period: