Imports
/- Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Tooby-Smith, Lode Vermeulen -/ module public import Physlib.ClassicalMechanics.EulerLagrange public import Physlib.ClassicalMechanics.HamiltonsEquations public import Mathlib.Algebra.Order.Archimedean.Real.Hom

The Classical Harmonic Oscillator

i. Overview

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.

In this file, a coordinate system is assumed where position and velocity both have type EuclideanSpace ℝ (Fin 1). This is a simpler model often used for pedagogical purpose, but only works because both the configuration space (position) and its tangent space (velocity) are isomorphic to Euclidean Space. A proper formalisation should include the geometric properties of the state space via manifolds and tangent bundles.

ii. 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 contents

    A. The input data

    B. The angular frequency

    C. The energies

      C.1. The definitions of the energies

      C.2. Simple equalities for the energies

      C.3. Differentiability of the energies

      C.4. Time derivatives of the energies

    D. Lagrangian and the equation of motion

      D.1. The Lagrangian

        D.1.1. Equalities for the lagrangian

        D.1.2. Smoothness of the lagrangian

        D.1.3. Gradients of the lagrangian

      D.2. The variational derivative of the action

        D.2.1. Equality for the variational derivative

      D.3. The equation of motion

        D.3.1. Equation of motion if and only if variational-gradient of Lagrangian is zero

    E. Newton's second law

      E.1. The force

        E.1.1. The force is equal to - k x

      E.2. Variational derivative of lagrangian and force

      E.3. Equation of motion if and only if Newton's second law

    F. Energy conservation

      F.1. Energy conservation in terms of time derivatives

      F.2. Energy conservation in terms of constant energy

    G. Hamiltonian formulation

      G.1. The canonical momentum

        G.1.1. Equality for the canonical momentum

      G.2. The Hamiltonian

        G.2.1. Equality for the Hamiltonian

        G.2.2. Smoothness of the Hamiltonian

        G.2.3. Gradients of the Hamiltonian

      G.3. Relation between Hamiltonian and energy

      G.4. Hamilton equation operator

      G.5. Equation of motion if and only if Hamilton's equations

    H. Equivalences between the different formulations of the equations of motion

iv. References

References for the classical harmonic oscillator include:

    Landau & Lifshitz, Mechanics, page 58, section 21.

@[expose] public sectionTODO "Create a new file for the geometric model which properly models the position as a configuration space and velocity as its tangent space, then show explicitly how this coordinate model is a simplification of the geometric model. A nice reference for such an analysis is: https://web.williams.edu/Mathematics/it3/texts/var_noether.pdf"

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.

The classical harmonic oscillator is specified by a mass m, and a spring constant k. Both the mass and the string constant are assumed to be positive.

The mass of the harmonic Oscillator.

The spring constant of the harmonic oscillator.

structure HarmonicOscillator where m : k : m_pos : 0 < m k_pos : 0 < k
@[simp] lemma k_ne_zero : S.k 0 := S.k_pos.ne'@[simp] lemma m_ne_zero : S.m 0 := S.m_pos.ne'

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 prove properties related to the angular frequency.

The angular frequency of the classical harmonic oscillator is positive.

@[simp] lemma ω_pos : 0 < S.ω := sqrt_pos.mpr (div_pos S.k_pos S.m_pos)

The square of the angular frequency of the classical harmonic oscillator is equal to k/m.

lemma ω_sq : S.ω^2 = S.k / S.m := sq_sqrt (div_pos S.k_pos S.m_pos).le

The angular frequency of the classical harmonic oscillator is not equal to zero.

lemma ω_ne_zero : S.ω 0 := S.ω_pos.ne'

The inverse of the square of the angular frequency of the classical harmonic oscillator is m/k.

All goals completed! 🐙

C. The energies

The harmonic oscillator has a kinetic energy determined by it's velocity and a potential energy determined 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.

C.2. Simple equalities for the energies

