Quantity

Quantity[magnitude,unit]
represents a quantity with size magnitude and the unit specified by unit.

Quantity[unit]
assumes the magnitude of the specified unit to be 1.

Details and OptionsDetails and Options

  • Quantity has attribute HoldRest and preserves the structure of unit.
  • With the option setting ThreadDepth->d, Quantity[list,unit] will automatically thread the specified unit to depth d of list.
  • The specified unit should be a string or operation of strings representing the Quantity expression's unit value.
  • Quantity[unit] will produce a canonicalized Quantity with a magnitude of 1.
  • Quantity expressions can be created by using the Ctrl+Equal free-form linguistics interface.
  • Quantity will automatically attempt to parse an unknown unit string to its canonical form.
  • Supported units include all those specified by NIST Special Publication 811.
  • For purely numeric units, such as percents, Normal[expr] converts a Quantity object to an ordinary number.

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

A Quantity represents a value associated with a specific unit:

In[1]:=
Click for copyable input
Out[1]=

A unit can be a string or a product of strings:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Valid unit specifications include a number of physical constants:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Quantity will automatically attempt to interpret an unknown unit string:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2012
(9.0)
| Updated in 2014
(10.0)