Physlib.Units.UnitDependent
39 declarations
Scaling from to and back to is the Identity Map on
#scaleUnit_symm_applyLet be a type whose elements depend on a choice of units (indicated by the `UnitDependent` typeclass). For any two unit choices and any element , scaling from the representation of to and then scaling the result back from to returns the original element . That is,
Unit scaling is injective:
#scaleUnit_injectiveLet be a type whose elements depend on a choice of units (indicated by the `UnitDependent` typeclass). For any two unit choices and any two elements , the results of scaling and from the representation of to are equal if and only if and are equal. That is,
Unit scaling equivalence from to
#scaleUnitEquivFor a type equipped with a `UnitDependent` instance and two unit choices , the function defines an equivalence (a bijective map) from to itself. The forward map converts an element from the representation corresponding to unit choice to that of , and its inverse is given by the scaling map from back to .
The -linear map
#scaleUnitLinearFor a real vector space that carries a linear unit dependency, and given two sets of unit choices , the function is defined as an -linear map. This map transforms an element representing a physical quantity in the context of unit choice to its representation in unit choice .
The -linear equivalence
#scaleUnitLinearEquivFor a real vector space that carries a linear unit dependency, and given two sets of unit choices , the function is an -linear equivalence (a linear isomorphism) from to itself. This map transforms an element from its representation under unit choice to its representation under unit choice , with the inverse map being the scaling from back to .
The continuous -linear map
#scaleUnitContLinearFor a topological vector space over that carries a continuous linear unit dependency, and given two sets of unit choices , the function is defined as a continuous -linear map. This map transforms an element representing a physical quantity in the context of unit choice to its representation in unit choice .
The continuous -linear equivalence
#scaleUnitContLinearEquivFor a topological vector space over that possesses a continuous linear unit dependency, and given two sets of unit choices , the function is a continuous -linear equivalence (a continuous linear isomorphism) from to itself. This map transforms an element from its representation under unit choice to its representation under unit choice , such that both the transformation and its inverse are continuous and linear.
Let be a topological vector space over that possesses a continuous linear unit dependency. For any two sets of unit choices and any element , the result of applying the continuous -linear equivalence to is equal to the scaling function .
The inverse of is
#scaleUnitContLinearEquiv_symm_applyFor a topological vector space over that carries a continuous linear unit dependency, given any two sets of unit choices and an element , the inverse of the continuous -linear equivalence applied to is equal to the scaling operation from to applied to . That is, where is the continuous linear isomorphism that transforms representations of elements in from the unit system to .
`UnitChoices` is a `UnitDependent` type
#instUnitDependentUnitChoicesThe type `UnitChoices`, which represents a set of base units for physical dimensions (length, time, mass, charge, and temperature), is an instance of the `UnitDependent` type class. This is defined by a scaling function that transforms a set of units based on a change of reference units from to . The transformation is performed by scaling each base unit in by the ratio of the corresponding units in and : \[ \text{scaleUnit}(u_1, u_2, u) = \left( \frac{L_{u_2}}{L_{u_1}} L_u, \frac{T_{u_2}}{T_{u_1}} T_u, \frac{M_{u_2}}{M_{u_1}} M_u, \frac{Q_{u_2}}{Q_{u_1}} Q_u, \frac{\Theta_{u_2}}{\Theta_{u_1}} \Theta_u \right) \] where and represent the length, time, mass, charge, and temperature components of the unit choices, respectively.
For any two sets of base units , scaling the unit choice based on a change of reference units from to results in . That is, \[ \text{scaleUnit}(u_1, u_2, u_1) = u_2 \] where represents a set of base units for physical dimensions (length, time, mass, charge, and temperature), and is the transformation of a unit choice under the reference change from to .
For any physical dimension and any sets of base units , the scaling factor for dimension between and the transformed unit system is equal to the scaling factor for dimension between and : \[ \text{dimScale}(u, \text{scaleUnit}(u_1, u_2, u), d) = \text{dimScale}(u_1, u_2, d) \] Here, is the factor used to convert a quantity of dimension from unit system to , and scales the base units of by the ratios of the corresponding base units in to .
Let be a type that carries a physical dimension . Let be a dimensionful quantity of type , which is a function that scales consistently with the dimension . For any sets of unit choices , the value of evaluated at the scaled unit system satisfies: where is the transformation of the unit choice by the ratios of base units in relative to , and is the scaling factor for dimension transitioning from to .
Multiplicative unit dependence for types carrying a dimension
#instMulUnitDependentLet be a type that carries a physical dimension . This instance provides a multiplicative unit-dependent structure (`MulUnitDependent`) for . For any two unit systems , the scaling function is defined by: where and is the scaling factor for dimension when transitioning from unit choice to . This definition ensures that scaling is consistent with the physical dimension of and satisfies required properties such as transitivity, identity, and commutation with multiplication.
Let be a type that carries a physical dimension . For any two systems of unit choices and any element , the scaling of according to the change in units from to is given by: where is the scaling factor for dimension when transitioning from unit system to , and the multiplication denotes the action of non-negative reals on .
Linear unit dependence for a dimensionful vector space
#instLinearUnitDependentOfHasDimLet be a real vector space (specifically, an additive commutative monoid and a module over ) that carries a physical dimension . This instance provides a linear unit-dependent structure (`LinearUnitDependent`) for . For any two unit systems , the scaling function is linear, satisfying: 1. 2. for all and . This linearity holds because the scaling operation is defined by multiplication by the real-valued factor associated with the dimension of .
Continuous linear unit dependence for a dimensionful topological vector space
#instContinuousLinearUnitDependentOfHasDimOfContinuousConstSMulRealLet be a topological real vector space (formally, an additive commutative monoid and a module over equipped with a topology) such that scalar multiplication by constants is continuous. If carries a physical dimension , then possesses a continuous linear unit-dependent structure (`ContinuousLinearUnitDependent`). For any two systems of unit choices , the scaling operation is defined by: where is the scaling factor associated with the dimension . This map is linear and continuous because it is defined as the action of a constant scalar on .
Unit dependency of the function type
#instUnitDependentForallIf a type is unit-dependent, then the type of functions is also unit-dependent for any type . For a function and unit choices , the scaling operation on the function is defined pointwise: for all .
Unit scaling of functions is pointwise
#scaleUnit_apply_fun_rightLet be a type and be a unit-dependent type. For any two unit choices , any function , and any element , the result of applying the scaled function to is equal to scaling the value by the same unit choices. That is, This confirms that the unit scaling for the function type is defined pointwise.
Linear unit-dependence of induced by codomain scaling
#instLinearUnitDependentLinearMapRealIdSuppose and are modules over . If carries a linear unit-dependent structure, then the space of -linear maps is also linear unit-dependent. For a linear map and two choices of units and , the scaling operation on is defined pointwise: for all .
Continuous linear unit-dependence of induced by codomain scaling
#instContinuousLinearUnitDependentContinuousLinearMapRealIdLet and be topological vector spaces over (where is a topological additive group with continuous scalar multiplication). If possesses a continuous linear unit-dependent structure, then the space of continuous -linear maps is also a continuous linear unit-dependent type. For a continuous linear map and any two unit choices , the scaling operation is defined by post-composing with the scaling map of the codomain. That is, for all .
Unit dependence for induced by domain scaling
#instUnitDependentForall_1Given a unit-dependent type and any type , the space of functions is unit-dependent. For a function and two choices of units and , the scaled function is defined by applying to the input scaled in the reverse direction: for all .
Let and be types, where is unit-dependent. For any two choices of units and , any function , and any element , the evaluation of the unit-scaled function at the point is given by: where denotes the transformation of an element from unit choice to unit choice .
Unit dependence for induced by domain and codomain scaling
#instUnitDependentTwoSidedGiven two unit-dependent types and , the space of functions inherits a unit-dependent structure. For a function and two choices of units and , the scaled function is defined by transforming the input from back to , applying the function , and then transforming the result from to : for all .
Evaluation rule for unit-scaled functions
#scaleUnit_apply_funLet and be unit-dependent types, and let and be two choices of units. For any function and any element , the evaluation of the unit-scaled function at is given by: where denotes the transformation of an element from unit choice to unit choice .
Multiplicative unit-dependent structure for function spaces
#instUnitDependentTwoSidedMulGiven a unit-dependent type and a type that is multiplicatively unit-dependent (equipped with a scalar action by the non-negative real numbers ), the space of functions inherits a multiplicatively unit-dependent structure. For a function and two unit choices , the scaled function evaluated at an element is defined by: This definition ensures that the transformation of the function space correctly accounts for the unit scaling of both the domain and the codomain while remaining compatible with the scalar action of on .
Continuous linear unit-dependent structure for
#instContinuousLinearUnitDependentMapFor any two topological vector spaces and over that possess continuous linear unit-dependent structures, the space of continuous linear maps (the set of continuous -linear maps from to ) is also continuous linear unit-dependent. Given two unit choices , the transformation of a continuous linear map is defined by: where represents the continuous linear equivalence on that scales an element from its representation in unit choice to its representation in unit choice . This construction ensures that the unit scaling is compatible with the linear and topological structures of the map space.
Unit scaling of continuous linear map application:
#scaleUnit_apply_funLet and be topological vector spaces over equipped with continuous linear unit-dependent structures. For any continuous linear map , any two unit choices , and any element , the application of the scaled function to satisfies: Here, denotes the transformation of an element or map from its representation in unit choice to its representation in unit choice .
Dimensional correctness of
#IsDimensionallyCorrectFor a type with a defined unit dependency, an element is **dimensionally correct** if its value is invariant under a change of unit systems. Formally, for any two systems of units , the scaling function must satisfy: \[ \text{scaleUnit}(u_1, u_2, m) = m \] This property indicates that the element (which could represent a value, a function, or a proposition) does not depend on the specific units chosen to represent it.
is dimensionally correct
#isDimensionallyCorrect_iffLet be a unit-dependent type and be an element of . Then is **dimensionally correct** if and only if for all systems of units , the scaling function leaves invariant: \[ \text{scaleUnit}(u_1, u_2, m) = m \] This means that an element is dimensionally correct precisely when its value does not depend on the specific choice of units used to represent it.
is dimensionally correct
#isDimensionallyCorrect_fun_iffLet and be unit-dependent types. A function is **dimensionally correct** if and only if for all systems of units and all , the following condition is satisfied: \[ \text{scaleUnit}(u_1, u_2, f(\text{scaleUnit}(u_2, u_1, m))) = f(m) \] This signifies that the function is dimensionally correct when its output, after scaling the input to a different unit system and then scaling the result back, remains identical to the original output.
is dimensionally correct iff
#isDimensionallyCorrect_fun_leftLet be a unit-dependent type and be any type. A function is **dimensionally correct** if and only if for all unit systems and all , the function satisfies: \[ f(\text{scaleUnit}(u_2, u_1, m)) = f(m) \] This property states that is dimensionally correct if its output remains invariant when its input is scaled according to a change in unit systems.
is dimensionally correct iff
#isDimensionallyCorrect_fun_rightLet be a type and be a unit-dependent type. A function is **dimensionally correct** if and only if for all unit systems and for all , the scaling operation satisfies: \[ \text{scaleUnit}(u_1, u_2, f(m)) = f(m) \] This means that a function into a unit-dependent type is dimensionally correct if and only if its output values are themselves invariant under any change of unit systems.
Scaling unit choices distributes over dimensionful multiplication
#hMul_scaleUnitLet , and be types that carry physical dimensions, and let there be a dimensionful multiplication operation . For any elements and , and any two unit systems , the product of the elements scaled from to is equal to the scaling of their product: where denotes the conversion of a quantity from unit system to according to its physical dimension.
The set of elements in with dimension
#DimSetGiven a type equipped with a scalar action of the non-negative real numbers and a unit-dependent structure, and a physical dimension , the set is the collection of elements that scale according to the dimension under a change of units. Specifically, an element belongs to this set if for any two unit systems , the scaling operation satisfies: where is the scaling factor associated with the dimension when converting from unit choice to .
-action on the set of elements with dimension
#instMulActionNNRealElemDimSetGiven a type equipped with a multiplicative action of non-negative real numbers and a unit-dependent structure, the subset consisting of elements with physical dimension is also equipped with a multiplicative action of . Specifically, for any and , the scalar product remains an element of , as it scales correctly according to dimension under a change of units.
The physical dimension of is
#instCarriesDimensionElemDimSetLet be a type equipped with a multiplicative action of the non-negative real numbers and a unit-dependent structure. For any physical dimension , the set , which consists of elements that scale according to under a change of units, is assigned the physical dimension .
Scaling in is consistent with scaling in
#scaleUnit_dimSet_valLet be a type equipped with a multiplicative action of the non-negative real numbers and a unit-dependent structure. For any physical dimension , let be the set of elements in that scale according to under a change of units. For any element and any two unit systems , the underlying value in of the scaled element is equal to the scaling of the underlying value directly in :
iff its scaling matches the dimension scale factor
#mem_iffLet be a type equipped with a scalar action of the non-negative real numbers and a unit-dependent structure. For any physical dimension and any element , belongs to the set if and only if for all pairs of unit choices , the scaling operation satisfies: where is the scaling factor for dimension between unit choices and .