lemma kineticEnergy_eq (xₜ : Time EuclideanSpace (Fin 1)) : kineticEnergy S xₜ = fun t => (1 / (2 : )) * S.m * ∂ₜ xₜ t, ∂ₜ xₜ t⟫_:= S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)S.kineticEnergy xₜ = fun t => 1 / 2 * S.m * ∂ₜ xₜ t, ∂ₜ xₜ t⟫_ All goals completed! 🐙lemma potentialEnergy_eq (x : EuclideanSpace (Fin 1)) : potentialEnergy S x = (1 / (2 : )) S.k x, x⟫_:= S:HarmonicOscillatorx:EuclideanSpace (Fin 1)S.potentialEnergy x = (1 / 2) S.k x, x⟫_ All goals completed! 🐙lemma energy_eq (xₜ : Time EuclideanSpace (Fin 1)) : energy S xₜ = fun t => kineticEnergy S xₜ t + potentialEnergy S (xₜ t) := S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)S.energy xₜ = fun t => S.kineticEnergy xₜ t + S.potentialEnergy (xₜ t) All goals completed! 🐙

C.3. Differentiability of the energies

On smooth trajectories the energies are differentiable.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜDifferentiable fun t => 1 / 2 * S.m * ∂ₜ xₜ t, ∂ₜ xₜ t⟫_ All goals completed! 🐙S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜhd:Differentiable xₜDifferentiable fun t => S.potentialEnergy (xₜ t) S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜhd:Differentiable xₜDifferentiable fun t => (1 / 2) S.k xₜ t, xₜ t⟫_ All goals completed! 🐙S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜDifferentiable fun t => S.kineticEnergy xₜ t + S.potentialEnergy (xₜ t) All goals completed! 🐙

C.4. 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.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜt:Timehd:DifferentiableAt (∂ₜ xₜ) t(1 / 2 * S.m) (∂ₜ xₜ t, ∂ₜ (∂ₜ xₜ) t⟫_ + ∂ₜ (∂ₜ xₜ) t, ∂ₜ xₜ t⟫_) = ∂ₜ xₜ t, S.m ∂ₜ (∂ₜ xₜ) t⟫_ S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜt:Timehd:DifferentiableAt (∂ₜ xₜ) t2⁻¹ * S.m * (∂ₜ xₜ t, ∂ₜ (∂ₜ xₜ) t⟫_ + ∂ₜ xₜ t, ∂ₜ (∂ₜ xₜ) t⟫_) = S.m * ∂ₜ xₜ t, ∂ₜ (∂ₜ xₜ) t⟫_ All goals completed! 🐙S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜt:Timehd:DifferentiableAt xₜ t(1 / 2 * S.k) (xₜ t, ∂ₜ xₜ t⟫_ + ∂ₜ xₜ t, xₜ t⟫_) = ∂ₜ xₜ t, S.k xₜ t⟫_ S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜt:Timehd:DifferentiableAt xₜ t2⁻¹ * S.k * (xₜ t, ∂ₜ xₜ t⟫_ + xₜ t, ∂ₜ xₜ t⟫_) = S.k * xₜ t, ∂ₜ xₜ t⟫_ All goals completed! 🐙S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜt:Time(fderiv (S.kineticEnergy xₜ) t + fderiv (fun t => S.potentialEnergy (xₜ t)) t) 1 = ∂ₜ xₜ t, S.m ∂ₜ (∂ₜ xₜ) t + S.k xₜ t⟫_ All goals completed! 🐙

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.

set_option linter.unusedVariables false in@[nolint unusedArguments] noncomputable def lagrangian (t : Time) (x : EuclideanSpace (Fin 1)) (v : EuclideanSpace (Fin 1)) : := 1 / (2 : ) * S.m * v, v⟫_ - S.potentialEnergy x
D.1.1. Equalities for the lagrangian

Equalities 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.

