
•

In ScientificErrorAnalysis, a structure that has numerical quantities with associated errors is called a quantitywitherror structure. Instances of such structures, which have a particular quantity and error, are called quantitieswitherror.

•

There is a quantitywitherror structure native to ScientificErrorAnalysis, constructed using the Quantity constructor.

>

with(ScientificErrorAnalysis):

${\mathrm{Quantity}}{}\left({10.}{\,}{1.}\right)$
 (1) 

In the above, the first argument is the central value and the second argument is the associated error, which can be specified in absolute, relative, or units in the least digit form. In the returned object, the error is in absolute form.

•

The minimal interpretation placed on a quantitywitherror by ScientificErrorAnalysis is that of an unknown value with central tendency, where the error value is some statistical measure of the spread of the distribution of particular values (as obtained from an experiment or trial, for example).


Nevertheless, many calculations of both error analysis and the ScientificErrorAnalysis package are only strictly valid for Gaussian distributions. However, in any particular application, this condition may not be strictly satisfied, and the interpretation of error values is the responsibility of the application.


What the ScientificErrorAnalysis package does not do is perform what is called interval arithmetic. The error value of an object in the ScientificErrorAnalysis package does not represent an interval in which possible values must be contained.

•

To extract the central value and error of a quantitywitherror, for example the above object, use evalf and GetError.

>

evalf( x ), GetError( x );

•

The central feature of ScientificErrorAnalysis is the ability to combine quantitieswitherror in a mathematical expression, that is, to propagate the errors through an expression. This is done using combine/errors.

>

y := Quantity( 20., 1. );

${y}{\u2254}{\mathrm{Quantity}}{}\left({20.}{\,}{1.}\right)$
 (3) 
>

combine( x*y, errors );

${\mathrm{Quantity}}{}\left({200.}{\,}{22.36067977}\right)$
 (4) 

The significance of this result is that, because x and y are uncertain quantities, the product has an uncertainty, as given by the error in the result. In the theory of error analysis, this is called error propagation. (Again, these errors do not represent closed intervals.)

•

In an error, usually only 1 or 2 digits are meaningful. To appropriately round a result, use ApplyRule with a rounding rule.

>

ApplyRule( (4), round[2] );

${\mathrm{Quantity}}{}\left({200.}{\,}{22.}\right)$
 (5) 

A rounding rule can be directly specified in combine/errors.

>

combine( x*y, errors, rule=round[2] );

${\mathrm{Quantity}}{}\left({200.}{\,}{22.}\right)$
 (6) 

Alternatively, the default rounding rule used by combine/errors can be changed.

>

combine( x*y, errors );

${\mathrm{Quantity}}{}\left({200.}{\,}{22.}\right)$
 (7) 

Several rounding rules are available in ScientificErrorAnalysis, and more can be added by the user.

•

Errors can be propagated through any differentiable function.

>

combine( x*exp(0.1*y), errors );

${\mathrm{Quantity}}{}\left({73.89056099}{\,}{10.44970335}\right)$
 (8) 
•

Correlations can be defined between quantitieswitherror.

>

SetCorrelation( x, y, 0.3 );

>

combine( x*y, errors );

${\mathrm{Quantity}}{}\left({200.}{\,}{24.89979920}\right)$
 (9) 

For more information on error propagation, see any text on error analysis for the physical sciences.

•

Other quantitywitherror structures are the Constant( ) and Element( ) objects of the ScientificConstants package. For example:

>

ScientificConstants:Constant( G );

${\mathrm{Constant}}{}\left({G}\right)$
 (10) 
>

combine( (10), errors );

${\mathrm{Quantity}}{}\left({6.67408}{\times}{{10}}^{{\mathrm{11}}}{\,}{3.100000000}{\times}{{10}}^{{\mathrm{15}}}\right)$
 (11) 
•

Quantitywitherror structures are defined using the AddStructure command.

•

Quantitywitherror structures can be defined so that their objects are defined as functions of other objects. In such cases, Variance, Covariance, and combine/errors use this functional dependence. For more information, see Variance, Covariance, and combine/errors.


The derived Constants of ScientificConstants are treated as quantitieswitherror with functional dependence by ScientificErrorAnalysis. For example:

>

ScientificConstants:GetConstant( m[e] );

${\mathrm{electron\_mass}}{,}{\mathrm{symbol}}{=}{{m}}_{{e}}{,}{\mathrm{derive}}{=}\frac{{2}{}{{R}}_{{\mathrm{\infty}}}{}{h}}{{c}{}{{\mathrm{\alpha}}}^{{2}}}$
 (12) 
>

combine( ScientificConstants:Constant( m[e] ), errors );

${\mathrm{Quantity}}{}\left({9.109383560}{\times}{{10}}^{{\mathrm{31}}}{\,}{1.114295438}{\times}{{10}}^{{\mathrm{38}}}\right)$
 (13) 
•

Some physical constants have their values determined to more than 10 significant figures. Hence, calculations involving these objects at the default setting of Digits may result in a loss of precision. For more precision, set Digits to a higher value, for example, 15.

