Solutions to the classical harmonic oscillator #
i. Overview #
In this module we define the solutions to the classical harmonic oscillator, prove that they satisfy the equation of motion, and prove some properties of the solutions.
ii. Key results #
InitialConditionsis a structure for the initial conditions for the harmonic oscillator.trajectoriesis the trajectories to the harmonic oscillator for given initial conditions.trajectories_equationOfMotionproves that the solution satisfies the equation of motion.
iii. Table of contents #
- A. The initial conditions
- A.1. Definition of the initial conditions
- A.1.1. Extensionality lemma
- A.2. Relation to other types of initial conditions
- A.3. The zero initial conditions
- A.3.1. Simple results for the zero initial conditions
- A.1. Definition of the initial conditions
- B. Trajectories associated with the initial conditions
- B.1. The trajectory associated with the initial conditions
- B.1.1. Definitional equality for the trajectory
- B.2. The trajectory for zero initial conditions
- B.3. Smoothness of the trajectories
- B.4. Velocity of the trajectories
- B.5. Acceleration of the trajectories
- B.6. The initial conditions of the trajectories
- B.1. The trajectory associated with the initial conditions
- C. Trajectories and Equation of motion
- C.1. Uniqueness of the solutions
- D. The energy of the trajectories
- E. The trajectories at zero velocity
- E.1. The times at which the velocity is zero
- E.2. A time when the velocity is zero
- E.3. The position when the velocity is zero
- F. Some open TODOs
iv. References #
References for the classical harmonic oscillator include:
- Landau & Lifshitz, Mechanics, page 58, section 21.
A. The initial conditions #
We define the type of initial conditions for the harmonic oscillator.
The initial conditions are currently defined as an initial position and an initial velocity,
that is the values of the solution and its time derivative at time 0.
A.1. Definition of the initial conditions #
We start by defining the type of initial conditions for the harmonic oscillator.
The initial conditions for the harmonic oscillator specified by an initial position, and an initial velocity.
- x₀ : EuclideanSpace ℝ (Fin 1)
The initial position of the harmonic oscillator.
- v₀ : EuclideanSpace ℝ (Fin 1)
The initial velocity of the harmonic oscillator.
Instances For
A.1.1. Extensionality lemma #
We prove an extensionality lemma for InitialConditions.
That is, a lemma which states that two initial conditions are equal if their
initial positions and initial velocities are equal.
A.2. Relation to other types of initial conditions #
We relate the initial condition given by an initial position and an initial velocity to other specifications of initial conditions.
In this section, we implement alternative ways to specify initial conditions for the harmonic
oscillator. The standard InitialConditions type specifies position and velocity at time t=0,
but in practice it is often useful to specify initial conditions at other times or in other forms.
Currently implemented:
- Initial conditions at arbitrary time: Specify position and velocity at any time
t₀, not necessarily att=0. This is useful for problems where the natural reference time is not zero.
Future work (to be added in separate PRs) :
- Initial conditions from two positions at different times
- Initial conditions from two velocities at different times
- Amplitude-phase parametrization
All alternative forms can be converted to the standard InitialConditions type via conversion
functions, and we prove that the converted initial conditions produce trajectories that satisfy
the original specifications.
A.2.1. Initial conditions at arbitrary time #
We define a type for initial conditions specified at an arbitrary time t₀, rather than at t=0.
This is useful when the natural reference point for a problem is not at time zero.
Initial conditions for the harmonic oscillator specified at an arbitrary time t₀.
This structure allows specifying the position and velocity at any time t₀, not necessarily
at t=0. This is useful for problems where the natural reference time is not zero.
The conditions can be converted to the standard InitialConditions format (at t=0)
using the toInitialConditions function.
- t₀ : Time
The time at which the initial conditions are specified.
- x_t₀ : EuclideanSpace ℝ (Fin 1)
The position at time t₀.
- v_t₀ : EuclideanSpace ℝ (Fin 1)
The velocity at time t₀.
Instances For
A.2.1.1. Extensionality lemma #
We prove an extensionality lemma for InitialConditionsAtTime.
A.2.1.2. Conversion to standard initial conditions #
We now define the conversion from InitialConditionsAtTime to the standard InitialConditions.
The conversion works by "running the trajectory backward in time" from t₀ to 0.
Given that we know x(t₀) and v(t₀), we use the harmonic oscillator solution formula
with time-reversal to determine what x(0) and v(0) must have been.
Mathematically, if x(t) = cos(ωt)·x₀ + (sin(ωt)/ω)·v₀, then setting t = t₀:
x(t₀) = cos(ωt₀)·x₀ + (sin(ωt₀)/ω)·v₀
v(t₀) = -ω·sin(ωt₀)·x₀ + cos(ωt₀)·v₀
Solving this linear system for x₀ and v₀ gives the formulas below.
Convert initial conditions at time t₀ to standard initial conditions at t=0.
This conversion uses the harmonic oscillator solution formula with time-reversal.
The resulting InitialConditions will produce a trajectory that passes through
x_t₀ with velocity v_t₀ at time t₀.
See toInitialConditions_trajectory_at_t₀ and toInitialConditions_velocity_at_t₀ for
the correctness proofs.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The correctness proofs showing that the conversion produces the expected trajectory are given later in section D.1, after the trajectory machinery has been defined.
A.3. The zero initial conditions #
The zero initial conditions are the initial conditions with zero initial position and zero initial velocity.
In the end, we will see that this corresponds to the solution which is identically zero, i.e. the particle remains at rest at the origin.
The zero initial condition.
A.3.1. Simple results for the zero initial conditions #
Some simple results about the zero initial conditions.
The zero initial condition has zero starting point.
The zero initial condition has zero starting velocity.
B. Trajectories associated with the initial conditions #
To each initial condition we association a trajectory. We will prove some basic properties of these trajectories.
Eventually we will show that these trajectories satisfy the equation of motion, for now we can think of them as some choice of trajectory associated with the initial conditions.
B.1. The trajectory associated with the initial conditions #
Given initial conditions, the solution to the classical harmonic oscillator.
Equations
Instances For
B.1.1. Definitional equality for the trajectory #
We show a basic definitional equality for the trajectory.
B.2. The trajectory for zero initial conditions #
The trajectory for zero initial conditions is the zero function.
For zero initial conditions, the trajectory is zero.
B.3. Smoothness of the trajectories #
The trajectories for any initial conditions are smooth functions of time.
B.4. Velocity of the trajectories #
We give a simplification of the velocity of the trajectory.
B.5. Acceleration of the trajectories #
We give a simplification of the acceleration of the trajectory.
B.6. The initial conditions of the trajectories #
We show that, unsurprisingly, the trajectories have the initial conditions used to define them.
For a set of initial conditions IC the position of the solution at time 0 is
IC.x₀.
C. Trajectories and Equation of motion #
The trajectories satisfy the equation of motion for the harmonic oscillator.
C.1. Uniqueness of the solutions #
We show that the trajectories are the unique solutions to the equation of motion for the given initial conditions. This is currently a TODO.
The trajectories to the equation of motion for a given set of initial conditions are unique.
Semiformal implementation:
- One may needed the added condition of smoothness on
xhere. EquationOfMotionneeds defining before this can be proved.
D. The energy of the trajectories #
For a given set of initial conditions, the energy of the trajectory is constant, due to the conservation of energy. Here we show it's value.
D.1. Correctness of InitialConditionsAtTime conversion #
We now prove the correctness lemmas for the InitialConditionsAtTime.toInitialConditions
conversion function. These show that the conversion produces a trajectory that passes through
the specified position and velocity at the specified time.
The trajectory resulting from toInitialConditions passes through the specified
position x_t₀ at time t₀.
The trajectory resulting from toInitialConditions has the specified
velocity v_t₀ at time t₀.
The energy of the trajectory at time t₀ equals the energy computed from the
initial conditions at t₀.
E. The trajectories at zero velocity #
We study the properties of the trajectories when the velocity is zero.
E.1. The times at which the velocity is zero #
We show that if the velocity of the trajectory is zero, then the time satisfies the condition that
tan (S.ω * t) = IC.v₀ 0 / (S.ω * IC.x₀ 0)
E.2. A time when the velocity is zero #
We show that as long as the initial position is non-zero, then at
the time arctan (IC.v₀ 0 / (S.ω * IC.x₀ 0)) / S.ω the velocity is zero.
E.3. The position when the velocity is zero #
We show that the position is equal to √(‖IC.x₀‖^2 + (‖IC.v₀‖/S.ω)^2) when
the velocity is zero.
F. Some open TODOs #
We give some open TODOs for the classical harmonic oscillator.