Overview - Maple Help

Overview of the Units[Simple] Subpackage

Basic Functionality

 • The Units[Simple] subpackage provides an environment that allows users to work with units in their computations. The with(Units[Simple]) command establishes an environment in which some functions, including the ones for basic arithmetic, are modified to accept input with units. By default, the with(Units) command does the same.
 • Every command in the Simple Units environment that needs to determine whether an expression is valid or not, does so using the Units[TestDimensions] command.
 • To use the Simple Units environment, enter units using the Unit command, *Unit(unit_name).
 • In the Simple Units environment, in contrast to the Standard and Natural environments, unassigned variables are not automatically assumed to represent unit-free quantities. For example, $5⟦m⟧+x$ is a valid expression if $x$ is unassigned, because $x$ may represent a length. On the other hand, $\left(5⟦m⟧+x\right)\left(6⟦s⟧+x\right)$ is an invalid expression, because the first factor implies that $x$ represents a length, whereas the second factor implies that $x$ is a duration.
 • In the Simple Units environment, any verifications of valid dimensions ignore so-called Unit annotations. As a consequence, for example, you can add angles to unit-free quantities.
 • When using the Units[Simple] 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[Simple]) command does not allow the use of the short form of the Units package commands that customize the dimensions, units, and systems of units. In order to do that, it is necessary to enter the with(Units) command (which, by default, also loads the Units[Simple] package). For a list of the commands in the Units package, see Units.

Accessing the Simple Units Environment

 • To include units in an expression or to use a redefined Units[Simple] subpackage command in the current Maple session, enter the with(Units[Simple]) command first. Alternatively, you can enter the with(Units) command: this loads the Units package and then the subpackage corresponding to the currently selected mode (using the Units[UseMode] command). The default mode is simple, corresponding to the Units[Simple] subpackage.
 Note: Prior to Maple 2015, units were displayed surrounded by double brackets.
 > with(Units[Simple]):
 > 3*Unit('cm') + 2*Unit('m');
 $\frac{{203}}{{100}}{}⟦{m}⟧$ (1)

Redefined Simple Units Environment Commands

 The commands redefined in the Simple 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 Simple 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{Simple}\right]\right):$
 > $\mathrm{a_length}≔2\mathrm{Unit}\left('m'\right)$
 ${\mathrm{a_length}}{≔}{2}{}⟦{m}⟧$ (2)
 > $\mathrm{a_width}≔3\mathrm{Unit}\left('m'\right)$
 ${\mathrm{a_width}}{≔}{3}{}⟦{m}⟧$ (3)
 > $\mathrm{an_area}≔\mathrm{a_length}\mathrm{a_width}$
 ${\mathrm{an_area}}{≔}{6}{}⟦{{m}}^{{2}}⟧$ (4)

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}}⟧$ (5)
 > $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}⟧$ (6)
 > $\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}}⟧$ (7)
 > $\mathrm{collect}\left(,x\right)$
 $\left({12}{}{{x}}^{{3}}{+}\frac{{2286}}{{625}}{}{{x}}^{{2}}{}{y}{-}\frac{{3048}}{{625}}{}{x}{}{{y}}^{{2}}{+}\frac{{762}}{{625}}{}{{y}}^{{3}}\right){}⟦\frac{{m}}{{s}}⟧$ (8)
 > $\cdot 625$
 $\left({7500}{}{{x}}^{{3}}{+}{2286}{}{{x}}^{{2}}{}{y}{-}{3048}{}{x}{}{{y}}^{{2}}{+}{762}{}{{y}}^{{3}}\right){}⟦\frac{{m}}{{s}}⟧$ (9)
 > $\mathrm{convert}\left(,'\mathrm{units}',\frac{'\mathrm{mi}'}{'h'}\right)$
 $\left(\frac{{23437500}}{{1397}}{}{{x}}^{{3}}{+}\frac{{56250}}{{11}}{}{{x}}^{{2}}{}{y}{-}\frac{{75000}}{{11}}{}{x}{}{{y}}^{{2}}{+}\frac{{18750}}{{11}}{}{{y}}^{{3}}\right){}⟦\frac{{\mathrm{mi}}}{{h}}⟧$ (10)
 > $\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}⟧$ (11)

The following example uses the fact that the Simple Units environment doesn't assume that unassigned variables are unit-free.

Let $\mathrm{x1}$ and $\mathrm{x2}$ be the positions of the front and rear of an 80.6 meters long train car, as a function of time.

 > $\mathrm{x2}≔t↦\mathrm{x1}\left(t\right)+80.6\cdot \mathrm{Unit}\left(m\right):$

Then the velocity of the front and back of the train car are always the same.

 > $\mathrm{diff}\left(\mathrm{x2}\left(t\right),t\right)$
 $\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{x1}}{}\left({t}\right)$ (12)

Compatibility

 • The Units[Simple] subpackage was introduced in Maple 2017.