Commands for Managing Systems of Units - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Science and Engineering : Units : Details : Commands for Managing Systems of Units

Details of Units Package Commands

 

Description

Command Details

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.

AddBaseUnit

add a base unit and associated base dimension

AddDimension

add or rename a dimension

AddSystem

add or modify a system of units

AddUnit

add or modify a unit

GetDimension

return dimension as a product of powers of base dimensions

GetDimensions

list all dimensions

GetSystem

list units in a system of units

GetSystems

list all systems of units

GetUnit

get unit information

GetUnits

list all unit names

HasDimension

test whether a dimension exists

HasSystem

test whether a system of units exists

HasUnit

test whether a unit exists

RemoveDimension

remove a dimension

RemoveSystem

remove a system of units

Split

split an expression into a unitless part and a unit

TestDimensions

verify dimensional correctness of unit expression(s)

Unit

return argument as a unit in standard form

UseContexts

set default context(s)

UseMode

set the default mode for combining units

UseSystem

set the default system of units

UseUnit

set the default unit for one dimension

UsingContexts

list the default unit contexts

UsingSystem

return the default system 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.

with(Units):

Automatically loading the Units[Simple] subpackage

GetDimensions();

absorbed_dose,acceleration,action,amount_of_information,amount_of_substance,angular_acceleration,angular_jerk,angular_speed,area,crackle,currency,dose_equivalent,drop,dynamic_viscosity,electric_capacitance,electric_charge,electric_conductance,electric_current,electric_dipole_moment,electric_displacement,electric_field_strength,electric_permittivity,electric_polarizability,electric_potential,electric_resistance,electric_resistivity,energy,enthalpy,exposure,force,frequency,heat_capacity,heat_insulation_coefficient,heat_transfer_coefficient,illuminance,jerk,kinematic_viscosity,length,linear_frequency,linear_mass_density,lock,logarithmic_gain,luminous_flux,luminous_intensity,luminous_luminance,magnetic_dipole_moment,magnetic_flux,magnetic_flux_density,magnetic_inductance,magnetic_permeability,magnetic_polarizability,magnetizing_force,mass,mass_density,molar_electric_charge,molar_energy,moment_of_inertia,momentum,plane_angle,pop,power,pressure,snap,solid_angle,specific_heat_capacity,speed,surface_energy_density,surface_power_density,thermal_conductivity,thermodynamic_temperature,time,torque,volume,volume_flow

(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.

GetDimension('force');

lengthmasstime2

(2)
• 

To list the units available to represent force, use the GetUnits command.

GetUnits('dimension'='force');

dynestandard,gramforcestandard,kipavoirdupois,kipfstandard,newtonSI,ounceforcestandard,planck_forceplanck,pondstandard,poundalstandard,poundforcestandard,sthenestandard,tonforcestandard

(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.

GetUnit('newton');

newton,default=true,plural=newtons,abbreviation=none,prefix=SI,symbol=N,spelling=newton,abbreviations=,conversion=1000metreSIgramSIsecondSI2,spellings=newton,newtons,symbols=N,context=SI

(4)
• 

To attach a unit to a value, use the Unit constructor (or the Units palette) 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.

4*Unit('N');

4N

(5)

8*Unit('N'*'m');

8Nm

(6)

combine(8*Unit('N'*'m'), 'units');

8J

(7)

4*Unit('N') * 2*Unit('m');

8J

(8)
• 

To include units in expressions, and convert automatically to the default unit in the current system of units, use the Standard environment, the Simple environment, or the Natural environment. The UsingSystem command returns the current system of units. For a list of all the units in that system, use the GetSystem command.

with(Units[Standard]):

UsingSystem();

SI

(9)

GetSystem((9));

teslaSI,pascalSI,bitinformation,coulombSI,voltSI,candelaSI,jouleSI,lumenSI,ohmSI,faradSI,luxSI,steradianSI,weberSI,dollarUS,kilogramSI,meterSI,siemensSI,newtonSI,secondSI,henrySI,kelvinSI,wattSI,neperSI,radianSI,moleSI,ampereSI

(10)

4*Unit('N') * 2*Unit('m');

8J

(11)
• 

For a list of all available systems of units, use the GetSystems command. To set the current system of units, use the UseSystem command.

GetSystems();

Atomic,CGS,EMU,ESU,FPS,IPS,MKS,MTS,SI

(12)

UseSystem('FPS');

4*Unit('N') * 2*Unit('m');

200000000000000003389544870828501lbfft

(13)
• 

To force a conversion to a non-default unit, use the convert/units command.

convert((13), 'units', 'calorie');

1000523cal

(14)
• 

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]');

1523calnutrition

(15)

UseContexts('nutrition');

convert(8*Unit('J'), 'units', 'calorie');

1523calnutrition

(16)

convert(8*Unit('J'), 'units', 'calorie[thermochemical]');

1000523cal

(17)

UsingContexts();

nutrition

(18)

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.

HasDimension('human');

false

(19)

HasUnit('soldier');

false

(20)

AddBaseUnit('soldier', 'context'='army', 'dimension'='human', 'spellings'='soldiers');

HasDimension('human');

true

(21)

HasUnit('soldier');

true

(22)
• 

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', 'plural'='sections');

convert(150*Unit('soldiers'), 'units', 'sections');

Error, (in `convert/units`) unable to convert `soldier` to `section`

GetUnit('section');

section,default=true,plural=sections,abbreviation=none,prefix=none,symbol=none,spelling=section,abbreviations=,conversion=40468564224metreSI215625,spellings=section,sections,symbols=,context=standard

(23)
  

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]');

section,default=false,plural=sections,abbreviation=none,prefix=none,symbol=none,spelling=section,abbreviations=,conversion=10soldierarmy,spellings=section,sections,symbols=,context=army

(24)

convert(150*Unit('soldiers'), 'units', 'section[army]');

15sectionarmy

(25)
• 

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.

HasSystem('military');

false

(26)

AddSystem('military', 'soldier');

UseSystem('military');

50*Unit('soldier')+3*Unit('section[army]');

80soldier

(27)

AddSystem('militarySI', GetSystem('military'), GetSystem('SI'), 'section[army]', 'hour');

UseSystem('militarySI');

(50*Unit('soldier')+3*Unit('section[army]'))*Unit('hour');

8sectionarmyhour

(28)

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,SimpleUnits

examples,StandardUnits

Units

Units/Details

Units/Index

worksheet/reference/initialization