The Classical Harmonic Oscillator #
i. Description #
The classical harmonic oscillator is a classical mechanical system corresponding to a
mass m
under a force - k x
where k
is the spring constant and x
is the position.
ii. Summary of the key results #
The key results in the study of the classical harmonic oscillator are the follows:
In the Basic
module:
HarmonicOscillator
contains the input data to the problem.EquationOfMotion
defines the equation of motion for the harmonic oscillator.energy_conservation_of_equationOfMotion
proves that a trajectory satisfying the equation of motion conserves energy.equationOfMotion_tfae
proves that the equation of motion of motion is equivalent to- Newton's second law,
- Hamilton's equations,
- the variational principal for the action,
- the Hamilton variation principal.
In the Solution
module:
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 content for this module #
- A. The input data
- B. The angular frequency
- C. The energies
- D. Lagrangian and the equation of motion
- E. Newton's second law
- F. Energy conservation
- G. Hamiltonian formulation
- H. Equivalences between the different formulations of the equations of motion
iiv. References #
References for the classical harmonic oscillator include:
- Landau & Lifshitz, Mechanics, page 58, section 21.
A. The input data #
We start by defining a structure containing the input data of the harmonic oscillator, and
proving basic properties thereof. The input data consists of the mass m
of the particle and the spring constant k
.
B. The angular frequency #
From the input data, it is possible to define the angular frequency ω
of the harmonic oscillator,
as √(k/m)
.
The angular frequency appears in the solutions to the equations of motion of the harmonic oscillator.
Here we both define and proof properties related to the angular frequency.
The angular frequency of the classical harmonic osscilator is positive.
The square of the angular frequency of the classical harmonic osscilator is equal to k/m
.
The angular frequency of the classical harmonic osscilator is not equal to zero.
The inverse of the square of the angular frequency of the classical harmonic osscilator
is m/k
.
C. The energies #
The harmonic oscillator has a kinetic energy determined by it's velocity and a potential energy deetermined by it's position. These combine to give the total energy of the harmonic oscillator.
Here we state and prove a number of properties of these energies.
C.1. The definitions of the energies #
We define the three energies, it is these energies which will control the dynamics of the harmonic oscillator, through the lagrangian.
The kinetic energy of the harmonic oscillator is $\frac{1}{2} m ‖\dot x‖^2$.
Equations
- S.kineticEnergy xₜ t = 1 / 2 * S.m * inner ℝ (Time.deriv xₜ t) (Time.deriv xₜ t)
Instances For
The potential energy of the harmonic oscillator is 1/2 k x ^ 2
Instances For
The energy of the harmonic oscillator is the kinetic energy plus the potential energy.
Equations
- S.energy xₜ t = S.kineticEnergy xₜ t + S.potentialEnergy (xₜ t)
Instances For
C.2. Simple equalties for the energies #
C.2. Differentiability of the energies #
On smooth trajectories the energies are differentiable.
C.3. Time derivatives of the energies #
For a general smooth trajectory (which may not satisfy the equations of motion) we can compute the time derivatives of the energies.
D. Lagrangian and the equation of motion #
We state the lagrangian, and derive from that the equation of motion for the harmonic oscillator.
D.1. The Lagrangian #
We define the lagrangian of the harmonic oscillator, as a function of phase-space. It is given by
$$L(t, x, v) := \frac{1}{2} m ‖v‖^2 - \frac{1}{2} k ‖x‖^2$$
In theory this definition is the kinetic energy minus the potential energy, however to make the lagrangian a function on phase-space we reserve this result for a lemma.
The lagrangian of the harmonic oscillator is the kinetic energy minus the potential energy.
Equations
- S.lagrangian t x v = 1 / 2 * S.m * inner ℝ v v - S.potentialEnergy x
Instances For
Part D.1.I #
Equalitites for the lagrangian. We prove some simple equalities for the lagrangian, in particular that when applied to a trajectory it is the kinetic energy minus the potential energy.
Part D.1.II #
The lagrangian is smooth in all its arguments.
Part D.1.III #
We now show results related to the gradients of the lagrangian with respect to the position and velocity.
D.2. The Euler-Lagrange operator #
We now write down the Euler-Lagrange operator for the harmonic oscillator, for a trajectory $x(t)$ this is equal to
$$t\mapsto \left.\frac{\partial L(t, \dot x (t), q)}{\partial q}\right|_{q = x(t)} - \frac{d}{dt} \left.\frac{\partial L(t, v, x(t))}{\partial v}\right|_{v = \dot x (t)}$$
Setting this equal to zero corresponds to the Euler-Lagrange equations, and thereby the equation of motion.
The Euler-Lagrange operator for the classical harmonic osscilator.
Equations
Instances For
Part D.2.I #
Basic equaltities for the Euler-Lagrange operator.
Part D.2.II #
Relation of the Euler-Lagrange operator to variational derivative of the action.
Part D.3. The equation of motion #
The equation of motion for the harmonic oscillator is given by setting the Euler-Lagrange operator equal to zero.
THe equation of motion for the Harmonic oscillator.
Equations
- S.EquationOfMotion xₜ = (S.eulerLagrangeOp xₜ = 0)
Instances For
Part D.3.I. #
We write a simple iff statment for the definition of the equation of motions.
E. Newton's second law #
We define the force of the harmonic oscillator, and show that the equation of motion is equivalent to Newton's second law.
E.1. The force #
We define the force of the harmoic oscillator as the negative gradient of the potential energy,
and show that this is equal to - k x
.
The force of the classical harmonic oscillator defined as - dU(x)/dx
where U(x)
is the potential energy.
Equations
- S.force x = -Space.grad S.potentialEnergy x
Instances For
The force on the classical harmonic oscillator is - k x
.
E.2. Euler-Lagrange operator and force #
We relate the Euler-Lagrange operator to the force, and show the relation to Newton's second law.
The Euler lagrange operator corresponds to Newton's second law.
E.3. Equation of motion if and only if Newton's second law #
We show that the equation of motion is equivalent to Newton's second law.
F. Energy conservation #
In this section we show that any trajectory satisfying the equation of motion conserves energy. This result simply follows from the definition of the energies, and their derivatives, as well as the statement that the equations of motion are equivalent to Newton's second law.
F.1. Energy conservation in terms of time derivatives #
We prove that the time derivative of the energy is zero for any trajectory satisfying the equation of motion.
F.1. Energy conservation in terms of constant energy #
We prove that the energy is constant for any trajectory satisfying the equation of motion.
G. Hamiltonian formulation #
We now turn to the Hamiltonian formulation of the harmonic oscillator. We define the canonical momentum, the Hamiltonian, and show that the equations of motion are equivalent to Hamilton's equations.
G.1. The canonical momentum #
We define the canonical momentum as the gradient of the lagrangian with respect to the velocity.
The equivalence between velocity and canonical momentum.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Part G.1.I. #
An simple equality for the canonical momentum.
G.2. The Hamiltonian #
THe hamiltonian is defined as a function of time, canonical momentum and position, as
H = ⟪p, v⟫ - L(t, x, v)
where v
is a function of p
and x
through the canonical momentum.
The hamiltonian as a function of time, momentum and position.
Equations
- S.hamiltonian t p x = inner ℝ p ((S.toCanonicalMomentum t x).symm p) - S.lagrangian t x ((S.toCanonicalMomentum t x).symm p)
Instances For
Part G.2.I. #
We prove a simple equality for the Hamiltonian, to help in computations.
Part G.2.II. #
We show that the Hamiltonian is smooth in all its arguments.
Part G.2.II. #
We now write down the graidents of the Hamiltonian with respect to the momentum and position.
G.3. Relation between Hamiltonian and energy #
We show that the Hamiltonian, when evaluated on any trajectory, is equal to the energy. This is independent of whether the trajectory satisfies the equations of motion or not.
G.3. Hamilton equation operator #
We define the operator on momentum-position phase-space whose vanishing is equivalent to Hamilton's equations.
The operator on the momentum-position phase-space whose vanishing is equivalent to the hamilton's equations between the momentum and position.
Equations
- S.hamiltonEqOp p q = ClassicalMechanics.hamiltonEqOp S.hamiltonian p q
Instances For
G.4. Equation of motion if and only if Hamilton's equations #
We show that the equation of motion is equivalent to Hamilton's equations, that is to the vanishing of the Hamilton equation operator.
H. Equivalences between the different formulations of the equations of motion #
We show that the following are equivalent statements for a smooth trajectory xₜ
:
- The equation of motion holds. (aka the Euler-Lagrange equations hold.)
- Newton's second law holds.
- Hamilton's equations hold.
- The variational principle for the action holds.
- The Hamilton variational principle holds.