set_option linter.unusedVariables false in @[nolint unusedArguments] lemma lagrangian_eq : lagrangian S = fun t x v => 1 / (2 : ) * S.m * v, v⟫_ - 1 / (2 : ) * S.k * x, x⟫_ := S:HarmonicOscillatorS.lagrangian = fun t x v => 1 / 2 * S.m * v, v⟫_ - 1 / 2 * S.k * x, x⟫_ S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)v:EuclideanSpace (Fin 1)S.lagrangian t x v = 1 / 2 * S.m * v, v⟫_ - 1 / 2 * S.k * x, x⟫_ All goals completed! 🐙lemma lagrangian_eq_kineticEnergy_sub_potentialEnergy (t : Time) (xₜ : Time EuclideanSpace (Fin 1)) : lagrangian S t (xₜ t) (∂ₜ xₜ t) = kineticEnergy S xₜ t - potentialEnergy S (xₜ t) := S:HarmonicOscillatort:Timexₜ:Time EuclideanSpace (Fin 1)S.lagrangian t (xₜ t) (∂ₜ xₜ t) = S.kineticEnergy xₜ t - S.potentialEnergy (xₜ t) All goals completed! 🐙
D.1.2. Smoothness of the lagrangian

The lagrangian is smooth in all its arguments.

S:HarmonicOscillatorn:ℕ∞ωContDiff n fun t x v => 1 / 2 * S.m * v, v⟫_ - 1 / 2 * S.k * x, x⟫_ All goals completed! 🐙lemma toDual_symm_innerSL (x : EuclideanSpace (Fin 1)) : (InnerProductSpace.toDual (EuclideanSpace (Fin 1))).symm (innerSL x) = x := (InnerProductSpace.toDual (EuclideanSpace (Fin 1))).symm_apply_apply xx:EuclideanSpace (Fin 1)y:EuclideanSpace (Fin 1)x, (fderiv (fun x => x) x) y⟫_ + (fderiv (fun x => x) x) y, x⟫_ = 2 x, y⟫_ All goals completed! 🐙All goals completed! 🐙
D.1.3. Gradients of the lagrangian

We now show results related to the gradients of the lagrangian with respect to the position and velocity.

private lemma gradient_add_const' {f : EuclideanSpace (Fin 1) } {c : } (x : EuclideanSpace (Fin 1)) : gradient (fun y => f y + c) x = gradient f x := congrArg (InnerProductSpace.toDual (EuclideanSpace (Fin 1))).symm (fderiv_add_const c)S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)v:EuclideanSpace (Fin 1)h_eq:(fun y => S.lagrangian t y v) = fun y => -(1 / 2) * S.k * y, y⟫_ + 1 / 2 * S.m * v, v⟫_(2 * (-(1 / 2) * S.k)) x = -S.k x All goals completed! 🐙S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)v:EuclideanSpace (Fin 1)h_eq:(fun y => S.lagrangian t x y) = fun y => 1 / 2 * S.m * y, y⟫_ + -(1 / 2) * S.k * x, x⟫_(2 * (1 / 2 * S.m)) v = S.m v All goals completed! 🐙

D.2. The variational derivative of the action

We now write down the variational derivative 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.

D.2.1. Equality for the variational derivative

Basic equalities for the variational derivative of the action.

All goals completed! 🐙

D.3. The equation of motion

The equation of motion for the harmonic oscillator is given by setting the variational derivative of the action equal to zero.

The equation of motion for the Harmonic oscillator.

def EquationOfMotion (xₜ : Time EuclideanSpace (Fin 1)) : Prop := S.gradLagrangian xₜ = 0
D.3.1. Equation of motion if and only if variational-gradient of Lagrangian is zero

We write a simple iff statement for the definition of the equation of motions.

