Physlib.Units.WithDim.Basic
17 declarations
in
#extLet be a physical dimension and be a type. For any two elements of the type , if their underlying values in are equal (i.e., ), then .
The dimension of is
#instHasDimFor any dimension and any type , the type is equipped with an instance of the `HasDim` typeclass, which assigns it the physical dimension .
The dimension of is
#dim_applyFor any physical dimension and any type , the dimension of the type is equal to , expressed as .
Scalar action of on
#instMulActionNNRealGiven a physical dimension and a type that possesses a scalar action by the non-negative real numbers , the type (representing values of type associated with dimension ) also inherits a scalar action by . For any scalar and any dimensioned quantity , the resulting value is obtained by applying the scalar action to the underlying value of .
for scalar action on dimensioned quantities
#smul_valLet be a physical dimension and be a type equipped with a scalar action by the non-negative real numbers . For any scalar and any dimensioned quantity , the underlying numerical value of the scalar product is equal to the scalar action of on the numerical value of , expressed as .
Multiplication of real quantities with dimensions and resulting in dimension
#instHMulRealHMulDimensionGiven two physical dimensions , let be a real quantity with dimension (of type ) and be a real quantity with dimension (of type ). This definition provides the multiplication operation , which results in a real quantity with the product dimension . The numerical value of the result is the product of the numerical values of and .
Let and be physical dimensions. For any real-valued physical quantities with dimension and with dimension , the numerical value of their product (which has dimension ) is equal to the product of their individual numerical values. That is, where the `.val` operator extracts the underlying real number from the dimension-carrying type.
Multiplication of real quantities with dimensions and resulting in dimension
#instDMulRealHMulDimensionGiven two physical dimensions , let be a real quantity with dimension (of type ) and be a real quantity with dimension (of type ). This definition provides the multiplication operation , which results in a real quantity with the product dimension . The numerical value of the result corresponds to the product of the numerical values of and , while the physical dimension is updated to .
Let and be physical dimensions. For any real-valued physical quantities with dimension (of type ) and with dimension (of type ), the product of their numerical values is equal to the numerical value of their physical product: where is the quantity with dimension resulting from the multiplication of and .
For any physical dimension and any real-valued physical quantity with dimension (of type ), the square of the numerical value of is equal to the numerical value of the product of with itself, denoted as .
Unit scaling preserves equality of numerical values:
#scaleUnit_val_eq_scaleUnit_valLet be a physical dimension and be a type equipped with a scalar action of the non-negative real numbers . For any two choices of unit systems and any two dimensioned quantities , the numerical values of the quantities after scaling from to are equal if and only if their original numerical values are equal: Where denotes the type carrying the dimension , is the underlying numerical value of the quantity , and is the transformation function for transitioning a quantity between unit systems.
Let be a physical dimension and be a type equipped with a scalar action by the non-negative real numbers . For any two unit choices and any quantity with dimension (of type ), the numerical value of the quantity after scaling from unit system to is equal to the scaling factor for dimension between these unit systems applied to the original numerical value of . That is: where denotes the underlying value of the dimensioned quantity , and the operation on the right is the scalar action of on .
Division of real quantities with dimensions and results in dimension
#instHDivRealHMulDimensionInvFor any two physical dimensions , the division of a real-valued quantity of dimension by a real-valued quantity of dimension is defined. The resulting quantity has the dimension and its numerical value is the quotient of the values of and , namely .
For any physical dimensions and any real-valued quantities with dimension and with dimension , the quotient of their numerical values is equal to the numerical value of their dimensional quotient . That is: where denotes the underlying real value of a quantity carrying a dimension.
commutes with division of dimensioned quantities
#div_scaleUnitFor any physical dimensions and any real-valued quantities and , let be two systems of units. The division of the quantities after scaling them from unit system to is equal to the result of scaling their quotient from to . That is: where denotes the conversion of a quantity from unit system to , and the quotient on the right-hand side carries the dimension .
Casting to the same dimension is the identity:
#cast_reflFor any dimension and any type , let be a quantity of type carrying the dimension . Casting to the same dimension (using the reflexivity of equality ) results in the original quantity . That is, .
commutes with
#cast_scaleUnitLet and be physical dimensions, and let be a type equipped with a scalar action of the non-negative real numbers . For any quantity and any two unit systems , if (denoted by the proof ), then casting the scaled quantity to dimension is equivalent to scaling the quantity after it has been cast to dimension . That is,
