represents a quantity with size magnitude and unit specified by unit.
assumes the magnitude of the specified unit to be 1.
- In Quantity[m,u], the unit u can be given as a string, such as "Meters", or a product of powers of units, such as "Meters"/"Seconds"^2.
- Supported units include all those specified by NIST Special Publication 811.
- Quantity expresses temperatures using units such as "DegreesCelsius" and temperature differences using units such as "DegreesCelsiusDifference". Quantity arithmetic operations systematically distinguish this.
- Quantity operations systematically distinguish temperatures, expressed using units such as "DegreesCelsius", from temperature differences, expressed using units such as "DegreesCelsiusDifference".
- Quantity[unit] will produce a canonicalized Quantity with a magnitude of 1.
- Quantity expressions can be created by using the free-form linguistics interface.
- Quantity will automatically attempt to parse an unknown unit string to its canonical form.
- Quantity has attribute HoldRest and preserves the structure of unit.
- For purely numeric units, such as percents, Normal[expr] converts a Quantity object to an ordinary number.
- Information of a Quantity may include the following properties:
"Magnitude" quantity magnitude "Unit" unit associated with the quantity "UnitDimensions" physical dimensions of unit "SIBaseUnits" SI base units
Examplesopen allclose all
Basic Examples (4)
A Quantity represents a value associated with a specific unit:
Quantity will automatically attempt to interpret an unknown unit string:
Quantity expressions can be used in comparison functions:
Quantity expressions can be used in various list operations:
Many numerical functions also operate on Quantity expressions:
Integer functions also operate on Quantity expressions:
UnitConvert can be used to find the SI value of physical constants:
Properties & Relations (15)
IndependentUnit specifications can also be used:
In its one-argument form, Quantity automatically sets the magnitude to 1:
Additions of Quantity objects with compatible units will heuristically determine the result units:
Products of Quantity objects with compatible units will heuristically determine the result units:
Quantity threads its unit specification over lists:
Use UnitSimplify to get a simpler form of the unit:
Possible Issues (2)
Quantity automatically attempts to interpret unrecognized unit strings as canonical units:
Some units contain Interval expressions, which can result in comparisons returning unevaluated:
Wolfram Research (2012), Quantity, Wolfram Language function, https://reference.wolfram.com/language/ref/Quantity.html (updated 2022).
Wolfram Language. 2012. "Quantity." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Quantity.html.
Wolfram Language. (2012). Quantity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Quantity.html