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 -/ module public import Physlib.QuantumMechanics.Operators.OneDimension.Parity public import Physlib.QuantumMechanics.Operators.OneDimension.Momentum public import Physlib.QuantumMechanics.Operators.OneDimension.Position

1d Harmonic Oscillator

The quantum harmonic oscillator in 1d. This file contains

    the definition of the Schrodinger operator

    the definition of eigenfunctions and eigenvalues of the Schrodinger operator in terms of Hermite polynomials

    proof that eigenfunctions and eigenvalues are indeed eigenfunctions and eigenvalues.

TODO "Generalize 1d harmonic oscillator to d dimensions and SpaceDHilbertSpace."@[expose] public section

Some preliminary results about Complex.ofReal .

To be moved.

lemma Complex.ofReal_hasDerivAt : HasDerivAt Complex.ofReal 1 x := x:ℝ⊢ HasDerivAt ofReal 1 x x:ℝf1:ℂ → ℂ := id⊢ HasDerivAt ofReal 1 x x:ℝf1:ℂ → ℂ := id⊢ HasDerivAt (f1 ∘ ofReal) 1 x x:ℝf1:ℂ → ℂ := id⊢ HasDerivAt f1 1 ↑x x:ℝf1:ℂ → ℂ := id⊢ HasDerivAt id 1 ↑x All goals completed! 🐙@[simp] lemma Complex.deriv_ofReal : deriv Complex.ofReal x = 1 := x:ℝ⊢ deriv ofReal x = 1 All goals completed! 🐙@[fun_prop] lemma Complex.differentiableAt_ofReal : DifferentiableAt ℝ Complex.ofReal x := x:ℝ⊢ DifferentiableAt ℝ ofReal x All goals completed! 🐙

The 1d Harmonic Oscillator

A quantum harmonic oscillator specified by a three real parameters: the mass of the particle m, a value of Planck's constant ℏ, and an angular frequency ω. All three of these parameters are assumed to be positive.

The mass of the particle.

The angular frequency of the harmonic oscillator.

structure HarmonicOscillator where m : ℝ ω : ℝ hω : 0 < ω hm : 0 < m
@[simp] lemma m_pos : 0 < Q.m := Q.hm@[simp] lemma m_nonneg : 0 ≤ Q.m := Q.hm.le@[simp] lemma m_ne_zero : Q.m ≠ 0 := Q.hm.ne'@[simp] lemma ω_pos : 0 < Q.ω := Q.hω@[simp] lemma ω_nonneg : 0 ≤ Q.ω := Q.hω.le@[simp] lemma ω_ne_zero : Q.ω ≠ 0 := Q.hω.ne'

The characteristic length