lemma equationOfMotion_iff_gradLagrangian_zero (xₜ : Time EuclideanSpace (Fin 1)) : S.EquationOfMotion xₜ S.gradLagrangian xₜ = 0 := S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)S.EquationOfMotion xₜ S.gradLagrangian xₜ = 0 All goals completed! 🐙

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 harmonic oscillator as the negative gradient of the potential energy, and show that this is equal to - k x.

E.1.1. The force is equal to - k x

We now show that the force is equal to - k x.

The force on the classical harmonic oscillator is - k x.

S:HarmonicOscillatorx:EuclideanSpace (Fin 1)hpot:S.potentialEnergy = fun y => 1 / 2 * S.k * y, y⟫_-((2 * (1 / 2 * S.k)) x) = -S.k x All goals completed! 🐙

E.2. Variational derivative of lagrangian and force

We relate the variational derivative of lagrangian to the force, and show the relation to Newton's second law.

The Euler lagrange operator corresponds to Newton's second law.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜt:Timegradient (fun x => S.lagrangian t x (∂ₜ xₜ t)) (xₜ t) - ∂ₜ (fun t' => gradient (fun x => S.lagrangian t' (xₜ t') x) (∂ₜ xₜ t')) t = S.force (xₜ t) - S.m ∂ₜ (∂ₜ xₜ) t All goals completed! 🐙

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.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ(∀ (x : Time), S.force (xₜ x) - S.m ∂ₜ (∂ₜ xₜ) x = 0 x) (t : Time), S.m ∂ₜ (∂ₜ xₜ) t = S.force (xₜ t) S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ(∀ (x : Time), S.force (xₜ x) = S.m ∂ₜ (∂ₜ xₜ) x) (t : Time), S.m ∂ₜ (∂ₜ xₜ) t = S.force (xₜ t) All goals completed! 🐙

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.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜh: (t : Time), S.m ∂ₜ (∂ₜ xₜ) t = S.force (xₜ t)t:Time(fun t => ∂ₜ xₜ t, S.m ∂ₜ (∂ₜ xₜ) t + S.k xₜ t⟫_) t = 0 t All goals completed! 🐙

F.2. Energy conservation in terms of constant energy

We prove that the energy is constant for any trajectory satisfying the equation of motion.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜh:S.EquationOfMotion xₜt✝:Timet:Timep:Timep.val 0 t = 0 (p.val 1) All goals completed! 🐙

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.

G.1.1. Equality for the canonical momentum

An simple equality for the canonical momentum.

lemma toCanonicalMomentum_eq (t : Time) (x : EuclideanSpace (Fin 1)) (v : EuclideanSpace (Fin 1)) : toCanonicalMomentum S t x v = S.m v := gradient_lagrangian_velocity_eq S t x v

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.

G.2.1. Equality for the Hamiltonian

We prove a simple equality for the Hamiltonian, to help in computations.

lemma hamiltonian_eq : hamiltonian S = fun _ p x => (1 / (2 : )) * (1 / S.m) * p, p⟫_ + (1 / (2 : )) * S.k * x, x⟫_ := S:HarmonicOscillatorS.hamiltonian = fun x p x_1 => 1 / 2 * (1 / S.m) * p, p⟫_ + 1 / 2 * S.k * x_1, x_1⟫_ S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)p:EuclideanSpace (Fin 1)S.hamiltonian t x p = 1 / 2 * (1 / S.m) * x, x⟫_ + 1 / 2 * S.k * p, p⟫_ S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)p:EuclideanSpace (Fin 1)S.m⁻¹ * x, x⟫_ - (2⁻¹ * S.m * (S.m⁻¹ * (S.m⁻¹ * x, x⟫_)) - 2⁻¹ * S.k * p, p⟫_) = 2⁻¹ * S.m⁻¹ * x, x⟫_ + 2⁻¹ * S.k * p, p⟫_ S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)p:EuclideanSpace (Fin 1)x, x⟫_ * 2 - (x, x⟫_ - S.m * S.k * p, p⟫_) = x, x⟫_ + S.m * S.k * p, p⟫_ All goals completed! 🐙
G.2.2. Smoothness of the Hamiltonian

