- #1

- 36

- 0

## Homework Statement

Numerically determine the period of oscillations for a harmonic oscillator using the Euler-Richardson algorithm. The equation of motion of the harmonic oscillator is described by the following:

[itex]\frac{d^{2}}{dt^{2}} = - \omega^{2}_{0}x[/itex]

The initial conditions are x(t=0)=1 and v(t=0)=0 (i.e., position at time zero = 1 and velocity at time zero = 0) and [itex]\omega_{0} = 1[/itex].

## Homework Equations

Euler-Richardson algorithm:

- [itex]a_{n} = \frac{dv}{dt}[/itex]
- [itex]V_{mid}=V_{n}+\frac{a_{n}Δt}{2}[/itex]

- [itex]X_{mid}=X_{n}+\frac{V_{n}Δt}{2}[/itex]

- [itex]a_{mid}=a_{n}+\frac{a_{n}Δt}{2}[/itex]

- [itex]X_{n+1} = X_{n}+{V_{mid}Δt}{2}[/itex]

- [itex]V_{n+1} = V_{n}+{a_{mid}Δt}{2}[/itex]

Where X, V and a are the position, velocity and acceleration, respectively.

## The Attempt at a Solution

I have already written a Matlab programme to numerically solve the differential equation describing the motion using the above algorithm. I used:

[itex]\frac{dx}{dt} = 0[/itex]

[itex]\frac{dv}{dt} = 1[/itex]

However, the only thing is, I don't know how to determine the period numerically from this.