next up previous
Next: Syntax Up: The fussy language: Implementation Previous: APPENDIX


An example of a multi-variate expression

Parsing tree for the multi-variate expression $f(x_1,x_2)={x_1\times
x_2+x_1 \over {x_2}}$ is shown in Fig. 2. The sequence of operations at the stages marked by 1,2 and 3 are as follows. In the following, <variablename>.rms() and <variablename>.ID refers to the random error and the ID associated with the variable respectively.
Figure: The parsing tree for $f(x_1,x_2)={x_1\times
x_2+x_1 \over {x_2}}$
\includegraphics[scale=0.45]{Figs/fig2}
  1. Stage 1:

    The IDs of x$_1$ and x$_2$ are set to $0$ and $1$ respectively and they are pushed on the VMS. x$_1$.rms() and x$_2$.rms() are copied in ME[0] and ME[1] respectively, while a value of $1$ is pushed on DS[0] and DS[1].

    Operator '*' pops two values (say L and R) from the VMS. A value L*R with an ID equal to L.ID$ \cup $R.ID is pushed on the VMS and a list of common IDs is made as IDList = L.IDList$ \cap $R.IDList (here, an empty list). Next, for all IDs in L, a value is poped from DS[L.ID] (say, dx), and dx*R is pushed back on DS[L.ID]. Similar operation is done for all IDs in R.

    Top of DS[0] and DS[1] now has x$_2$ and x$_1$ respectively, while the top of the VMS has the value x$_1 \times $x$_2$ with an IDList={1,0}.

  2. Stage 2:

    x$_1$ is pushed on the VMS, its ID is set to zero, x$_1$.rms() is copied to ME[0] (a redundant operation) and a value of $1$ is pushed on DS[0].

    Operator '+' pops two values (L and R) from the VMS (these have values x$_1 \times $x$_2$ and x$_1$). L+R with an IDList= L.ID$ \cup $R.ID is pushed back on the VMS. This IDList will be {0,1}. For IDs common between L and R (here $\{0\}$), two values are poped from the DS, and their addition pushed back on the DS. The common ID is then removed from the ID list of both operands. For the remaining IDs in L (R has no IDs left), values are poped from the corresponding DS, added together and pushed back on the appropriate DS.

    Hence, at the end of the operator '+', DS[0] will have x$_2$+1 and DS[1] will have x$_1$. Top of the VMS has the value x$_1 \times $x$_2$+x$_1$.

  3. Stage 3:

    x$_2$ is pushed on the VMS, x$_2$.rms() is copied in ME[1] (another redundant operation) and a value of $1$ is pushed on DS[1].

    Operator '/' pops two values (L and R) from the VMS. A value of L/R with an IDList=L.ID$ \cup $ R.ID ( $\{0,1\}\cup\{0\}$) is pushed on the VMS. A list of common IDs between L and R is made using IDList = L.IDList$ \cap $R.IDList. For all IDs in IDList, two values are poped from the corresponding DS (say, dxR (=x$_1$) and dxL (=1)) and (R*dxL - L*dxR)/(R*R) pushed back on the same DS. The corresponding IDs are then removed from L and R.

    Next, for all the remaining IDs in L, a value is poped (say dx) from DS[L.ID] and dx/R is pushed back on the same DS. Similarly, for all IDs in R, a value from DS[R.ID] is poped into dx and -L*dx/(R*R) is pushed back on the same DS.

    At the end of this stage, DS[0] has the value 1+1/x$_2$ and DS[1] has the value -x$_1$/x$_2^2$. VMS now has ${{\tt x}_1 \times {\tt x}_2 + {\tt x}_1 \over {\tt x}_2}$.

Finally, the values from the top of all DSs are multiplied with corresponding values in ME table, squared, added and the square root of the final result is taken. That value will be $\sqrt{\left[\left(1+{1\over {\tt x}_2}\right) \times \delta {\tt
x}_1\right]^2+\left[-{{\tt x}_1 \over {\tt x}_2^2} \times \delta {\tt
x}_2\right]^2}$. This is the final error propagated through the expression.


next up previous
Next: Syntax Up: The fussy language: Implementation Previous: APPENDIX
Sanjay Bhatnagar 2011-05-28