Add Rule - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ScientificErrorAnalysis

  

AddRule

  

add a new rounding rule

 

Calling Sequence

Parameters

Description

Examples

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.

• 

To add a rule to all future Maple sessions, add the AddRule command to your Maple initialization file. For more information, see Create Maple Initialization File.

• 

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

  

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

withScientificErrorAnalysis:

AddRule`=`double,x,yx,2y

ApplyRuleQuantity10.0,0.1,double

Quantity10.0,0.2

(1)

See Also

Create Maple Initialization File

op

Rounding rules

ScientificErrorAnalysis

ScientificErrorAnalysis[ApplyRule]

ScientificErrorAnalysis[GetRule]

ScientificErrorAnalysis[GetRules]

ScientificErrorAnalysis[HasRule]

ScientificErrorAnalysis[Quantity]

ScientificErrorAnalysis[UseRule]