 Add Unit - Maple Help

Units Calling Sequence AddUnit(unit, opts) Parameters

 unit - symbol; unit name opts - equation(s) of the form option=value where option is one of 'abbreviation', 'abbreviations', 'check', 'context', 'conversion', 'default', 'plural', 'prefix', 'spelling', 'spellings', 'symbol', or 'symbols'; specify options for the unit Description

 • The AddUnit(unit, opts) function adds or redefines a unit in the current session.
 • No new unit name or unit symbol may evaluate to any of the symbols in the following list.

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

 • The opts argument can contain one or more of the following equations that set unit options.
 'abbreviation'=symbol
 This option sets the default abbreviation of the unit for display. The special option value none indicates that there is no default abbreviation. If this option is not given, the default abbreviation is chosen from the 'abbreviations' option (if any).
 It is invalid for the option 'abbreviation' to appear without a 'context' option.
 '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.
 It is invalid for the option 'abbreviations' to appear without a 'context' option.
 '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, spelling, or symbol Ys, it conflicts with the symbol for the yottasecond. In this case, the AddUnit routine will return an error. However, a unit with the symbol $s$ and a context different from SI can be added without conflict.
 'context'=symbol
 This option specifies the context of the unit.  In this way, two units with the same name but different values can be distinguished. If not specified, the value standard is used.
 'conversion'=algebraic
 This is a conversion with respect to existing units. This option is required if the unit is new.
 '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.
 '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.
 'prefix'=prefix_style
 This option species what type of prefixes the given unit takes. This option can be set to none (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 value false is equivalent to none.
 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 kilotonnes and megatonnes but not millitonnes (kilograms). Moreover, if millitonnes were accepted, then femtotonnes (nanograms) would need to be accepted, too, but their symbol, ft, would clash with the symbol for foot.
 '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.
 '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.
 'symbol'=symbol
 This option sets the default unit symbol for display.  If this option is not given, the default symbol (if any) will be chosen from the option 'symbols'.
 The special option value none indicates that there is no default symbol.
 '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 symbols take the associated symbol prefix.
 For example, milliliter is equivalent to mL and Kibibyte is equivalent to KiB. Examples

 > $\mathrm{with}\left(\mathrm{Units}\right):$

Add Polish nominative spellings of the meter, and the French spelling of the foot.

 > $\mathrm{AddUnit}\left('\mathrm{meter}','\mathrm{spellings}'=\left\{'\mathrm{metr}','\mathrm{metry}'\right\}\right)$
 > $\mathrm{AddUnit}\left('\mathrm{foot}','\mathrm{spellings}'='\mathrm{pied}'\right)$
 > $\mathrm{convert}\left(1.0,'\mathrm{units}',{'\mathrm{centimetry}'}^{2},{'\mathrm{pied}'}^{2}\right)$
 ${0.001076391042}$ (1)

Add the banana as a unit of length.

 > $\mathrm{AddUnit}\left('\mathrm{banana}','\mathrm{plural}'='\mathrm{bananas}','\mathrm{context}'='\mathrm{fruit}','\mathrm{symbol}'='\mathrm{bn}','\mathrm{prefix}'='\mathrm{SI}','\mathrm{conversion}'=19'\mathrm{centimeter}'\right)$

The default spellings of the meter and liter are American.  This changes them to the international spelling.

 > $\mathrm{AddUnit}\left('\mathrm{metre}','\mathrm{spelling}'='\mathrm{metre}','\mathrm{plural}'='\mathrm{metres}'\right)$
 > $\mathrm{AddUnit}\left('\mathrm{litre}','\mathrm{spelling}'='\mathrm{litre}','\mathrm{plural}'='\mathrm{litres}'\right)$
 > $\mathrm{convert}\left(\left['L',{'m'}^{3},{'\mathrm{decabanana}'}^{3}\right],'\mathrm{conversion_table}','\mathrm{output}'='\mathrm{grid}'\right)$
 $\left[\begin{array}{cccccc}{}& {}& {\mathrm{To:}}& {L}& {{m}}^{{3}}& {{\mathrm{dabn}}}^{{3}}\\ {\mathrm{Unit Name}}& {\mathrm{Symbol}}& {}& {}& {}& {}\\ {\mathrm{litres}}& {L}& {}& {1}& \frac{{1}}{{1000}}& \frac{{1}}{{6859}}\\ {\mathrm{cubic metres}}& {{m}}^{{3}}& {}& {1000}& {1}& \frac{{1000}}{{6859}}\\ {\mathrm{cubic decabananas}}& {{\mathrm{dabn}}}^{{3}}& {}& {6859}& \frac{{6859}}{{1000}}& {1}\end{array}\right]$ (2)