We show that the Hamiltonian is smooth in all its arguments.

S:HarmonicOscillatorn:ℕ∞ωContDiff n fun x p x_1 => 1 / 2 * (1 / S.m) * p, p⟫_ + 1 / 2 * S.k * x_1, x_1⟫_ All goals completed! 🐙
G.2.3. Gradients of the Hamiltonian

We now write down the gradients of the Hamiltonian with respect to the momentum and position.

S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)p:EuclideanSpace (Fin 1)h_eq:(fun y => S.hamiltonian t p y) = fun y => 1 / 2 * S.k * y, y⟫_ + 1 / 2 * (1 / S.m) * p, p⟫_(2 * (1 / 2 * S.k)) x = S.k x All goals completed! 🐙S:HarmonicOscillatort:Timex:EuclideanSpace (Fin 1)p:EuclideanSpace (Fin 1)h_eq:(fun y => S.hamiltonian t y x) = fun y => 1 / 2 * (1 / S.m) * y, y⟫_ + 1 / 2 * S.k * x, x⟫_(2 * (1 / 2 * (1 / S.m))) p = (1 / S.m) p All goals completed! 🐙

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.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)t:Time(fun x p x_1 => 1 / 2 * (1 / S.m) * p, p⟫_ + 1 / 2 * S.k * x_1, x_1⟫_) t ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t)) (xₜ t) = S.energy xₜ t S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)t:Time(fun x p x_1 => 1 / 2 * (1 / S.m) * p, p⟫_ + 1 / 2 * S.k * x_1, x_1⟫_) t ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t)) (xₜ t) = 1 / 2 * S.m * ∂ₜ xₜ t, ∂ₜ xₜ t⟫_ + (1 / 2) S.k xₜ t, xₜ t⟫_ S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)t:Time1 / 2 * (1 / S.m) * (S.m * (S.m * ∂ₜ xₜ t, ∂ₜ xₜ t⟫_)) + 1 / 2 * S.k * xₜ t, xₜ t⟫_ = 1 / 2 * S.m * ∂ₜ xₜ t, ∂ₜ xₜ t⟫_ + 1 / 2 * (S.k * xₜ t, xₜ t⟫_) All goals completed! 🐙

G.4. Hamilton equation operator

We define the operator on momentum-position phase-space whose vanishing is equivalent to Hamilton's equations.

G.5. 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.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ(∀ (t : Time), S.m ∂ₜ (∂ₜ xₜ) t = S.force (xₜ t)) (t : Time), ∂ₜ (fun t => S.m ∂ₜ xₜ t) t = -(S.k xₜ t) All goals completed! 🐙

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.

S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ[S.EquationOfMotion xₜ, S.EquationOfMotion xₜ, (fun t => ClassicalMechanics.hamiltonEqOp S.hamiltonian (fun t => (S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t)) (fun t => xₜ t) t) = 0].TFAES:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.lagrangianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t), xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜ S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ[S.EquationOfMotion xₜ, (fun t => ClassicalMechanics.hamiltonEqOp S.hamiltonian (fun t => (S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t)) (fun t => xₜ t) t) = 0].TFAES:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.lagrangianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t), xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜ erw [S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ[S.EquationOfMotion xₜ, S.EquationOfMotion xₜ].TFAES:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.lagrangianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t), xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜ[S.EquationOfMotion xₜ, S.EquationOfMotion xₜ].TFAES:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.lagrangianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t), xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜ S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.lagrangianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t), xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜ repeat S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => ((S.toCanonicalMomentum t (xₜ t)) (∂ₜ xₜ t), xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜ S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff fun t => (S.m ∂ₜ xₜ t, xₜ t)S:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff S.hamiltonianS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜS:HarmonicOscillatorxₜ:Time EuclideanSpace (Fin 1)hx:ContDiff xₜContDiff xₜ repeat All goals completed! 🐙