Imports
/- Copyright (c) 2025 Joseph Tooby-Smith. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Tomas Skrivan, Joseph Tooby-Smith -/ module public import Mathlib.Analysis.Calculus.Deriv.Polynomial public import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral public import Mathlib.Analysis.SpecialFunctions.Trigonometric.Series public import Mathlib.Tactic.Cases

Physicists Hermite Polynomial

This file may eventually be upstreamed to Mathlib.

@[expose] public sectionlemma physHermite_succ (n : ) : physHermite (n + 1) = 2 X * physHermite n - derivative (physHermite n) := n:physHermite (n + 1) = 2 X * physHermite n - derivative (physHermite n) All goals completed! 🐙lemma physHermite_eq_iterate (n : ) : physHermite n = (fun p => 2 * X * p - derivative p)^[n] 1 := n:physHermite n = (fun p => 2 * X * p - derivative p)^[n] 1 induction n with physHermite 0 = (fun p => 2 * X * p - derivative p)^[0] 1 All goals completed! 🐙 n:ih:physHermite n = (fun p => 2 * X * p - derivative p)^[n] 1physHermite (n + 1) = (fun p => 2 * X * p - derivative p)^[n + 1] 1 All goals completed! 🐙@[simp] lemma physHermite_zero : physHermite 0 = C 1 := rfllemma physHermite_one : physHermite 1 = 2 * X := physHermite 1 = 2 * X All goals completed! 🐙n:derivative (2 X * physHermite (n + 1) - derivative (physHermite (n + 1))) = 2 * (n + 1 + 1) physHermite (n + 1) n:2 * physHermite (n + 1) + 2 * X * (2 * ((n + 1) * physHermite n)) - 2 * ((n + 1) * derivative (physHermite n)) = 2 * ((n + 1 + 1) * physHermite (n + 1)) n:2 * (2 * X * physHermite n - derivative (physHermite n)) + 2 * X * (2 * ((n + 1) * physHermite n)) - 2 * ((n + 1) * derivative (physHermite n)) = 2 * ((n + 1 + 1) * (2 * X * physHermite n - derivative (physHermite n))) All goals completed! 🐙lemma derivative_physHermite : (n : ) derivative (physHermite n) = 2 * n physHermite (n - 1) derivative (physHermite 0) = 2 * 0 physHermite (0 - 1) derivative (physHermite 0) = 2 * 0 physHermite (0 - 1) All goals completed! 🐙 n:derivative (physHermite (n + 1)) = 2 * (n + 1) physHermite (n + 1 - 1) n:derivative (physHermite (n + 1)) = 2 * (n + 1) physHermite (n + 1 - 1) All goals completed! 🐙All goals completed! 🐙lemma coeff_physHhermite_succ_zero (n : ) : coeff (physHermite (n + 1)) 0 = - coeff (physHermite n) 1 := n:(physHermite (n + 1)).coeff 0 = -(physHermite n).coeff 1 All goals completed! 🐙n:k:2 (physHermite n).coeff k - ((k + 1) + 1) * (physHermite n).coeff (k + 1 + 1) = 2 * (physHermite n).coeff k - (k + 2) * (physHermite n).coeff (k + 2) All goals completed! 🐙n:ih: (k : ), (physHermite n).coeff (n + k + 1) = 0k:2 * 0 - ((n + k + 1) + 2) * 0 = 0 All goals completed! 🐙All goals completed! 🐙@[simp] lemma degree_physHermite (n : ) : degree (physHermite n) = n := n:(physHermite n).degree = n refine degree_eq_of_le_of_coeff_ne_zero ?_ (n:(physHermite n).coeff n 0 All goals completed! 🐙) simp_rw n:(physHermite n).degree nn: (m : ), n < m (physHermite n).coeff m = 0 n: (m : ), n < m (physHermite n).coeff m = 0] All goals completed! 🐙@[simp] lemma natDegree_physHermite {n : } : (physHermite n).natDegree = n := natDegree_eq_of_degree_eq_some (degree_physHermite n)lemma iterate_derivative_physHermite_of_gt {n m : } (h : n < m) : derivative^[m] (physHermite n) = 0 := iterate_derivative_eq_zero (n:m:h:n < m(physHermite n).natDegree < m All goals completed! 🐙)n:m✝:m:(m + 1 + n).descFactorial n 0 = 0 All goals completed! 🐙@[simp] lemma physHermite_leadingCoeff {n : } : (physHermite n).leadingCoeff = 2 ^ n := n:(physHermite n).leadingCoeff = 2 ^ n All goals completed! 🐙@[simp] lemma physHermite_ne_zero {n : } : physHermite n 0 := leadingCoeff_ne_zero.mp (n:(physHermite n).leadingCoeff 0 All goals completed! 🐙)lemma physHermite_eq_aeval (n : ) (x : ) : physHermite n x = (physHermite n).aeval x := rfllemma physHermite_zero_apply (x : ) : physHermite 0 x = 1 := x:(fun x => (aeval x) (physHermite 0)) x = 1 All goals completed! 🐙lemma physHermite_pow (n m : ) (x : ) : physHermite n x ^ m = aeval x (physHermite n ^ m) := n:m:x:(fun x => (aeval x) (physHermite n)) x ^ m = (aeval x) (physHermite n ^ m) All goals completed! 🐙lemma physHermite_succ_fun (n : ) : (physHermite (n + 1) : ) = 2 (fun x => x) * (physHermite n : )- (2 * n : ) (physHermite (n - 1) : ) := n:(fun x => (aeval x) (physHermite (n + 1))) = ((2 fun x => x) * fun x => (aeval x) (physHermite n)) - (2 * n) fun x => (aeval x) (physHermite (n - 1)) n:x:(aeval x) (physHermite (n + 1)) = (((2 fun x => x) * fun x => (aeval x) (physHermite n)) - (2 * n) fun x => (aeval x) (physHermite (n - 1))) x All goals completed! 🐙n:(((2 fun x => x) * fun x => (aeval x) (physHermite n)) - (2 * n) fun x => (aeval x) (physHermite (n - 1))) = fun x => 2 x * (fun x => (aeval x) (physHermite n)) x - (2 * n) (fun x => (aeval x) (physHermite (n - 1))) x All goals completed! 🐙All goals completed! 🐙@[fun_prop] lemma physHermite_differentiableAt (n : ) (x : ) : DifferentiableAt (physHermite n) x := Polynomial.differentiableAt_aeval (physHermite n)@[fun_prop] lemma deriv_physHermite_differentiableAt (n m : ) (x : ) : DifferentiableAt (deriv^[m] (physHermite n)) x := iterated_deriv_physHermite_eq_aeval n m Polynomial.differentiableAt_aeval _n:x:(aeval x) (2 * n physHermite (n - 1)) = (2 * n * fun x => (aeval x) (physHermite (n - 1))) x All goals completed! 🐙E:Type u_1inst✝¹:NormedAddCommGroup Einst✝:NormedSpace Ex:Ef:E hf:DifferentiableAt f xn:fderiv (fun x => (aeval x) (physHermite n)) (f x) ∘SL fderiv f x = (2 * n * (fun x => (aeval x) (physHermite (n - 1))) (f x)) fderiv f x E:Type u_1inst✝¹:NormedAddCommGroup Einst✝:NormedSpace Ex:Ef:E hf:DifferentiableAt f xn:dx:E(fderiv (fun x => (aeval x) (physHermite n)) (f x) ∘SL fderiv f x) dx = ((2 * n * (fun x => (aeval x) (physHermite (n - 1))) (f x)) fderiv f x) dx E:Type u_1inst✝¹:NormedAddCommGroup Einst✝:NormedSpace Ex:Ef:E hf:DifferentiableAt f xn:dx:E(fderiv f x) dx * (2 * (n * (aeval (f x)) (physHermite (n - 1)))) = 2 * n * (aeval (f x)) (physHermite (n - 1)) * (fderiv f x) dx All goals completed! 🐙x:f: hf:DifferentiableAt f xn:((2 * n * (fun x => (aeval x) (physHermite (n - 1))) (f x)) fderiv f x) 1 = 2 * n * (fun x => (aeval x) (physHermite (n - 1))) (f x) * (fderiv f x) 1 All goals completed! 🐙n:x:(fun x => 2 x * (fun x => (aeval x) (physHermite (n + 1))) x - (2 * (n + 1)) (fun x => (aeval x) (physHermite (n + 1 - 1))) x) (-x) = (-1) ^ (n + 2) * (fun x => 2 x * (fun x => (aeval x) (physHermite (n + 1))) x - (2 * (n + 1)) (fun x => (aeval x) (physHermite (n + 1 - 1))) x) x n:x:-(2 * x * ((-1) ^ (n + 1) * (aeval x) (physHermite (n + 1)))) - 2 * (n + 1) * ((-1) ^ n * (aeval x) (physHermite n)) = (-1) ^ (n + 2) * (2 * x * (aeval x) (physHermite (n + 1)) - 2 * (n + 1) * (aeval x) (physHermite n)) All goals completed! 🐙

