Unit system for physical quantities; include definition of constants.
Class for the units.
A unit is defined by two things:
The factor represents the position of the unit with respect to the canonical unit of this dimension. For example if we choose the gram to be the canonical dimension for the mass, then by definition its factor is 1; on the other hand the factor defined here for kilogram is 1000, even when it is a base unit. The explanation is that here we do not have defined any system that we could use as a reference: here the canonical unit is the only scale, and thus the only available origin.
Additionnaly one can add a prefix and an abbreviation. The only utility of the former is to provide a shorthand for some units, but it is never used among computations; it appears only when defining and printing units. The same remark applies to the abbreviation.
All operations (pow, mul, etc.) are defined as the corresponding ones acting on the factor (a number) and the dimension.
Symbol representing the unit name.
Prepend the abbreviation with the prefix symbol if it is defines.
Convert the unit to a quantity.
The quantity unit is given by the unit of factor 1 and with identical dimension.
>>> from sympy.physics.unitsystems.dimensions import Dimension
>>> from sympy.physics.unitsystems.units import Unit
>>> length = Dimension(length=1)
>>> u = Unit(length, factor=10)
>>> q = u.as_quantity
>>> q.factor
10
>>> q.unit == Unit(length)
True
Physical constant.
In our framework a constant is considered as a unit, to which humans givesa special sense, because we believe that they give us a special information on nature; but it is just a demonstration of our ignorance.
UnitSystem represents a coherent set of units.
A unit system is basically a dimension system with notions of scales. Many of the methods are defined in the same way.
It is much better if all base units have a symbol.
Give the dimension of the system.
That is return the number of units forming the basis.
Extend the current system into a new one.
Take the base and normal units of the current system to merge them to the base and normal units given in argument. If not provided, name and description are overriden by empty strings.