Up: Introduction   [Contents][Index]


1.1 Mathematical background

If \vec x is a vector of independent experimentally measured quantities with associated random measurement error \delta \vec x, the formal error on a function \vec x is given by Further, if f(\vec x) is a functional, e.g. f(\vec x)=g(h(k(\vec x))), then the partial derivative of f is given by the derivative chain rule: Therefore to compute \delta f one requires:

  1. the partial derivative of the function with respect to each independent variable (\partial f / \partial x_i)
  2. \delta x_i - the measurement error
  3. chain rules of differential calculus for the mathematical operators (which will use the x_i’s and \partial f / \partial x_i’s).

The GNU fussy interpreter is implemented internally as a stack-based virtual machine (VM). The derivative chain rule is implemented using a separate VM which maintains a stack per independent variable to hold the intermediate partial derivatives. At the terminal nodes of a parsing tree (e.g. the ’=’ operator) the values from these stacks are used to evaluate \delta f (the first equation) above. A user program written in Fussy is compiled into the VM instruction-set, referred to as the op-codes, to manipulate the VM stack (VMS), call built-in functions, perform basic mathematical operations or call user-defined sub-program (functions or procedures). These op-codes are function calls which perform the operation they represent (mathematical operators, built-in function call or branching to a sub-program unit) as well as the steps required for automatic error propagation. Since user-defined programs/expressions are translated into these op-codes, errors are correctly propagated in the mathematical expression in any arbitrary user program.

A simple C binding to the interpreter is also provided. The user program can be supplied to the interpreter via an in-memory string using the function calc(char,*InString, edouble &ans, FILE *InStream, FILE *OutStream). The contents of the InString are parsed and converted to a VM instruction set. The result of the execution of this program is returned in ans. The last two arguments are not used in this case. Alternatively, if InString is set to NULL and the last two arguments set to valid file pointers, the interpreter will take the input from InFile and use OutFile as the output stream. A similar C++ interface of type calc(char *InString, ostream &ResultStream, FILE *InStream, FILE *OutStream) writes the result of the program supplied in InString or via the file pointer InStream to the output stream ResultStream. OutStream in both interfaces is used as the output file for the error messages.


Up: Introduction   [Contents][Index]