lemma ξ_nonneg : 0 ≤ Q.ξ := Real.sqrt_nonneg _Q:HarmonicOscillator⊢ 0 < √(↑ℏ / (Q.m * Q.ω)) Q:HarmonicOscillator⊢ 0 < ↑ℏ / (Q.m * Q.ω) Q:HarmonicOscillator⊢ 0 < ↑ℏQ:HarmonicOscillator⊢ 0 < Q.m * Q.ω Q:HarmonicOscillator⊢ 0 < ↑ℏ All goals completed! 🐙 Q:HarmonicOscillator⊢ 0 < Q.m * Q.ω All goals completed! 🐙@[simp] lemma ξ_ne_zero : Q.ξ ≠ 0 := Ne.symm (_root_.ne_of_lt Q.ξ_pos)Q:HarmonicOscillator⊢ √(↑ℏ / (Q.m * Q.ω)) ^ 2 = ↑ℏ / (Q.m * Q.ω) Q:HarmonicOscillator⊢ 0 ≤ ↑ℏ / (Q.m * Q.ω) Q:HarmonicOscillator⊢ 0 ≤ ↑ℏQ:HarmonicOscillator⊢ 0 ≤ Q.m * Q.ω Q:HarmonicOscillator⊢ 0 ≤ ↑ℏ All goals completed! 🐙 Q:HarmonicOscillator⊢ 0 ≤ Q.m * Q.ω All goals completed! 🐙@[simp] lemma ξ_abs : abs Q.ξ = Q.ξ := abs_of_nonneg Q.ξ_nonnegQ:HarmonicOscillatorthis:0 < ↑ℏ⊢ √(↑ℏ / (Q.m * Q.ω))⁻¹ = √(Q.m * Q.ω / ↑ℏ) All goals completed! 🐙Q:HarmonicOscillator⊢ 1 / Q.ξ = √(Q.m * Q.ω / ↑ℏ) All goals completed! 🐙Q:HarmonicOscillator⊢ √(Q.m * Q.ω / ↑ℏ) ^ 2 = Q.m * Q.ω / ↑ℏ exact Real.sq_sqrt (Q:HarmonicOscillator⊢ 0 ≤ Q.m * Q.ω / ↑ℏ All goals completed! 🐙)@[inherit_doc momentumOperator] scoped[QuantumMechanics.OneDimension.HarmonicOscillator] notation "Pᵒᵖ" => momentumOperator@[inherit_doc positionOperator] scoped[QuantumMechanics.OneDimension.HarmonicOscillator] notation "Xᵒᵖ" => positionOperatorlemma schrodingerOperator_eq (ψ : ℝ → ℂ) : Q.schrodingerOperator ψ = (- ℏ ^ 2 / (2 * Q.m)) • (deriv (deriv ψ)) + (1/2 * Q.m * Q.ω^2) • ((fun x => Complex.ofReal x ^2) * ψ) := Q:HarmonicOscillatorψ:ℝ → ℂ⊢ Q.schrodingerOperator ψ = (-↑ℏ ^ 2 / (2 * Q.m)) • deriv (deriv ψ) + (1 / 2 * Q.m * Q.ω ^ 2) • ((fun x => ↑x ^ 2) * ψ) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝ⊢ Q.schrodingerOperator ψ x = ((-↑ℏ ^ 2 / (2 * Q.m)) • deriv (deriv ψ) + (1 / 2 * Q.m * Q.ω ^ 2) • ((fun x => ↑x ^ 2) * ψ)) x Q:HarmonicOscillatorψ:ℝ → ℂx:ℝ⊢ 2⁻¹ * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * ψ x = 2⁻¹ * ↑Q.m * ↑Q.ω ^ 2 * (↑x ^ 2 * ψ x) All goals completed! 🐙

The schrodinger operator written in terms of ξ.

lemma schrodingerOperator_eq_ξ (ψ : ℝ → ℂ) : Q.schrodingerOperator ψ = fun x => (ℏ ^2 / (2 * Q.m)) * (- (deriv (deriv ψ) x) + (1/Q.ξ^2)^2 * x^2 * ψ x) := Q:HarmonicOscillatorψ:ℝ → ℂ⊢ Q.schrodingerOperator ψ = fun x => ↑↑ℏ ^ 2 / (2 * ↑Q.m) * (-deriv (deriv ψ) x + (1 / ↑Q.ξ ^ 2) ^ 2 * ↑x ^ 2 * ψ x) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝ⊢ Q.schrodingerOperator ψ x = ↑↑ℏ ^ 2 / (2 * ↑Q.m) * (-deriv (deriv ψ) x + (1 / ↑Q.ξ ^ 2) ^ 2 * ↑x ^ 2 * ψ x) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝ⊢ -↑(↑ℏ ^ 2) / (2 * ↑Q.m) * deriv (deriv ψ) x + 2⁻¹ * ↑Q.m * ↑(Q.ω ^ 2) * (↑(x ^ 2) * ψ x) = ↑(↑ℏ ^ 2) / (2 * ↑Q.m) * (-deriv (deriv ψ) x + (↑Q.m * ↑Q.ω / ↑↑ℏ) ^ 2 * ↑(x ^ 2) * ψ x) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝthis:↑Q.m ≠ 0⊢ -↑(↑ℏ ^ 2) / (2 * ↑Q.m) * deriv (deriv ψ) x + 2⁻¹ * ↑Q.m * ↑(Q.ω ^ 2) * (↑(x ^ 2) * ψ x) = ↑(↑ℏ ^ 2) / (2 * ↑Q.m) * (-deriv (deriv ψ) x + (↑Q.m * ↑Q.ω / ↑↑ℏ) ^ 2 * ↑(x ^ 2) * ψ x) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝthis✝:↑Q.m ≠ 0this:↑↑ℏ ≠ 0⊢ -↑(↑ℏ ^ 2) / (2 * ↑Q.m) * deriv (deriv ψ) x + 2⁻¹ * ↑Q.m * ↑(Q.ω ^ 2) * (↑(x ^ 2) * ψ x) = ↑(↑ℏ ^ 2) / (2 * ↑Q.m) * (-deriv (deriv ψ) x + (↑Q.m * ↑Q.ω / ↑↑ℏ) ^ 2 * ↑(x ^ 2) * ψ x) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝthis✝:↑Q.m ≠ 0this:↑↑ℏ ≠ 0⊢ (-(↑(↑ℏ ^ 2) * deriv (deriv ψ) x) + ↑Q.m ^ 2 * ↑(Q.ω ^ 2) * ↑(x ^ 2) * ψ x) * ↑↑ℏ ^ 2 = ↑(↑ℏ ^ 2) * (-(deriv (deriv ψ) x * ↑↑ℏ ^ 2) + ↑Q.m ^ 2 * ↑(x ^ 2) * ψ x * ↑Q.ω ^ 2) Q:HarmonicOscillatorψ:ℝ → ℂx:ℝthis✝:↑Q.m ≠ 0this:↑↑ℏ ≠ 0⊢ (-(↑↑ℏ ^ 2 * deriv (deriv ψ) x) + ↑Q.m ^ 2 * ↑Q.ω ^ 2 * ↑x ^ 2 * ψ x) * ↑↑ℏ ^ 2 = ↑↑ℏ ^ 2 * (-(deriv (deriv ψ) x * ↑↑ℏ ^ 2) + ↑Q.m ^ 2 * ↑x ^ 2 * ψ x * ↑Q.ω ^ 2) All goals completed! 🐙

