Overview of the Units[Standard] Subpackage - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Units : Environments : Standard : Units/Standard

Overview of the Units[Standard] Subpackage

Basic Functionality

 • The Units[Standard] subpackage provides an environment that allows users to work with units in their computations. The with(Units[Standard]) command establishes an environment in which some functions, including the ones for basic arithmetic, are modified to accept input with units.
 • To use the Standard Units environment, enter units using the Unit command, *Unit(unit_name).
 • When using the Units[Standard] package, units will by default be converted to your selected unit system. (The default system is SI, the metric system.)  To change the default system of units, use the UseSystem command.
 • The with(Units[Standard]) command does not allow the use of the short form of the Units package commands that customize the dimensions, units, and systems of units. It is necessary to enter the with(Units) command. For a list of the commands in the Units package, see Units.

Accessing the Standard Units Environment

 • To include units in an expression or to use a redefined Units[Standard] subpackage command in the current Maple session, enter the with(Units[Standard]) command first.
 Note: Prior to Maple 2015, units were displayed surrounded by double brackets.
 > with(Units[Standard]):
 > 3*Unit('cm') + 2*Unit('m');
 $\frac{{203}}{{100}}{}⟦{m}⟧$ (1)
 • Loading the Units package (which allows you to use the short form to access Units package commands) additionally loads one of the Units subpackages; by default, this is the Units[Simple] package. If you want to use the short form to access Units package commands together with the Standard Units environment, you can do this in at least two ways:
 – You can load the Units and Units[Standard] packages. This works in either order: if you load the Units package first, it will by default load the Units[Simple] package, but loading the Units[Standard] package overrides this. If you load the Units[Standard] package first, then the Units package detects this when it is loaded and it doesn't load a subpackage.
 – Alternatively, you can instruct the Units package to load the Units[Standard] subpackage when it is loaded. You can do this with the Units[UseMode] command before loading the Units package:
 > restart;
 > Units[UseMode](standard);
 ${\mathrm{simple}}$ (2)
 > with(Units):
 > 3*Unit('cm') + 2*Unit('m');
 $\frac{{203}}{{100}}{}⟦{m}⟧$ (3)

Redefined Standard Units Environment Commands

 The commands redefined in the Standard Units environment to accept input with units are:

 To display the help page for a particular command, click the corresponding hyperlink.
 • For more information on the interaction of these commands, see the Standard Units Example Worksheet.

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{with}\left(\mathrm{Units}\left[\mathrm{Standard}\right]\right):$
 > $\mathrm{a_length}≔2\mathrm{Unit}\left('m'\right)$
 ${\mathrm{a_length}}{≔}{2}{}⟦{m}⟧$ (4)
 > $\mathrm{a_width}≔3\mathrm{Unit}\left('m'\right)$
 ${\mathrm{a_width}}{≔}{3}{}⟦{m}⟧$ (5)
 > $\mathrm{an_area}≔\mathrm{a_length}\mathrm{a_width}$
 ${\mathrm{an_area}}{≔}{6}{}⟦{{m}}^{{2}}⟧$ (6)

If an input has only one unit, the output uses that unit. If an input has more than one unit, the output is automatically converted to the default unit in the current system of units. The default system of units in the Units package is SI. To change the default system of units, use the UseSystem command.

 > $3{x}^{4}\mathrm{Unit}\left('\mathrm{ft}'\right)+4xy{\left(y-x\right)}^{2}\mathrm{Unit}\left('\mathrm{ft}'\right)$
 $\left({3}{}{{x}}^{{4}}{+}{4}{}{x}{}{y}{}{\left({y}{-}{x}\right)}^{{2}}\right){}⟦{\mathrm{ft}}⟧$ (7)
 > $3{x}^{4}\mathrm{Unit}\left('m'\right)+4xy{\left(y-x\right)}^{2}\mathrm{Unit}\left('\mathrm{ft}'\right)$
 $\left({3}{}{{x}}^{{4}}{+}\frac{{762}{}{x}{}{y}{}{\left({y}{-}{x}\right)}^{{2}}}{{625}}\right){}⟦{m}⟧$ (8)
 > $\mathrm{diff}\left(,x\mathrm{Unit}\left('s'\right)\right)$
 $\left({12}{}{{x}}^{{3}}{+}\frac{{762}{}{y}{}{\left({y}{-}{x}\right)}^{{2}}}{{625}}{-}\frac{{1524}{}{x}{}{y}{}\left({y}{-}{x}\right)}{{625}}\right){}⟦\frac{{m}}{{s}}⟧$ (9)
 > $\mathrm{collect}\left(,x\right)$
 $\left({12}{}{{x}}^{{3}}{+}\frac{{2286}}{{625}}{}{y}{}{{x}}^{{2}}{-}\frac{{3048}}{{625}}{}{{y}}^{{2}}{}{x}{+}\frac{{762}}{{625}}{}{{y}}^{{3}}\right){}⟦\frac{{m}}{{s}}⟧$ (10)
 > $\cdot 625$
 $\left({7500}{}{{x}}^{{3}}{+}{2286}{}{y}{}{{x}}^{{2}}{-}{3048}{}{{y}}^{{2}}{}{x}{+}{762}{}{{y}}^{{3}}\right){}⟦\frac{{m}}{{s}}⟧$ (11)
 > $\mathrm{convert}\left(,'\mathrm{units}',\frac{'\mathrm{mi}'}{'h'}\right)$
 $\left(\frac{{23437500}}{{1397}}{}{{x}}^{{3}}{+}\frac{{56250}}{{11}}{}{y}{}{{x}}^{{2}}{-}\frac{{75000}}{{11}}{}{{y}}^{{2}}{}{x}{+}\frac{{18750}}{{11}}{}{{y}}^{{3}}\right){}⟦\frac{{\mathrm{mi}}}{{h}}⟧$ (12)
 > $\mathrm{eval}\left(,\left[x=3\mathrm{Unit}\left('s'\right),y=4\mathrm{Unit}\left('\mathrm{min}'\right)\right]\right)$
 ${10012333860}{}⟦{{s}}^{{2}}{}{m}⟧$ (13)