There is an "Application Library" for *Mathematica*
called *Experimental Data Analyst (EDA)*. It offers a number of
tools for the analysis of experimental data. This document discusses one
set of tools in *EDA* which provide the ability to automatically
propagate experimental errors.

First we will need to load the *EDA* library. In the following
command the `In[1]:=` is the prompt from *Mathematica*; you
will not type that part. Also, in the command there are **no**
apostrophes ', but two graves `.

`In[1]:= Needs["EDA`"]`

In order to alert *Mathematica* to the fact that we want to do
calculations including error propagation, we need to wrap the value and
the error in a ` Datum` construct:

`In[2]:= x = Datum[ {1.51, 0.03} ]
Out[2]= Datum[ {1.51, 0.03} ]`

This tells *Mathematica* to interpret ` x` as a
variable with value 1.51 and error 0.03.

We similarly define a variable ` y`:

`In[3]:= y = Datum[ {3.75, 0.08} ]
Out[3]= Datum[ {3.75, 0.08} ]`

Now we can combine ` x` and

`In[4]:= x + y
Out[4]= Datum[{5.26, 0.085}]`

Thus (1.51 ± 0.03) + (3.75 ± 0.08) is (5.260 ± 0.085), which you can easily verify by hand.

Similarly:

`In[5]:= x - y Out[5]= Datum[{-2.24, 0.085}]
In[6]:= x * y
Out[6] = Datum[{5.66, 0.17}]
In[7]:= x / y Out[7]= Datum[{0.403, 0.012}] `

In *Mathematica* ` a^b` gives

`In[8]:= x^3 Out[8]= Datum[{3.44, 0.21}]`

` Sqrt` is the square root operator:

`In[9]:= Sqrt[x] Out[9]= Datum[{1.229, 0.012}]`

You can also use virtually every transcendental function, such as ` Sin`
(sine),

`In[10]:= Log[x] Out[10]= Datum[{0.412, 0.02}]`

Say you have a number of different value,error pairs that you wish to
combine. The ` Data` construct handles this case. In the
examples below we will "recycle" the variables

`In[11]:= x = Data[ {{17.3, .4}, {0.034, 0.0005}, {123, 9}} ] Out[11]= Data[{{17.3, 0.4}, {0.034, 0.0005}, {123, 9}}]
In[12]:= y = Data[ {{23.5, .7}, {0.123, 0.0014}, {412, 15}} ]
Out[12]= Data[{{23.5, 0.7}, {0.123, 0.0014}, {412, 15}}]
In[13]:= x + y
Out[13]= Data[{{40.8, 0.81}, {0.157, 0.0015}, {535., 17.}}]
In[14]:= x * y
Out[14]= Data[{{407., 15.}, {0.004182, 0.000078}, {50700., 4100.}}]`

` Data` can handle all the cases that

Although the ` Datum` and

**2 x^2 / z - y z / x**

As discussed in the *First Year Physics Laboratory Manual*, such a
combination requires that one takes the partial derivatives of the
expression with respect to ` x`,

However, *EDA* supplies a routine ` CombineWithError`
that does all the steps described above. For example:

`In[15]:= x = {{17.3, .4}, {0.034, 0.0005}, {123, 9}}
Out[15]= {{17.3, 0.4}, {0.034, 0.0005}, {123, 9}}
In[16]:= y = {{23.5, .7}, {0.123, 0.0014}, {412, 15}} Out[16]= {{23.5, 0.7}, {0.123, 0.0014}, {412, 15}}
In[17]:= z = {{11.3, .8}, {.345, .023}, {75, 11}}
Out[17]= {{11.3, 0.8}, {0.345, 0.023}, {75, 11}}
In[18]:= CombineWithError[ 2 x^2 / z - y z / x ] Out[18]= {{37.6, 6.1}, {-1.24, 0.12}, {150., 130.}}`

Of course, ` CombineWithError` can handle simple cases
too. Here we repeat the first calculation we did above in the

`In[19]:= x = {1.51, 0.03} Out[19]= {1.51, 0.03}
In[20]:= y = {3.75, 0.08}
Out[20]= {3.75, 0.08}
In[21]:= CombineWithError[x + y] Out[21]= {5.26, 0.085}`

There is one small caveat in using this routine. We can use the ` Datum`
and

`In[22]:= Datum[{1.51, 0.03}] + Datum[{3.75, 0.08}] Out[22]= Datum[{5.26, 0.085}]`

` CombineWithError` must contain the actual symbols so
that it knows how to take the partial derivatives of the expression. Thus
the following command generates an error message and fails:

`In[23]:= CombineWithError[ {1.51, 0.03} + {3.75, 0.08} ]
CombineWithError::unequallength: The number of
datapoints in the variables are not all equal or an unexpected
specification of variable names was encountered. Out[23]= $Failed`

You may wish to know that *EDA* is a commercial application,
marketed by Wolfram Research Inc., the inventor and vendor of *Mathematica*.
It was written by David Harrison, Department of Physics, University of
Toronto, in 1995-1996. This brief introduction to using *EDA* for
propagation of errors was written by David Harrison, September 1998.