Virial theorem: kinetic energy, moment of inertia, virial , time averages, pair forces
Definitionvirial_theorem_defsBasic objects for point particles in three-dimensional Euclidean space . Particle has a constant mass , a position trajectory and a velocity trajectory .
- Kinetic energy. .
- Moment of inertia about the origin. .
- Virial scalar. with .
- Time average over a duration . .
- Pair force from a distance potential. Given pair potentials and a configuration , the force of particle on particle is
- Net force. .
- Total potential energy. .
- Power-law potentials. with a real exponent .
These are the objects in terms of which every statement of the mission is phrased.
Formalization Note Space is EuclideanSpace ℝ (Fin 3). The time average is , which Lean evaluates to at . The gradient is Mathlib's gradient, which returns where the function is not differentiable. is the real power Real.rpow. The coefficients are allowed to depend on the pair, which covers the article's single constant as well as gravity, where .
import Mathlib
namespace VirialTheorem
/-- Physical space: three-dimensional Euclidean space `ℝ³`. -/
abbrev Space := EuclideanSpace ℝ (Fin 3)
variable {N : ℕ}
/-- Total kinetic energy `T(t) = ½ ∑ₖ mₖ ‖vₖ(t)‖²` of `N` particles with masses `m`
and velocity trajectories `v`. -/
noncomputable def kineticEnergy (m : Fin N → ℝ) (v : Fin N → ℝ → Space) (t : ℝ) : ℝ :=
(1 / 2 : ℝ) * ∑ k, m k * ‖v k t‖ ^ 2
/-- Scalar moment of inertia about the origin, `I(t) = ∑ₖ mₖ ‖rₖ(t)‖²`. -/
noncomputable def momentOfInertia (m : Fin N → ℝ) (r : Fin N → ℝ → Space) (t : ℝ) : ℝ :=
∑ k, m k * ‖r k t‖ ^ 2
/-- The virial scalar `G(t) = ∑ₖ pₖ(t) · rₖ(t)`, where `pₖ = mₖ vₖ` is the momentum. -/
noncomputable def virialG (m : Fin N → ℝ) (r v : Fin N → ℝ → Space) (t : ℝ) : ℝ :=
∑ k, inner ℝ (m k • v k t) (r k t)
/-- The time average `⟨f⟩_τ = (1/τ) ∫₀^τ f(t) dt` of `f` over the duration `τ`. -/
noncomputable def timeAverage (f : ℝ → ℝ) (τ : ℝ) : ℝ :=
τ⁻¹ * ∫ t in (0 : ℝ)..τ, f t
/-- The force `F_{jk}` exerted by particle `j` on particle `k` in the configuration
`x : Fin N → Space`, derived from pair potentials `V j k : ℝ → ℝ` depending only on the
interparticle distance: `F_{jk} = -∇_{r_k} V_{jk}(‖r_k - r_j‖)`, and `F_{kk} = 0`
(no particle acts on itself). -/
noncomputable def pairForce (V : Fin N → Fin N → ℝ → ℝ) (x : Fin N → Space) (j k : Fin N) :
Space :=
if j = k then 0 else -gradient (fun y : Space => V j k (dist y (x j))) (x k)
/-- Net force on particle `k`: `F_k = ∑ⱼ F_{jk}`. -/
noncomputable def netPairForce (V : Fin N → Fin N → ℝ → ℝ) (x : Fin N → Space) (k : Fin N) :
Space :=
∑ j, pairForce V x j k
/-- Total potential energy `V_TOT = ∑ₖ ∑_{j<k} V_{jk}(‖r_k - r_j‖)`. -/
noncomputable def totalPotential (V : Fin N → Fin N → ℝ → ℝ) (x : Fin N → Space) : ℝ :=
∑ k, ∑ j ∈ Finset.univ.filter (fun j => j < k), V j k (dist (x k) (x j))
/-- Power-law pair potentials `V_{jk}(s) = α_{jk} s^n` (real exponent `n`). -/
noncomputable def powerLawPotential (α : Fin N → Fin N → ℝ) (n : ℝ) :
Fin N → Fin N → ℝ → ℝ :=
fun j k s => α j k * s ^ n
end VirialTheorem
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - drafting agent, non-blind
Non-blind read-back. This read-back is not independent testimony. It was written by the same agent that drafted the Lean statements, with full knowledge of the source article and of the intended meaning. Reviewers must not treat it as a blind audit; an independent read-back should still be obtained before relying on it.
The file fixes physical space as with its Euclidean inner product and norm, and for a natural number (possibly ) introduces the following, where particles are indexed by , assigns to each particle an arbitrary real number (no sign condition), and assign to each particle a function .
- .
- .
- .
- For and : , an oriented interval integral (for it is ); at the value is because ; if is not integrable the integral is .
- Given for every ordered pair and a configuration : the pair force is when , and otherwise is minus the gradient at the point of the function on ; where that function is not differentiable the gradient is by convention.
- The net force , summing over all including (which contributes ).
- , with in the index order; note it uses with the smaller index first.
- For real and real : the power-law family , where is the real power function (for the usual power; for it is if and otherwise).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.