Units - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Units : Manipulating Units : Units/AddBaseUnit

Units

 add a base unit and associated base dimension

 Calling Sequence AddBaseUnit(unit, 'context'=unit_context, 'dimension'=dimension_name, opts)

Parameters

 unit - symbol; unit name unit_context - symbol; unit context. For information on unit contexts, see Details. dimension_name - symbol; dimension name opts - (optional) equation(s) of the form option=value where option is one of 'abbreviation', 'abbreviations', 'check', 'default', 'plural', 'prefix', 'spelling', 'spellings', 'symbol', or 'symbols'; specify options for the unit

Description

 • The AddBaseUnit(unit, 'context'=unit_context, 'dimension'=dimension_name, opts) calling sequence adds a base unit in conjunction with adding a base dimension to the Units package for the current session.
 • No new unit name or unit symbol can evaluate to any of the symbols in the following list.

 true false undefined infinity energy default symbolic base check context dimension name none

 • The 'context'=unit_context equation specifies the context of the unit. In this way, two units with the same name but different values can be distinguished.
 • The 'dimension'=dimension_name equation specifies the name of the dimension added. It is the object returned by procedures such as convert/dimensions.
 • The opts argument can contain one or more of the following equations that describe unit and dimension options.
 $'\mathrm{abbreviation}'=$ symbol
 This option sets the default abbreviation of the unit for display.
 $'\mathrm{abbreviations}'=$ symbol or set(symbol)
 This option sets the list of abbreviations (other than the default which is set by the 'abbreviation' option) for the unit.
 An abbreviation is similar to a symbol, except that it encompasses both the unit name and the context, whereas a unit symbol is valid for any context.
 For example, the technical atmosphere (${\mathrm{atmosphere}}_{\mathrm{technical}}$) has the abbreviation at, whereas the unit name atmosphere has the unit symbols atm and atmos. Thus, atm[technical] refers to technical atmospheres, but ${\mathrm{at}}_{\mathrm{standard}}$ does not refer to standard atmospheres.
 $'\mathrm{check}'=$ truefalse
 This option determines whether the added unit name, symbol, and abbreviation are compared with existing unit names, symbols, abbreviations, and spellings. The default value of 'check' is true. An error is returned and the unit is not added if there is a conflict.
 For example, if a user attempts to add a new unit with an abbreviation Ys or a unit with the symbol Ys and the context SI, it conflicts with the symbol for the yottasecond. Unless the 'check'=false option is included, the AddBaseUnit routine returns an error and does not add the unit. However, a unit with the symbol $\mathrm{Ys}$ and a context different from SI can be added without conflict. In this case, $\mathrm{Ys}$ refers to the new unit and ${\mathrm{Ys}}_{\mathrm{SI}}$ is required to refer to the yottasecond. A new unit with the name Ys does not conflict with the yottasecond. However, to refer to the new unit, the user must include its context, for example, ${\mathrm{Ys}}_{\mathrm{new}}$, because $\mathrm{Ys}$ refers to the yottasecond.
 $'\mathrm{default}'=$ truefalse
 For a unit with a context set as the default, the use of the unit name or an associated unit symbol without a context or modifier refers to its context.
 The default value of 'default' is false. If no unit context is set as the default, the setting of this option to false is ignored.
 $'\mathrm{plural}'=$ symbol
 This option sets the default unit plural spelling for display.  If this option is not given, the argument unit is used as the default plural spelling.
 $'\mathrm{prefix}'=$ prefix_style
 This option specifies what type of prefixes the given unit takes. This option can be set to false (explicitly indicating that the unit does not take prefixes), SI, IEC, SI_positive, SI_negative, or a set of symbols that is a subset of either SI prefixes or IEC prefixes.
 The values SI_positive and SI_negative specify units that take only prefixes that are positive powers of ten or negative powers of ten, respectively.  For example, it is common to refer to
 milliliters and centiliters but not kiloliters (cubic meters). Similarly, it is common to refer to kilotonnes and megatonnes but not millitonnes (kilograms).
 $'\mathrm{spelling}'=$ symbol
 This option sets the default unit spelling for display.  If this option is not given, the argument unit is used as the default spelling.
 $'\mathrm{spellings}'=$ symbol or set(symbol)
 To accommodate regionalized spellings of units, for example, meter versus metre, a facility has been included that allows the Units package to accept various spellings of units.  Any symbol given to the 'spelling' option is treated as unit.
 For example, by default, the accepted alternate spellings of the meter are: metre, meters, and metres.
 $'\mathrm{symbol}'=$ symbol
 This option sets the default unit symbol for display.  If this option is not given, the default symbol is chosen from the option 'symbols' (if any).
 $'\mathrm{symbols}'=$ symbol or set(symbol)
 A unit symbol can be used in place of a unit name.  For units that take SI or IEC prefixes, any associated symbol takes the associated symbol prefix.
 For example, milliliter is equivalent to mL and Kibibyte is equivalent to KiB.

Examples

 > $\mathrm{with}\left(\mathrm{Units}\right):$
 > $\mathrm{AddBaseUnit}\left('\mathrm{individual}','\mathrm{context}'='\mathrm{human}','\mathrm{dimension}'='\mathrm{animal}','\mathrm{spellings}'='\mathrm{individuals}'\right)$
 > $\mathrm{AddUnit}\left('\mathrm{company}','\mathrm{context}'='\mathrm{human}','\mathrm{conversion}'=2'\mathrm{individual}','\mathrm{spellings}'='\mathrm{companies}'\right)$
 > $\mathrm{AddUnit}\left('\mathrm{crowd}','\mathrm{context}'='\mathrm{human}','\mathrm{conversion}'=3'\mathrm{individual}','\mathrm{spellings}'='\mathrm{crowds}'\right)$
 > $\mathrm{convert}\left(9,'\mathrm{units}','\mathrm{individuals}','\mathrm{crowds}'\right)$
 ${3}$ (1)