Relationship to Gaussians

n:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)(-1) ^ n * (deriv (fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2) + (aeval x) (physHermite n) * (-2 * x * Real.exp (-x ^ 2))) = (-1) ^ n * -1 * ((fun x => (aeval x) (2 X * physHermite n - 2 * n physHermite (n - 1))) x * Real.exp (-x ^ 2))n:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)DifferentiableAt (fun x => (aeval x) (physHermite n)) xn:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)DifferentiableAt (fun x => Real.exp (-x ^ 2)) x n:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)(-1) ^ n * (deriv (fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2) + (aeval x) (physHermite n) * (-2 * x * Real.exp (-x ^ 2))) = (-1) ^ n * -1 * ((fun x => (aeval x) (2 X * physHermite n - 2 * n physHermite (n - 1))) x * Real.exp (-x ^ 2)) n:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)(-1) ^ n * (2 * (n * (aeval x) (physHermite (n - 1))) * Real.exp (-x ^ 2) + (aeval x) (physHermite n) * (-2 * x * Real.exp (-x ^ 2))) = (-1) ^ n * -1 * ((2 * x * (aeval x) (physHermite n) - 2 * (n * (aeval x) (physHermite (n - 1)))) * Real.exp (-x ^ 2)) All goals completed! 🐙 n:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)DifferentiableAt (fun x => (aeval x) (physHermite n)) x All goals completed! 🐙 n:x:ih:(deriv^[n] fun y => Real.exp (-y ^ 2)) = fun x => (-1) ^ n * ((fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2))deriv_gaussian:deriv (fun y => Real.exp (-y ^ 2)) x = -2 * x * Real.exp (-x ^ 2)DifferentiableAt (fun x => Real.exp (-x ^ 2)) x All goals completed! 🐙n:x:(fun x => (aeval x) (physHermite n)) x = (-1) ^ n * ((-1) ^ n * (fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2)) / Real.exp (-x ^ 2) All goals completed! 🐙n:x:(-1) ^ n * deriv^[n] (fun y => Real.exp (-y ^ 2)) x / (Real.exp (x ^ 2))⁻¹ = (-1) ^ n * deriv^[n] (fun y => Real.exp (-y ^ 2)) x * Real.exp (x ^ 2) All goals completed! 🐙b:c:hb:0 < bP:[X]i:x✝:i Finset.range (P.natDegree + 1)h2:(fun a => P.coeff i (c * a) ^ i * Real.exp (-b * a ^ 2)) = (c ^ i * (P.coeff i)) fun x => x ^ i * Real.exp (-b * x ^ 2)MeasureTheory.Integrable (fun x => P.coeff i (c * x) ^ i * Real.exp (-b * x ^ 2)) MeasureTheory.volume All goals completed! 🐙@[fun_prop] lemma guassian_integrable_polynomial {b : } (hb : 0 < b) (P : Polynomial ) : MeasureTheory.Integrable fun x : => (P.aeval x) * Real.exp (-b * x ^ 2) := b:hb:0 < bP:[X]MeasureTheory.Integrable (fun x => (aeval x) P * Real.exp (-b * x ^ 2)) MeasureTheory.volume All goals completed! 🐙n:p:m:prod_eq_smul_aeval_mul_gaussian:((deriv^[m] fun x => (aeval x) (physHermite p)) * deriv^[n] fun x => Real.exp (-x ^ 2)) = (-1) ^ n fun x => (aeval x) ((⇑derivative)^[m] (physHermite p) * physHermite n) * Real.exp (-1 * x ^ 2)MeasureTheory.Integrable ((deriv^[m] fun x => (aeval x) (physHermite p)) * deriv^[n] fun x => Real.exp (-x ^ 2)) MeasureTheory.volume All goals completed! 🐙n:m:h1: (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = (-1) ^ m * ((fun x => (aeval x) (physHermite n)) x * deriv^[m] (fun x => Real.exp (-x ^ 2)) x) (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = (-1) ^ m * (x : ), (fun x => (aeval x) (physHermite n)) x * deriv^[m] (fun x => Real.exp (-x ^ 2)) x All goals completed! 🐙n:m:p:h:p + 1 mhl: (x : ), deriv^[p] (fun x => (aeval x) (physHermite n)) x * deriv (deriv^[m - (p + 1)] fun x => Real.exp (-x ^ 2)) x = - (x : ), deriv (deriv^[p] fun x => (aeval x) (physHermite n)) x * deriv^[m - (p + 1)] (fun x => Real.exp (-x ^ 2)) x-1 * (x : ), deriv^[p] (fun x => (aeval x) (physHermite n)) x * deriv (deriv^[m - (p + 1)] fun x => Real.exp (-x ^ 2)) x = (x : ), deriv (deriv^[p] fun x => (aeval x) (physHermite n)) x * deriv^[m - (p + 1)] (fun x => Real.exp (-x ^ 2)) x All goals completed! 🐙lemma integral_physHermite_mul_physHermite_eq_integral_deriv (n m : ) : x : , (physHermite n x * physHermite m x) * Real.exp (- x ^ 2) = x : , (deriv^[m] (physHermite n) x * (Real.exp (-x ^ 2))) := n:m: (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = (x : ), deriv^[m] (fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2) All goals completed! 🐙n:m:hnm:n < m (x : ), deriv^[m] (fun x => (aeval x) (physHermite n)) x * Real.exp (-x ^ 2) = 0 All goals completed! 🐙theorem physHermite_orthogonal {n m : } (hnm : n m) : x : , (physHermite n x * physHermite m x) * Real.exp (- x ^ 2) = 0 := n:m:hnm:n m (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = 0 n:m:hnm:n mh:n < m (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = 0n:m:hnm:n mh:m < n (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = 0 n:m:hnm:n mh:n < m (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = 0 All goals completed! 🐙 n:m:hnm:n mh:m < n (x : ), (fun x => (aeval x) (physHermite n)) x * (fun x => (aeval x) (physHermite m)) x * Real.exp (-x ^ 2) = 0 All goals completed! 🐙n:m:hnm:n mc:h: (x : ), (fun x => (aeval x) (physHermite n)) (c * x) * (fun x => (aeval x) (physHermite m)) (c * x) * Real.exp (-(c * x) ^ 2) = 0 (x : ), (fun x => (aeval x) (physHermite n)) (c * x) * (fun x => (aeval x) (physHermite m)) (c * x) * Real.exp (-c ^ 2 * x ^ 2) = 0 All goals completed! 🐙n: (x : ), (fun x => (aeval x) ((⇑derivative)^[n] (physHermite n))) x * Real.exp (-x ^ 2) = n ! * 2 ^ n * Real.pi All goals completed! 🐙n:c:h: (x : ), (fun x => (aeval x) (physHermite n)) (c * x) * (fun x => (aeval x) (physHermite n)) (c * x) * Real.exp (-(c * x) ^ 2) = |c⁻¹| (n ! * 2 ^ n * Real.pi) (x : ), (fun x => (aeval x) (physHermite n)) (c * x) * (fun x => (aeval x) (physHermite n)) (c * x) * Real.exp (-c ^ 2 * x ^ 2) = |c⁻¹| (n ! * 2 ^ n * Real.pi) All goals completed! 🐙P:[X]n✝¹:(x : ) ×' P.natDegree = xa✝¹: (y : (P : [X]) ×' (n : ) ×' P.natDegree = n), InvImage (fun x1 x2 => x1 < x2) (fun x => PSigma.casesOn x fun P n => PSigma.casesOn n fun n hn => n) y P, n✝¹ (fun x => (aeval x) y.1) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))n✝:hn:P.natDegree = n✝a✝: (y : (P : [X]) ×' (n : ) ×' P.natDegree = n), InvImage (fun x1 x2 => x1 < x2) (fun x => PSigma.casesOn x fun P n => PSigma.casesOn n fun n hn => n) y P, n✝, hn (fun x => (aeval x) y.1) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))n:h:P.natDegree = n + 1x✝: (y : (P : [X]) ×' (n : ) ×' P.natDegree = n), InvImage (fun x1 x2 => x1 < x2) (fun x => PSigma.casesOn x fun P n => PSigma.casesOn n fun n hn => n) y P, n.succ, h (fun x => (aeval x) y.1) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))hP0:¬P = 0P':[X] := (physHermite (n + 1)).coeff (n + 1) P - P.coeff (n + 1) physHermite (n + 1)hP':¬P' = 0m:hm':n + 1 mhm:¬m = n + 12 ^ (n + 1) 0 - P.coeff (n + 1) 0 = 0 All goals completed! 🐙 P:[X]n✝¹:(x : ) ×' P.natDegree = xa✝¹: (y : (P : [X]) ×' (n : ) ×' P.natDegree = n), InvImage (fun x1 x2 => x1 < x2) (fun x => PSigma.casesOn x fun P n => PSigma.casesOn n fun n hn => n) y P, n✝¹ (fun x => (aeval x) y.1) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))n✝:hn:P.natDegree = n✝a✝: (y : (P : [X]) ×' (n : ) ×' P.natDegree = n), InvImage (fun x1 x2 => x1 < x2) (fun x => PSigma.casesOn x fun P n => PSigma.casesOn n fun n hn => n) y P, n✝, hn (fun x => (aeval x) y.1) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))n:h:P.natDegree = n + 1x✝: (y : (P : [X]) ×' (n : ) ×' P.natDegree = n), InvImage (fun x1 x2 => x1 < x2) (fun x => PSigma.casesOn x fun P n => PSigma.casesOn n fun n hn => n) y P, n.succ, h (fun x => (aeval x) y.1) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))hP0:¬P = 0P':[X] := (physHermite (n + 1)).coeff (n + 1) P - P.coeff (n + 1) physHermite (n + 1)hP':¬P' = 0(physHermite (n + 1)).coeff (n + 1) P - P.coeff (n + 1) physHermite (n + 1) 0 All goals completed! 🐙lemma polynomial_mem_physHermite_span (P : Polynomial ) : (P : ) Submodule.span (Set.range (fun n => (physHermite n : ))) := polynomial_mem_physHermite_span_induction P P.natDegree rflc:h1:Filter.Tendsto (fun s y => x s, (-1) ^ x * (c * y) ^ (2 * x) / (2 * x)!) Filter.atTop (nhds fun x => Real.cos (c * x))h2: (z : Finset ), (fun y => x z, (-1) ^ x * (c * y) ^ (2 * x) / (2 * x)!) Submodule.span (Set.range fun n x => (aeval x) (physHermite n))(fun x => Real.cos (c * x)) (Submodule.span (Set.range fun n x => (aeval x) (physHermite n))).topologicalClosure All goals completed! 🐙