Details of Units Package Commands
|
Description
|
|
•
|
In addition to converting values from one unit to another, the Units package also provides commands that allow you to manage and create entire systems of units.
|
|
To display the help page for a particular command, click the corresponding hyperlink.
|
|
|
Command Details
|
|
|
Managing Systems of Units
|
|
•
|
A system of units is made up of a set of dimensions, with units used to represent those dimensions. To see the dimensions available in the Units package, use the GetDimensions command.
|
| (1) |
•
|
Most of these dimensions are complex dimensions, products of powers of base dimensions. To see the dimensions used to derive a complex dimension, for example force, use the GetDimension command.
|
| (2) |
•
|
To list the units available to represent force, use the GetUnits command.
|
>
|
GetUnits('dimension'='force');
|
| (3) |
|
Other optional arguments available for filtering the list of units are described in the GetUnits help page.
|
•
|
For complete information describing a specific unit, use the GetUnit command.
|
| (4) |
•
|
To attach a unit to a value, use the Unit constructor with either a unit's symbol or any of its spellings. Products of units can also be used. Note that units are automatically converted within the Unit command but not across operations.
|
| (5) |
| (6) |
>
|
4*Unit('N') * 2*Unit('m');
|
| (7) |
•
|
To include units in expressions, and convert automatically to the default unit in the current system of units, use either the Natural or Standard environment. The UsingSystem command returns the current system of units. For a list of all the units in that system, use the GetSystem command.
|
| (8) |
| (9) |
>
|
4*Unit('N') * 2*Unit('m');
|
| (10) |
•
|
For a list of all available systems of units, use the GetSystems command. To set the current system of units, use the UseSystem command.
|
| (11) |
>
|
4*Unit('N') * 2*Unit('m');
|
| (12) |
•
|
To force a conversion to a non-default unit, use the convert/units command.
|
>
|
convert((12), 'units', 'calorie');
|
| (13) |
•
|
Some units, like calorie, are derived differently in different contexts. Use the UseContexts command to set the default context for context dependent units. To list the added default contexts, use the UsingContexts command.
|
>
|
convert(8*Unit('J'), 'units', 'calorie[nutrition]');
|
| (14) |
>
|
UseContexts('nutrition');
|
>
|
convert(8*Unit('J'), 'units', 'calorie');
|
| (15) |
>
|
convert(8*Unit('J'), 'units', 'calorie[thermochemical]');
|
| (16) |
| (17) |
|
|
Creating Systems of Units
|
|
•
|
If the units and systems of units available in the Units package are not sufficient, you can create new systems, units, and dimensions. To create a new base unit and corresponding base dimension, use the AddBaseUnit command. The HasDimension and HasUnit commands check to see if a dimension or unit already exists.
|
| (18) |
| (19) |
>
|
AddBaseUnit('soldier', 'context'='army', 'dimension'='human', 'spellings'='soldiers');
|
| (20) |
| (21) |
•
|
When a new base unit has been created, new composite dimensions and units can be defined based on that unit using the AddDimension and AddUnit commands. Previously defined or standard dimensions and units can also be redefined using these commands, or removed using the RemoveDimension command.
|
>
|
AddUnit('section', 'context'='army', 'conversion'=10*'soldier', 'spellings'='sections');
|
>
|
convert(150*Unit('soldiers'), 'units', 'sections');
|
| (22) |
|
The unit section is already defined and included in the SI system. Specify the newly defined unit in its army context to use the new meaning.
|
>
|
GetUnit('section[army]');
|
| (23) |
>
|
convert(150*Unit('soldiers'), 'units', 'section[army]');
|
| (24) |
•
|
To create a new system, use the AddSystem command. This command is also used to customize an existing system by adding or changing the default unit for a dimension. To remove a system, use the RemoveSystem command.
|
| (25) |
>
|
AddSystem('military', 'soldier');
|
>
|
50*Unit('soldier')+3*Unit('section[army]');
|
| (26) |
>
|
AddSystem('militarySI', GetSystem('military'), GetSystem('SI'), 'section[army]', 'hour');
|
>
|
UseSystem('militarySI');
|
>
|
(50*Unit('soldier')+3*Unit('section[army]'))*Unit('hour');
|
| (27) |
>
|
RemoveSystem('military');
|
•
|
To add or redefine a system, unit, or dimension in all future Maple sessions, add the above commands to your Maple initialization file. For more information, see Create Maple Initialization File.
|
|
|
|
See Also
|
|
convert/dimensions, convert/systems, convert/units, examples,DefaultUnits, examples,NaturalUnits, examples,StandardUnits, Units, Units/Details, Units/Index, worksheet/reference/initialization
|
|