The Schrodinger operator commutes with the parity operator.

Q:HarmonicOscillatorψ:ℝ → ℂx:ℝthis:∀ (ψ : ℝ → ℂ), (fun x => deriv (fun x => ψ (-x)) x) = fun x => -deriv ψ (-x)⊢ Q.schrodingerOperator (parityOperator ψ) x = parityOperator (Q.schrodingerOperator ψ) x All goals completed! 🐙

The Schrodinger operator is additive.

Q:HarmonicOscillatorψ:ℝ → ℂφ:ℝ → ℂhψ:Differentiable ℝ ψhψ':Differentiable ℝ (deriv ψ)hφ:Differentiable ℝ φhφ':Differentiable ℝ (deriv φ)x:ℝh_deriv_add:deriv (ψ + φ) = deriv ψ + deriv φ⊢ -↑↑ℏ ^ 2 / (2 * ↑Q.m) * (deriv (deriv ψ) x + deriv (deriv φ) x) + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * (ψ + φ) x = ((fun x => -↑↑ℏ ^ 2 / (2 * ↑Q.m) * deriv (deriv ψ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * ψ x) + fun x => -↑↑ℏ ^ 2 / (2 * ↑Q.m) * deriv (deriv φ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * φ x) x Q:HarmonicOscillatorψ:ℝ → ℂφ:ℝ → ℂhψ:Differentiable ℝ ψhψ':Differentiable ℝ (deriv ψ)hφ:Differentiable ℝ φhφ':Differentiable ℝ (deriv φ)x:ℝh_deriv_add:deriv (ψ + φ) = deriv ψ + deriv φ⊢ -↑↑ℏ ^ 2 / (2 * ↑Q.m) * (deriv (deriv ψ) x + deriv (deriv φ) x) + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * (ψ x + φ x) = -↑↑ℏ ^ 2 / (2 * ↑Q.m) * deriv (deriv ψ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * ψ x + (-↑↑ℏ ^ 2 / (2 * ↑Q.m) * deriv (deriv φ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * φ x) All goals completed! 🐙

The Schrodinger operator is homogeneous.

Q:HarmonicOscillatorc:ℂψ:ℝ → ℂhψ:Differentiable ℝ ψhψ':Differentiable ℝ (deriv ψ)x:ℝh_deriv_smul:deriv (c • ψ) = c • deriv ψ⊢ -↑↑ℏ ^ 2 / (2 * ↑Q.m) * c • deriv (deriv ψ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * (c • ψ) x = (c • fun x => -↑↑ℏ ^ 2 / (2 * ↑Q.m) * deriv (deriv ψ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * ψ x) x Q:HarmonicOscillatorc:ℂψ:ℝ → ℂhψ:Differentiable ℝ ψhψ':Differentiable ℝ (deriv ψ)x:ℝh_deriv_smul:deriv (c • ψ) = c • deriv ψ⊢ -↑↑ℏ ^ 2 / (2 * ↑Q.m) * (c * deriv (deriv ψ) x) + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * (c * ψ x) = c * (-↑↑ℏ ^ 2 / (2 * ↑Q.m) * deriv (deriv ψ) x + 1 / 2 * ↑Q.m * ↑Q.ω ^ 2 * ↑x ^ 2 * ψ x) All goals completed! 🐙