Using Units - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Using Units and Dimensions

 

Introduction

Entering Units

Operating Environments

Unit conversions

Example: How much space does 1 billion dollars worth of gold occupy?

See Also

Introduction

Maple provides a comprehensive package for managing units and dimensions. Problems in science and engineering can now be fully managed with appropriate dimensions in any modern unit system (and even some historical systems!), including MKS, FPS, CGS, atomic, and more. Over 500 standard units are recognized by the Maple Units package.

 

This document explains how the Units package is structured, how to do simple and complex conversions between units, and how to use units in a Maple document. It also gives tips and examples on how to effectively use the different notation styles, how to change the default measurement system, and how to customize defaults in an existing measurement system.

 

For an introductory tutorial on units, see the Units & Tolerances.  For more detailed help on the support for units and dimensions in Maple, see the Units package.

Entering Units

You can enter units by clicking the appropriate symbol in the Units palette on the left or by using the Units hot key:

 - Ctrl + Shift + U : Windows, Linux

 - Command + Shift + U : Mac
 - Alt + Shift + U : Linux  

Operating Environments

Default Environment: For basic units support, you do not need to load the Units package. Maple will allow you to assign units to variables and expressions through the Units palette and perform calculations with them. The unit names are treated as non-assigned symbols and will be manipulated to give the correct combination of units in your results.

 

However, you can perform unit conversions and simplifications on your expressions by using the Context Panel.

 

For more details on the Default units environment, click here.

Default Environment Examples

restart

mass:=90.4kg:

l:=34cm:

t:=24.5s:

f1masslt2 = 5.120533111kgcms2 

From the Context Panel, select Units>Simplify to give: 0.05120533111N

Simple Environment: Establishes an environment in which some functions, including the ones for basic arithmetic, are modified to accept input with units.

 

In contrast to the Natural and Standard environments, unassigned variables are not automatically assumed to represent unit-free quantities. For example, 5m+x is a valid expression if x is unassigned, because x may represent a length. On the other hand, 5m+x6s+x is an invalid expression, because the first factor implies that x represents a length, whereas the second factor implies that x is a duration.

 

By default, the Simple Environment is loaded automatically when you load the Units package.

 

You assign units to variables or expressions either using the Unit function or the Units palette on the left.  If you do not find the unit you need, simply select the unit symbol and enter the unit name into the placeholder.

For more details on Units[Simple], click here.

Simple Environment Examples

restart

withUnitsSimple:

 

3cm+2m = 203100m

mass:=90.4kg:

l:=34cm:

t:=24.5s:

 

f3masslt2 = 0.05120533110N 

 

ⅆⅆss2 = 2s 

 

Standard Environment: Allows you to take full advantage of the units and dimensions support in the Units package. Unit names are separated from variable names so that you can still use variables with the same name for other computations.

 

You assign units to variables or expressions either using the Unit function or the Units palette on the left.  If you do not find the unit you need, simply select the unit symbol and enter the unit name into the placeholder.

 

For more details on Units[Standard], click here.

Standard Environment Examples

restart

withUnitsStandard:

 

mass:=90.4kg:

l:=34cm:

t:=24.5s:

 

f3masslt2 = 0.05120533110N

 

ⅆⅆss2 = 2s

 

Natural Environment: You can express unit variables as ordinary variables without special notation.

 

This convenient notation is very readable, and is suitable for many situations, including interactive calculations where you have a limited number of user-defined variable names.

The Natural units notation is suitable for situations in which you are confident you will not create naming conflicts or expressions that appear ambiguous. Because the Units package supports many units, many names are "taken" when the Natural notation is used. This list will contain many unit names which you may not even be aware are units, for example, f, year, barn, and Pa. Using these names as variables could inadvertently create problems with your calculations.

 

For more details on Units[Natural], click here.

 

Natural Environment Examples

restart

withUnitsNatural:

4.2m+32cm = 4.520000000m

f2masslt2 = 11000000000massm3kg2 

 

But, because s is defined as seconds in the Natural units environment, if you attempt to use it in a symbolic calculation, it results in an error.

ⅆⅆss2

Error, (in Units:-Standard:-diff) wrong number (or type) of parameters in function Units:-Standard:-diff

 

 

