Physlib.ClassicalMechanics.HarmonicOscillator.WithDim
A. A harmonic oscillator with dimension-tagged parameters
This module applies `WithDim` to the existing harmonic-oscillator model. The mass and spring constant themselves carry their physical dimensions, and the potential energy is assembled from dimension-tagged quantities. Its output dimension is therefore checked by the type of the expression rather than attached only after evaluating a numerical function.
The explicit map `toHarmonicOscillator` connects the tagged model to the existing numerical model. The analytic results then reuse the general `WithDim` transport API and the existing numerical potential energy. The derivative remains an ordinary continuous linear map between the tagged coordinate spaces; a derivative whose value itself carries the quotient of output and input dimensions remains separate follow-up work.
A.1. Dimension-tagged oscillator data
A.2. Analytic reuse
8 declarations
Conversion from dimension-tagged to numerical harmonic oscillator
Given a harmonic oscillator model whose parameters carry physical dimensions (of type `HarmonicOscillatorWithDim`), this function constructs a corresponding numerical harmonic oscillator (of type `HarmonicOscillator`). It achieves this by extracting the raw numerical values of the mass and the spring constant from the dimension-tagged quantities and , while preserving the requirements that and .
Squared norm with dimension
Given a position in a 1-dimensional Euclidean space that carries the physical dimension of length (represented by ), this function calculates the squared norm of the position's underlying value. The resulting real number is tagged with the physical dimension of length squared .
Numerical value of dimension-tagged squared norm equals
For any position in a 1-dimensional Euclidean space that carries the physical dimension of length , the numerical value of its dimension-tagged squared norm is equal to the real inner product of the underlying numerical value of with itself, denoted by .
Potential energy with dimension
For a harmonic oscillator with dimension-tagged parameters, the potential energy function maps a position in a 1-dimensional Euclidean space (with physical dimension of length ) to the quantity , where is the spring constant of the oscillator. The resulting value is a real number carrying the physical dimension of energy, .
Numerical value of dimension-tagged potential energy
For a dimension-tagged harmonic oscillator and a position in a 1-dimensional Euclidean space with physical dimension of length , the numerical value of the dimension-tagged potential energy is equal to the potential energy calculated by the corresponding numerical harmonic oscillator at the numerical position . That is, where denotes the extraction of the underlying numerical value from a dimension-tagged quantity.
Dimension-Tagged Potential Energy as a Transport of Numerical Potential Energy
For a harmonic oscillator with dimension-tagged parameters, the potential energy function is equal to the transport of the numerical potential energy function of its corresponding numerical oscillator (constructed via `toHarmonicOscillator`). The transport operation lifts the numerical function to one that acts on an input with the dimension of length and produces an output with the dimension of energy .
Fréchet Differentiability of Dimension-Tagged Potential Energy for a Harmonic Oscillator
Let be a harmonic oscillator with dimension-tagged parameters and let be its potential energy function, which maps a position with physical dimension of length to a value with dimension of energy . For any such position , the potential energy function is Fréchet differentiable at . Its derivative is given by the transported linear map of the Fréchet derivative of the corresponding numerical potential energy function (obtained from the numerical oscillator ) evaluated at the numerical value of .
The potential energy of a dimension-tagged harmonic oscillator is continuous.
For a harmonic oscillator with dimension-tagged parameters, the potential energy function is continuous.
