Harmonic oscillator
mass system

When a spring is stretched or compressed by a mass, the spring develops a restoring force. Hooke's law gives the relationship of the force exerted by the spring when the spring is compressed or stretched a certain length: F (t) = − k x (t), {\displaystyle F(t)=-kx(t),} where F is the force, k is the spring constant, and x is the displacement of the mass with respect to the equilibrium position. The minus sign in the equation indicates that the force exerted by the spring always acts in a direction that is opposite to the displacement (i.e. the force always acts towards the zero position), and so prevents the mass from flying off to infinity.

By using either force balance or an energy method, it can be readily shown that the motion of this system is given by the following differential equation: F (t) = − k x (t) = m d 2 d t 2 x (t) = m a, {\displaystyle F(t)=-kx(t)=m{\frac {\mathrm {d} ^{2}}{\mathrm {d} t^{2}}}x(t)=ma,} the latter being Newton's second law of motion.

If the initial displacement is A, and there is no initial velocity, the solution of this equation is given by x (t) = A cos (k m t). {\displaystyle x(t)=A\cos \left({\sqrt {\frac {k}{m}}}t\right).}

Given an ideal massless spring, m {\displaystyle m} is the mass on the end of the spring. If the spring itself has mass, its effective mass must be included in m {\displaystyle m}.
detectable_content:number_placeholders[8], combination:repeat_prompt