Units Package:  Loading the Units package does not enable a separate units environment. Instead, it loads one of the three non-default environments listed above; by default the Simple Environment. In addition, the Units package provides functions that allow you to make changes to the units support: add new units, rename existing ones, even create your own systems of units.

 

For more information, click here.

 

Examples using the Units package

Converting between Measurement Systems

Maple automatically converts the answer to a default unit system and unit. SI is the default unit system used by the Units package.

 

restart

withUnits:

Automatically loading the Units[Simple] subpackage


myDist :=4ft+3.5inches = 1.308100000m 

You can easily express the above in the standard US (FPS: foot-pound-second) system using the convert command.

myDistconvert myDist, system, FPS = 4.291666667ft   

 

The default unit system can be changed using the Units[UseSystem] command.

UnitsUseSystemFPS:

myDist 4km+3.5mile = 31603.35958ft 

 

 

 

 

 

 

Finding what Unit Systems are Available

GetSystems() returns an expression sequence of all systems of units.

restart

withUnits:

Automatically loading the Units[Simple] subpackage


GetSystems = Atomic,CGS,EMU,ESU,FPS,MKS,MTS,SI

 

Redefining Default Units inside a Measurement System

Inside each measurement system, each dimension has a specified default unit. For example, all length calculations done inside the SI system return answers in meters. It is possible to change the default unit for a particular dimension, which will be respected even after combining and simplifying units, while leaving the rest of the measurement system unchanged.

 

withUnits:

Automatically loading the Units[Simple] subpackage


AddSystemNewSI,GetSystemSI,mm:

UseSystemNewSI:

Unit50000.cm2,Unit3.cm,Unit11.ft3 = 50000.cm2,3.cm,11.ft3   

 

Unit conversions

For simple conversions between units, the convenient Units Converter is available.

From Tools menu, select Assistants>Units Converter or in Maple help, type assistants/Units.  No knowledge of the Units package is required. All the available dimensions and units are selected from a list, so you know instantly what is available with no worries over choosing the proper spelling or abbreviation.

The convert command

The Maple convert command can be used directly for unit conversions without the withUnits command.

 

To determine the conversion factor, use an unassigned variable in the convert command. For example, to see the conversion formula from calories to joules:

restart

convert(1.0,units,ft,m) = 0.3048000000 

convert(x,units,cal,J) = 523x125 

Temperature conversions

The units conversion for temperature converts changes (for example, a temperature change of 5° Celsius is the same as a change of 9° Fahrenheit). To convert absolute temperatures from one scale to another, use the temperature option to convert.

convert(5,units,degC,degF) = 9 

convert(0,temperature,degC,degF) = 32 

Angle Conversions

All trigonometric functions in Maple expect angles in radians. In the Units[Simple] mode, you can simply enter the angle in any units and Maple automatically performs the conversion.

withUnits:

Automatically loading the Units[Simple] subpackage

 

α45.deg:

cosα = 0.7071067811 

Displaying results in the units you want

Sometimes, you will need to change the units of your result from the units computed by Maple. To do this, from the Context Panel for the result, select Units>Replace Units, and then enter your desired units.

 

If you enter units with incompatible dimensions, you will get an error message.

withUnits:

Automatically loading the Units[Simple] subpackage


distance:=5.0m:

elapsedtime:=10s:

speed:=distanceelapsedtime = 0.5000000000ms 

To convert to miles per hour, select Units>Replace Units, and then enter your desired units: 1.118468146mih 

 

Example: How much space does 1 billion dollars worth of gold occupy?

Initialize the Units package.

restart

withUnits:

Automatically loading the Units[Simple] subpackage


First, define the dollar value of the gold, cost per troy ounce (assume $268), and the density.

val:=109USD:

costPerOz:=268.00USDoztroy:

density:=19.3gcm3 = 19.3gcm3 

 

The resulting mass and volume are:

mass:=valcostPerOz = 1.160577493105kg 

volume:=massdensity = 6.013354886m3 

 

What is the length of one side of a cube having this volume?

LengthSide:=volume3 = 1.818467785m 

See Also

Units Converter, Units Package Index