unit name - Maple Help

convert/unit_name

convert units to unit names

 Calling Sequence convert(u, unit_name)

Parameters

 u - expression with units

Description

 • The $\mathrm{convert}\left(u,\mathrm{unit_name}\right)$ function returns a representation of the unit part of the expression $u$ that can be easily manipulated programmatically.
 • First this procedure determines the unit of $u$. Then every unit name or symbol in this unit expression is replaced by the function call $\mathrm{Units}:-\mathrm{UnitName}\left(\mathrm{string form of the full unit name}\right)$. The unit-free factor, if present, is ignored.
 • If there are annotations, then the base unit name (including its context, if applicable) is converted to a string; the resulting string is applied, as a function call, to the string form of the annotations.
 • The recommended way to convert units to a particular system or otherwise control the format of units is to do this before calling $\mathrm{convert}\left(\mathrm{...},\mathrm{unit_name}\right)$, using commands such as $\mathrm{combine}$ and $\mathrm{convert}$.

Examples

The unit-free factor is ignored.

Notes:

 – To enter a unit in 2-D Math input, select the unit from the appropriate Units palette. If the unit you want is not there, select $\mathrm{unit}$ and then enter the unit.
 – When you edit a unit, double brackets appear around it.
 > $\mathrm{convert}\left(45\mathrm{sin}\left(x\right)\mathrm{Unit}\left(\mathrm{farad}\right),'\mathrm{unit_name}'\right)$
 ${\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"farad"}\right)$ (1)

You always get the full name (farad), even if you supply only the symbol (F). Prefixes are respected.

 > $\mathrm{convert}\left(2\mathrm{Unit}\left(\mathrm{uF}\right),'\mathrm{unit_name}'\right)$
 ${\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"microfarad"}\right)$ (2)

Contexts or annotations are also maintained.

 > $\mathrm{convert}\left(2\mathrm{Unit}\left(\mathrm{mile}\left[\mathrm{nautical}\right]\left(\mathrm{radius}\right)\right),'\mathrm{unit_name}'\right)$
 ${\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"mile\left[nautical\right]"}{}\left({"radius"}\right)\right)$ (3)

In case you would prefer units to be converted to a particular system, it is best to do that before the conversion to unit names.

 > $a≔\frac{5.8\mathrm{Unit}\left(\mathrm{pound}\right)\mathrm{Unit}\left(\mathrm{ft}\right)}{{\mathrm{Unit}\left(s\right)}^{2}}$
 ${a}{≔}\frac{{5.8}}{{⟦{s}⟧}^{{2}}}{}⟦{\mathrm{lb}}⟧{}⟦{\mathrm{ft}}⟧$ (4)
 > $\mathrm{convert}\left(a,'\mathrm{unit_name}'\right)$
 $\frac{{\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"pound"}\right){}{\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"foot"}\right)}{{{\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"second"}\right)}^{{2}}}$ (5)
 > $\mathrm{a1}≔\mathrm{combine}\left(a,'\mathrm{units}'\right)$
 ${\mathrm{a1}}{≔}{0.8018787354}{}⟦{N}⟧$ (6)
 > $\mathrm{convert}\left(\mathrm{a1},'\mathrm{unit_name}'\right)$
 ${\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"newton"}\right)$ (7)
 > $\mathrm{a2}≔\mathrm{convert}\left(a,'\mathrm{system}','\mathrm{base}'\right)$
 ${\mathrm{a2}}{≔}{0.8018787354}{}⟦\frac{{\mathrm{kg}}{}{m}}{{{s}}^{{2}}}⟧$ (8)
 > $\mathrm{convert}\left(\mathrm{a2},'\mathrm{unit_name}'\right)$
 $\frac{{\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"kilogram"}\right){}{\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"meter"}\right)}{{{\mathrm{Units}}{:-}{\mathrm{UnitName}}{}\left({"second"}\right)}^{{2}}}$ (9)

Compatibility

 • The convert/unit_name command was introduced in Maple 17.