ScientificErrorAnalysis - Maple Help

Home : Support : Online Help : Science and Engineering : Scientific Error Analysis : Commands : ScientificErrorAnalysis/AddRule

ScientificErrorAnalysis

 Calling Sequence AddRule( name = action, opts )

Parameters

 name - symbol; name of the new rule action - procedure opts - (optional) equation of the form check= true or false; allows overwrite of existing rule

Description

 • The AddRule( name=action, opts ) command adds a new rule to the collection of rounding rules available to the ScientificErrorAnalysis package for the current session.
 • The name argument is a Maple symbol that specifies the name of the new rule.
 If check=true, the name of the new rule cannot be the same as that of an existing rule.  The default value of check is true. If check=false, the name of the new rule can be the same as that of an existing rule, in which case the existing rule is overwritten.
 The rule 'digits' cannot be added nor overwritten.
 • The action argument is a procedure that specifies a new rounding rule.
 The action procedure must accept two arguments $x,y$ where $x$ is understood to be the central value of a quantity-with-error and $y$ is its absolute uncertainty.  The procedure must return an expression sequence of two values $u,v$ where $u$ is the central value of the rounded quantity-with-error and $v$ is its absolute uncertainty.
 The action procedure can also accept an index (for example, an integer specifying a number of digits), which is detected and accessed in the usual way.  That is, when a procedure is assigned to a symbol, calling the procedure with an index on the symbol can be detected by observing the index on procname, and the index can be accessed by $\mathrm{op}\left(\mathrm{procname}\right)$.
 The action procedure can be written to check for an index, perhaps accept a default, or ignore any index.  It can throw an error in unacceptable cases.  Such an error is triggered if the rule indexing is unacceptably specified in a rule=name option to another function, or unacceptably specified in the UseRule function.
 • For more information on predefined rules in ScientificErrorAnalysis, see Predefined Rounding Rules.

Examples

 > $\mathrm{with}\left(\mathrm{ScientificErrorAnalysis}\right):$
 > $\mathrm{AddRule}\left(\mathrm{double}=\left(\left(x,y\right)→\left(x,2y\right)\right)\right)$
 > $\mathrm{ApplyRule}\left(\mathrm{Quantity}\left(10.0,0.1\right),\mathrm{double}\right)$
 ${\mathrm{Quantity}}{}\left({10.0}{,}{0.2}\right)$ (1)