Part 10: Units - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Getting Started : Tutorials : MaplePortal/Tutorial10

Part 10: Units

Go to Maple Portal     Previous Tutorial   

 

Introduction

Working with Units

Customizing Unit Settings

Tolerances

See Also

Introduction

Maple's Tutorials are designed to help you get started with Maple, learn about the key tools available in Maple, and lead you through a series of problems.

 

In Part 10: Units, you will learn how to add units to expressions, perform calculations with units, and convert units in Maple.  You will also learn how to customize units settings.  You will use units and tolerances together.

 

To try this material on your own, start with an empty Maple document. Perform the steps described in the left column of each table below.  The results of the steps are displayed in the right column for reference.

 

Refer to Help>Quick Reference for basic getting started tips.

 

Note for non-Windows users: The keystrokes given in this document are for Windows.  There will be differences for other platforms. If you are using a different platform, see Help>Quick Help for the list of the most common keystrokes.

 

Working with Units

Maple provides the most comprehensive package in the software industry for managing units and dimensions.  Over 500 standard units are recognized by Units package.

Steps        

Result

Assigning Units from the Palettes
Use the Units palettes to define values with units. The Units (SI) palette contains units from the metric system while Units (FPS) contains units from the imperial (foot-pound-second) system.

 

Example:

Enter "Length:= 250.00", click on the Units(SI) palette, and select m.

Repeat for Mass and Time.  Note lb is found in the Units(FPS) palette.

Type "Force:= Length*Mass/Time^2" and press [Enter].

 

To simplify the units in this expression, right-click on the result and select Units > Simplify from the context menu.

 

 

Other Units

To use a unit that does not appear in the palettes, use  unit from the palette, and replace unit with the desired unit.  You can enter a unit using its name or symbol.

 

Example:

Enter 60 miles per hour.

 

 

Length:=250.00m:

Mass:=500.00lb:

Time:=25s:

Force:=LengthMassTime2

200.0000000mlbs2

(2.1)

simplify units90.71847400N 

60milehour

60mih

(2.2)

Units Package

 

If the Units package is loaded, simplifications are automatic.


Example:

Type "with(Units[Standard]):" and press [Enter] to load the Units package.

Reenter the computation for force and press [Enter].

Now units are automatically simplified into SI units.

 

 

Example:

Copy and paste 60 miles per hour, and press [Ctrl][=] to see the result inline.

 

The result is converted to meters per second.

 

Now, approximate the answer to 10 decimal places using the context menu item Approximate>10.

 

 

 

Example:

Using the palettes, enter 12 feet + 1 inch.

 

Since the Units[Standard] package is loaded, the result is converted into meters, the SI base unit for length.

 

 

 

 

Tip:  Since in is a keyword in Maple, typing "in" as a unit will return an error.  Instead, use the full name, "inch" or enclose the abbreviation in left single backquotes (` `) to indicate you are using it as a name.  See keyword for more information on reserved names.

 

 

 

 

 

withUnitsStandard:

LengthMassTime2

90.71847400N

(2.3)

60mih = 16764625msat 10 digits26.82240000ms

12ft+1inch

36831000m

(2.4)

3 in

Error, invalid bracketed expression

3

3`in`

3in

(2.5)

Converting Units with Context Menus

 

The context menu item Units>Replace Units will convert your answer into the specified units.  

Example:

Convert this example into kilometers per hour.  Right-click on the expression.  Select Units>Replace Units and type "km/h".

 

 

You can also use the context menu to convert units from one system to another.

 

Example:

Consider the example with feet and inches.  Convert the result into feet.

 

Right-click on the result.  Select Units > Convert > System >FPS  (foot-pound-second) to convert the length into feet.

 

26.82240000msreplace units96.56064000kmh 

12ft+1inch = 36831000munits to FPS system14512ft

 

Customizing Unit Settings

Steps

Result

Setting the Default Unit System

 

You can control the unit system.  Initially, the default system is SI.  To change the default system, use the UseSystem command.

 

Example:

Set the unit system to FPS. .

Now, answers are returned in the FPS system.

 

restart

withUnitsStandard:

withUnits:

UsingSystem

SI

(3.1)

UseSystem'FPS'

12ft+1inch

14512ft

(3.2)

Converting Units with Commands

If necessary, you can customize a unit system for your needs.

 

For instance, consider the FPS units in this example.

Example:

Find the thermal conductivity of a conducting surface from its heat capacity and length.

 

The heat capacity of a conducting surface is given by k= 2, with units  BtuhftdegF.  The length is 2.5 ft.

The thermal capacity is heat capacity per length.

 

 

 

Notice the FPS units are not as expected.  The typical English units for heat capacity and thermal conductivity are BtuhftdegF and Btuhft2degF.

 

Convert this result into the desired units.  The format is convert(u, 'units', unitTo), where u is the expression with units, and unitTo is the desired units.

(3.3)

k2BtuhftdegF

16343750011758041ftlbs3degF

(3.4)

m2.5ft

2.5ft

(3.5)

thermalcapacitykm

5.560024838lbs3degF

(3.6)

convertthermalcapacity, 'units', Btuhft2degF

0.8000000001Btuhft2degF

(3.7)

Adding Units to a System

 

If you will use these units frequently, you may want to add them to the unit system.  

 

Example:

Add the units BtuhftdegF and Btuhft2degF to the FPS unit system.  Call the new unit system myFPS.

 

 

 

 

Change the default system to the new system myFPS.

 

Review the calculation for thermal conductivity.

AddSystemmyFPS,GetSystemFPS,BtuhftdegF,Btuhft2degF

UseSystemmyFPS

k22BtuhftdegF

2BtuhftdegF

(3.8)

m22.5ft

2.5ft

(3.9)

k2m2

0.8000000000Btuhft2degF

(3.10)

Reset the unit system to SI.

UseSystem'SI'

 

Tolerances

Steps

Result

Using Tolerances

You can use the Tolerances package to calculate values with tolerances.  This utilizes the plus/minus notation. Units and Tolerances can be used concurrently.

Example:  
Type "with(Tolerances):" and press [Enter] to load the package.

 

Enter values and tolerances for length, mass, and time.

 

To create the±sign, after each of the values, type "pm[Esc]".  Then, input the tolerance amount. Enter the units from the Units palette.

 

Now recalculate the answer for Force given the specified tolerance levels.

withTolerances:

Length2250.00 ±1.0m

250. ± 1.00m

(4.1)

Mass2500.00 ± .5 lb

500. ± 0.500lb

(4.2)

Time225 ±3s

25. ± 3.s

(4.3)

Force2Length2Mass2Time22

94.8 ± 22.9N

(4.4)

See Also

Overview of Units in Maple, Tolerances, Units Package Index, Units in Plots

 

Go to Maple Portal     Previous Tutorial


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam