Physlib.ClassicalMechanics.HarmonicOscillator.Solution
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
- `InitialConditions` is a structure for the initial conditions for the harmonic oscillator.
- `trajectories` is the trajectories to the harmonic oscillator for given initial conditions.
- `trajectories_equationOfMotion` proves 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 - 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 - 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.
#### 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 at `t=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.
##### 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.
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.
#### A.3.1. Simple results for the zero initial conditions
Some simple results about the zero initial conditions.
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
#### 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.
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.
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.
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.
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.
42 declarations
Equality of Initial Conditions from Initial Position and Velocity
For any two sets of initial conditions and for a classical harmonic oscillator, if their initial positions are equal () and their initial velocities are equal (), then the initial conditions themselves are equal ().
Equality of Initial Conditions at Arbitrary Time from Time, Position, and Velocity
For any two sets of initial conditions at an arbitrary time, and , if their reference times are equal (), their positions at those times are equal (), and their velocities at those times are equal (), then the initial conditions themselves are equal ().
Harmonic oscillator initial conditions at from state at
For a harmonic oscillator with angular frequency and a state specified at time by position and velocity , this function calculates the equivalent initial conditions at time . The resulting initial position and initial velocity are defined as: This conversion effectively runs the trajectory backward from to to determine the starting state.
Zero initial conditions for the harmonic oscillator
The zero initial condition for a harmonic oscillator is defined as the state where both the initial position and the initial velocity are equal to . This defines the zero element (additive identity) for the `InitialConditions` structure.
Initial position for zero initial conditions
For the zero initial conditions of a classical harmonic oscillator, the initial position is equal to . This confirms that the zero initial condition state corresponds to a particle starting at the origin.
Initial Velocity for Zero Initial Conditions
For the zero initial conditions of a classical harmonic oscillator, the initial velocity is equal to . This indicates that the zero initial condition corresponds to a state with zero starting velocity.
Trajectory of the harmonic oscillator
Given a set of initial conditions with initial position and initial velocity , the trajectory of the classical harmonic oscillator is the function that maps each time to its position in 1D Euclidean space, defined by: where is the angular frequency of the oscillator system.
Trajectory Equation
For a classical harmonic oscillator system with angular frequency and initial conditions consisting of an initial position and an initial velocity , the trajectory is given by:
The trajectory is identically zero for zero initial conditions
For a classical harmonic oscillator system with zero initial conditions (where the initial position and the initial velocity are both zero), the resulting trajectory is identically zero for all times .
The trajectory is smooth
For a classical harmonic oscillator system and a given set of initial conditions , the resulting trajectory is -times continuously differentiable () for any . That is, the trajectory is infinitely differentiable.
The Velocity of the Harmonic Oscillator Trajectory is
For a classical harmonic oscillator with angular frequency and initial conditions specifying an initial position and an initial velocity , let be the trajectory of the oscillator. The velocity at time , defined as the time derivative , is given by:
The Acceleration of the Harmonic Oscillator Trajectory is
For a classical harmonic oscillator with angular frequency and initial conditions specifying an initial position and an initial velocity , let be the trajectory of the oscillator. The acceleration at time , defined as the second time derivative , is given by:
The Position of a Harmonic Oscillator Trajectory at is
For a classical harmonic oscillator system with a given set of initial conditions , let denote the trajectory of the oscillator. If is the initial position specified in , then the position at time is .
The Velocity of a Harmonic Oscillator Trajectory at is
For a classical harmonic oscillator system with initial conditions specifying an initial position and an initial velocity , let be the trajectory of the oscillator. The velocity at time , defined as the time derivative evaluated at , is equal to the initial velocity . That is,
The Harmonic Oscillator Trajectory Satisfies the Equation of Motion
For a classical harmonic oscillator system and a given set of initial conditions specifying an initial position and an initial velocity , let be the trajectory of the oscillator. The trajectory satisfies the equation of motion of the harmonic oscillator system .
Uniqueness of the Harmonic Oscillator Trajectory
For a classical harmonic oscillator system and a given set of initial conditions specifying an initial position and an initial velocity at time , let be an infinitely differentiable () function. If satisfies the oscillator's equation of motion and the initial conditions and , then is equal to the predefined trajectory of the system, given by: where is the angular frequency of the oscillator.
The total energy of a harmonic oscillator trajectory is
For a classical harmonic oscillator system with mass and spring constant , let be the trajectory defined by the initial conditions , where is the initial position and is the initial velocity at time . The total energy of the trajectory is constant for all time and is equal to the initial energy:
for trajectory from converted initial conditions
For a harmonic oscillator and a set of conditions specifying a position and a velocity at an arbitrary time , the trajectory defined by the equivalent initial conditions at (obtained via the conversion function `toInitialConditions`) passes through the specified position at time , such that .
for trajectory from converted initial conditions
For a harmonic oscillator and a set of conditions specifying a position and a velocity at an arbitrary time , let be the trajectory defined by the equivalent initial conditions at (obtained via the conversion function `toInitialConditions`). The velocity of this trajectory at time , defined as the time derivative evaluated at , is equal to the specified velocity:
Energy at equals for the Harmonic Oscillator
Consider a classical harmonic oscillator with mass and spring constant . Let be a set of initial conditions specifying a position and a velocity at an arbitrary time . Let be the trajectory of the oscillator corresponding to these conditions. Then the total energy of the trajectory at time is given by: where denotes the norm in the oscillator's configuration space.
at times of zero velocity for the harmonic oscillator
Consider a classical harmonic oscillator with angular frequency and initial conditions given by position and velocity at time . For any time , if the velocity of the trajectory is zero (i.e., ) and the initial conditions are non-trivial ( or ), then the time satisfies the relation where and are treated as the scalar values of the position and velocity in 1D space.
The velocity of the harmonic oscillator is zero at
For a classical harmonic oscillator with angular frequency and initial conditions specifying an initial position and initial velocity at time , if the component of the initial position is non-zero, then the velocity is zero at time where and are the scalar components of the initial position and velocity vectors in 1D Euclidean space.
The velocity of a harmonic oscillator is zero if and only if
For a classical harmonic oscillator system with angular frequency and initial conditions given by position and velocity at time , let be the trajectory of the oscillator. The velocity of the trajectory at time , denoted by , is zero if and only if the norm of the position at that time satisfies: where represents the square of the maximum displacement (amplitude) of the oscillation.
The velocity of the harmonic oscillator trajectory at equals
Consider a classical harmonic oscillator with angular frequency . Let be the initial conditions determined by specifying velocities at two times and . If , then the velocity of the resulting trajectory at time is equal to the specified velocity : where denotes the time derivative of the trajectory.
Conversion from Amplitude and Phase to Initial Conditions
Given a classical harmonic oscillator with angular frequency , and initial parameters specified by an amplitude and a phase , this function defines the corresponding initial conditions at time as: These initial conditions result in a trajectory of the form .
Trajectory of the Harmonic Oscillator in Amplitude-Phase Form:
For a classical harmonic oscillator with angular frequency , if the initial conditions are specified by an amplitude and a phase , then the trajectory at any time is given by: Here, the trajectory represents the position of the oscillator in 1-dimensional Euclidean space.
Velocity of the Harmonic Oscillator in Amplitude-Phase Form:
For a classical harmonic oscillator with angular frequency , if the initial conditions are specified by an amplitude and a phase , then the velocity (the time derivative of the trajectory ) at any time is given by: This velocity is expressed as a vector in 1-dimensional Euclidean space.
Conversion of initial conditions to amplitude and phase
Given a classical harmonic oscillator with angular frequency and initial conditions specifying an initial position and initial velocity , this function calculates the corresponding amplitude and phase . The values are determined by representing the state as a complex number , where: - The amplitude is the magnitude of , i.e., . - The phase is the argument of , i.e., . These parameters allow the trajectory to be expressed in the form .
For a classical harmonic oscillator and any initial conditions (specifying initial position and velocity), converting into its amplitude-phase representation and then converting that representation back to initial conditions recovers the original .
Harmonic Oscillator Trajectory
For a classical harmonic oscillator with angular frequency , let be the initial conditions specifying an initial position and velocity . Let and be the amplitude and phase calculated from these initial conditions. Then, for any time , the trajectory is given by: where is represented as a vector in 1D Euclidean space whose single component at index 0 is the shifted cosine.
Velocity of Harmonic Oscillator
For a classical harmonic oscillator with angular frequency , let and be the amplitude and phase derived from the initial conditions . Then, for any time , the velocity of the trajectory (the time derivative of the position) is given by the following expression in 1D Euclidean space: where is the trajectory associated with the given initial conditions.
Velocity for
In a classical harmonic oscillator with angular frequency , let and be the amplitude and phase determined by the initial conditions. If the amplitude is non-zero, then the velocity of the trajectory at time is zero if and only if the sine factor in the phase-shifted expression vanishes, i.e., where represents the trajectory of the oscillator.
for non-zero amplitude
For a classical harmonic oscillator with angular frequency , let and be the amplitude and phase determined by the initial conditions. If the amplitude is non-zero, then for any time , the velocity of the trajectory is zero if and only if there exists an integer such that
The velocity if and only if for a harmonic oscillator
For a classical harmonic oscillator with angular frequency and initial conditions (initial position and initial velocity ), let be the resulting trajectory. Let be the amplitude of the oscillation. For any time , the velocity is zero if and only if the norm of the position is equal to the amplitude .
For a classical harmonic oscillator with angular frequency , let and be the amplitude and phase determined by the initial conditions. If the amplitude is non-zero, then for any time , the trajectory satisfies if and only if .
for a Harmonic Oscillator
Consider a classical harmonic oscillator with angular frequency . Let be the initial conditions of the system, with and denoting the corresponding amplitude and phase respectively, such that the trajectory is given by . Provided the amplitude is non-zero (), the position of the oscillator is zero at time if and only if there exists an integer such that:
Period of a harmonic oscillator
For a classical harmonic oscillator , the period is defined as the ratio of to the angular frequency :
Notation for the period
The definition introduces the mathematical notation to represent the period of a harmonic oscillator.
For a classical harmonic oscillator , the period and the angular frequency satisfy the relation
The period of a harmonic oscillator is positive ()
For any classical harmonic oscillator , the period is strictly positive, satisfying .
The harmonic oscillator trajectory is periodic with period
For a classical harmonic oscillator with angular frequency and period , the trajectory resulting from any set of initial conditions is a periodic function of time with period . That is, for all time , .
Return to initial state implies for the harmonic oscillator
For a classical harmonic oscillator with period , let be the trajectory with initial position and initial velocity . Assuming that the initial position and velocity are not both zero (i.e., ), if at some time the oscillator returns to its initial state such that and , then is an integer multiple of the period . That is, there exists an integer such that .
