Units - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Units : Manipulating Contexts : Units/UseContexts

Units

 UseContexts
 set default context(s)

 Calling Sequence UseContexts(ctx1, ctx2, ...)

Parameters

 ctx1, ctx2, ... - symbol(s); unit context(s)

Description

 • The UseContexts(ctx1, ctx2, ...) function defines the default context(s) to use for the current session without redefining the defaults for each unit. It also returns the context(s) assigned by its most recent execution if any exists.
 • To redefine the default context(s) for all future Maple sessions, add the UseContexts command to your Maple initialization file. For more information, see Create Maple Initialization File.
 • If a unit name is specified without a context, the contexts in the last execution of the command UseContexts are each checked to see if any are valid. If one is appropriate, it is used as the default context.

Examples

 > $\mathrm{with}\left(\mathrm{Units}\right):$
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{kg}','\mathrm{oz}'\right)$
 ${35.27396195}$ (1)
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{kg}','\mathrm{oz}\left[\mathrm{troy}\right]'\right)$
 ${32.15074657}$ (2)
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{km}','\mathrm{mi}'\right)$
 ${0.6213711922}$ (3)
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{km}','\mathrm{mi}\left[\mathrm{US_survey}\right]'\right)$
 ${0.6213699495}$ (4)
 > $\mathrm{UseContexts}\left('\mathrm{US_survey}','\mathrm{troy}'\right)$
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{kg}','\mathrm{oz}'\right)$
 ${32.15074657}$ (5)
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{kg}','\mathrm{oz}\left[\mathrm{avoirdupois}\right]'\right)$
 ${35.27396195}$ (6)
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{km}','\mathrm{mi}'\right)$
 ${0.6213699495}$ (7)
 > $\mathrm{convert}\left(1.0,'\mathrm{units}','\mathrm{km}','\mathrm{mi}\left[\mathrm{standard}\right]'\right)$
 ${0.6213711922}$ (8)
 > $\mathrm{UseContexts}\left('\mathrm{apothecary}'\right)$
 ${\mathrm{US_survey}}{,}{\mathrm{troy}}$ (9)