**Simple Harmonic Oscillator Using Difference Calculus**

The Simple Harmonic Oscillator is a famous system in physics. Its equation of motion is written as a second order differential equation which is then solved to give the characteristic "wave" solution. But there's an alternate method which does not need differential equations!

Consider a function of an integer variable defined by this..

f(n)=k*f(n-1)-f(n-2)

where n=2,3,4,5,.. and k is a constant.

If k, f(0) and f(1) are given then f(n) can be calculated for any n.

This equation is an example of a difference equation. An area of mathematics called the Theory of Finite Differences or Difference Calculus tells how to solve these equations. The solution is a nice surprise..

f(n)=sin(n*a)

It's the famous sine function, where a is a constant and k=2*cos(a). So the solution is a wave? Yes, if you plot f(n) for n=2,3,4,5,... you get the beautiful sine wave, and the three numbers k, f(0) and f(1) determine the amplitude, wavelength and phase of the wave.

What about n? It plays the role of time, because at time=n the function f(n) is the displacement from the origin for a Simple Harmonic Oscillator.

So the difference equation f(n)=k*f(n-1)-f(n-2) replaces the second order differential equation used to describe the Simple Harmonic Oscillator. It's a nice example of Difference Calculus in action.

Of course, you may have noticed that things are not exactly the same.. time is no longer a continuous variable!

Content written and posted by Ken Abbott abbottsystems@gmail.com