unit-free - Maple Help

convert/unit_free

convert to unit-free form

 Calling Sequence convert(u, unit_free, unit)

Parameters

 u - expression unit - (optional) name

Description

 • The convert(u, unit_free) function returns the unit-free component of u. If u is of type unit, then $1$ is returned.
 • The convert(u, unit_free, unit) function returns the unit-free component of u and assigns the unit component of u to unit. If u is of type unit, then $1$ is returned. If u is unit-free, then $1$ is assigned to unit.
 • The term unit-free describes a scalar quantity with no (multiplicative) unit attached to it. Conversion to unit-free does not apply directly to any non-scalar Maple object or data structure, which may still have units embedded within it.

Examples

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(100.0,\mathrm{unit_free}\right)$
 ${100.0}$ (1)
 > $\mathrm{convert}\left(234,\mathrm{unit_free},'\mathrm{unit1}'\right)$
 ${234}$ (2)
 > $\mathrm{unit1}$
 ${1}$ (3)
 > $\mathrm{expr}≔\mathrm{convert}\left(45\mathrm{sin}\left(x\right)\mathrm{Unit}\left(\mathrm{farad}\right),\mathrm{unit_free},'\mathrm{unit2}'\right)$
 ${\mathrm{expr}}{≔}{45}{}{\mathrm{sin}}{}\left({x}\right)$ (4)
 > $\mathrm{unit2}$
 $⟦{F}⟧$ (5)
 > $a≔\mathrm{expr}\mathrm{unit2}$
 ${a}{≔}{45}{}{\mathrm{sin}}{}\left({x}\right){}⟦{F}⟧$ (6)

The conversion to unit_free state does not recurse into, or map over, non-scalar objects. Examples illustrating such mapping or effective unit-stripping recursion are shown below.

 > $M≔\mathrm{Vector}\left[\mathrm{row}\right]\left(\left[3\mathrm{Unit}\left(\mathrm{gram}\right),5\mathrm{Unit}\left(\mathrm{kilogram}\right)\right]\right)$
 ${M}{≔}\left[\begin{array}{cc}{3}{}⟦{g}⟧& {5}{}⟦{\mathrm{kg}}⟧\end{array}\right]$ (7)
 > $\mathrm{map}\left(\mathrm{convert},M,\mathrm{unit_free}\right)$
 $\left[\begin{array}{cc}{3}& {5}\end{array}\right]$ (8)
 > $t≔\mathrm{Int}\left(\mathrm{sin}\left(x\right)\mathrm{Unit}\left(\mathrm{meter}\right),x=1\mathrm{Unit}\left(s\right)..10\mathrm{Unit}\left(s\right)\right)$
 ${t}{≔}{{\int }}_{⟦{s}⟧}^{{10}{}⟦{s}⟧}{\mathrm{sin}}{}\left({x}\right){}⟦{m}⟧\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (9)
 > $\mathrm{subsindets}\left(t,\mathrm{with_unit},z↦\mathrm{convert}\left(z,\mathrm{unit_free}\right)\right)$
 ${{\int }}_{{1}}^{{10}}{\mathrm{sin}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (10)
 > $\mathrm{subsindets}\left(t,\mathrm{specfunc}\left(\mathrm{anything},\mathrm{Units}:-\mathrm{Unit}\right),1\right)$
 ${{\int }}_{{1}}^{{10}}{\mathrm{sin}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (11)

If a non-scalar object contains a mix of units then it may be desirable to combine the units or convert to a single system, so as to get correct scaling.

 > $\mathrm{expr}≔\mathrm{Mrange}=\left[3\mathrm{Unit}\left(\mathrm{kg}\right)..5\mathrm{Unit}\left(g\right)\right]$
 ${\mathrm{expr}}{≔}{\mathrm{Mrange}}{=}\left[{3}{}⟦{\mathrm{kg}}⟧{..}{5}{}⟦{g}⟧\right]$ (12)
 > $\mathrm{subsindets}\left(\mathrm{expr},\mathrm{with_unit},z↦\mathrm{convert}\left(\mathrm{combine}\left(z,\mathrm{units}\right),\mathrm{unit_free}\right)\right)$
 ${\mathrm{Mrange}}{=}\left[{3}{..}\frac{{1}}{{200}}\right]$ (13)
 > $\mathrm{expr}≔\mathrm{Mrange}=\left[3\mathrm{Unit}\left(\mathrm{kg}\right)..5\mathrm{Unit}\left(\mathrm{lb}\right)\right]$
 ${\mathrm{expr}}{≔}{\mathrm{Mrange}}{=}\left[{3}{}⟦{\mathrm{kg}}⟧{..}{5}{}⟦{\mathrm{lb}}⟧\right]$ (14)
 > $\mathrm{subsindets}\left(\mathrm{expr},\mathrm{with_unit},z↦\mathrm{convert}\left(\mathrm{convert}\left(z,'\mathrm{system}',\mathrm{FPS}\right),\mathrm{unit_free}\right)\right)$
 ${\mathrm{Mrange}}{=}\left[\frac{{300000000}}{{45359237}}{..}{5}\right]$ (15)