Units - Maple Help

Home : Support : Online Help : Science and Engineering : Units : Manipulating Systems : Units/UseUnit

Units

 UseUnit
 set a default unit

 Calling Sequence UseUnit(unit)

Parameters

 unit - unit name or unit expression ; default unit to use for its dimension

Description

 • The UseUnit command is used to select a unit that is to be used for computations in the Units package. The return value is either true or false, indicating whether this overwrites a previous selection given with the same command.
 • If the Units[Standard] or Units[Natural] package is loaded, then whenever different unit expressions are multiplied, Maple converts units into the default unit for that dimension. When adding unit expressions with different units (but with the same dimension), Maple does the same. If the packages are not loaded, then the same can be achieved by using the combine/units procedure. There are two ways to control what the default unit for a given dimension is:
 – The Units[UseSystem] command can be used to select a coherent system of units that the default units are taken from, such as the SI system or the FPS system. One can define a new, custom system using the Units[AddSystem] command.
 – This command, Units[UseUnit], can be used to override the choice of unit for any single dimension.
 • To set a default unit for a given dimension for all future Maple sessions, add the UseUnit command to your Maple initialization file. For more information, see Create Maple Initialization File.
 • By default, running the Units[UseSystem] command will overwrite the current set of units selected with the UseUnit command. This can be prevented by using the keepOverrides option to that command. Furthermore, the convert/system command will by default convert purely to the system specified, disregarding units selected with UseUnit. This can be prevented by using the respectOverrides option to the convert/system command.

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.
 – In Maple 2015 and later versions, the double brackets around a unit are not displayed unless you are editing the unit.
 > $\mathrm{with}\left(\mathrm{Units}\right):$
 > $3.23⟦\frac{'\mathrm{mi}'}{'h'}⟧$
 ${3.23}{}⟦\frac{{\mathrm{mi}}}{{h}}⟧$ (1)
 > $\mathrm{combine}\left(3.23⟦\frac{'\mathrm{mi}'}{'h'}⟧,'\mathrm{units}'\right)$
 ${1.443939200}{}⟦\frac{{m}}{{s}}⟧$ (2)

We select a unit for the dimensions speed and length.

 > $\mathrm{UseUnit}\left('\frac{\mathrm{ft}}{s}'\right):$$\mathrm{UseUnit}\left(⟦'\mathrm{mm}'⟧\right):$
 > $\mathrm{combine}\left(3.23⟦\frac{'\mathrm{mi}'}{'h'}⟧,'\mathrm{units}'\right)$
 ${4.737333333}{}⟦\frac{{\mathrm{ft}}}{{s}}⟧$ (3)
 > $\mathrm{convert}\left(3.23,'\mathrm{system}','\mathrm{ft}','\mathrm{SI}'\right)$
 ${0.9845040000}$ (4)
 > $\mathrm{convert}\left(3.23,'\mathrm{system}','\mathrm{ft}','\mathrm{SI}','\mathrm{respectOverrides}'\right)$
 ${984.5040000}$ (5)

We load the Units[Standard] package and reset the overridden units by selecting the (default) SI system.

 > $\mathrm{with}\left(\mathrm{Units}[\mathrm{Standard}]\right):$$\mathrm{UseSystem}\left('\mathrm{SI}'\right):$
 > $\mathrm{speed}≔32⟦\frac{'m'}{'s'}⟧$
 ${\mathrm{speed}}{:=}{32}{}⟦\frac{{m}}{{s}}⟧$ (6)
 > $\mathrm{duration}≔2⟦'s'⟧$
 ${\mathrm{duration}}{:=}{2}{}⟦{s}⟧$ (7)
 > $\mathrm{speed}\mathrm{duration}$
 ${64}{}⟦{m}⟧$ (8)

Now we select the unit mm for lengths.

 > $\mathrm{UseUnit}\left('\mathrm{mm}'\right):$
 > $\mathrm{speed}\mathrm{duration}$
 ${64000}{}⟦{\mathrm{mm}}⟧$ (9)

Compatibility

 • The Units[UseUnit] command was introduced in Maple 15.