Google Classroom
GeoGebraGeoGebra Classroom

Numerical Solutions to Harmonic Motion Problems

I wish to discuss the way to set up and solve harmonic motion - both simple harmonic and not - in this section. The process will look just like our previous numerical methods exercises. It will entail:
  1. Finding all the relevant forces and expressing them mathematically
  2. Setting the sum of the forces equal to mass times acceleration
  3. Solving for acceleration (v')
  4. Giving GeoGebra expressions for r', v' and having it solve them numerically

Simple Harmonic Motion Numerical Solution

There is only one force acting in a system that is simple harmonic. It is a linear restoring force. Therefore, our only force is Therefore we can write which gives us Within GeoGebra, we need to enter three statements: 1) r_x'(t,r_x,v_x)=v_x, 2) v_x'(t,r_x,v_x)=-k*r_x/m , and 3) NSolveODE({r_x',v_x'},0,{1,0},100). In the last statement I used an initial position of 1 (assumed meter), zero initial velocity and run the calculation for 100 seconds into the future. Let's see what the solution looks like.

Numerical Solution

Harmonic Motion (non-simple)

If you wish to calculate harmonic motion with a restoring force that is anything but linear, such as , the solution will still oscillate, but the position versus time will not lead to a true sinusoidal function. Adding another force that is velocity-dependent can make the motion damped. Try it out in GeoGebra.