Contents Up << >>

Arithmetic

Format: Ar[ithmetic] [expression]
This command evaluates arithmetical and logical expressions. Any such expression can be entered. If a calculation is entered on the first line then it is evaluated and the ARITHMETIC command finishes. If no calculation is entered then EASISTAT will request one, and will remain within the ARITHMETIC command until a blank line or error is encountered.

Examples:

Enter command - ARITH
Enter calculation:   5 +5*38
Enter calculation:   2.6/7+(3.5-.6)pow(0.5)

Enter command - ar 5 +5*38
One can use the probability look-up functions, e.g. to find the significance of a chi-squared of 13.6 with 2 degrees of freedom:

Enter command - ARITH 13.6PX2
If a column is specified then the value in the first valid row is used. This means that an arithmetic command can be put in an input file and used to carry out manipulations of variables which are entered into the first row:

Enter command - ar 
Enter calculation:   c1 pow(1/3)
This outputs the cube root of the value in the first column in the first valid row of the table.

Often it is convenient to have formulae contained in a command file such as this:

e Normal approximation to binomial distribution
e
der v1 %1
der v2 %2
der v3 %3
e Observed value is:
ar v1
e Total number of trials is:
ar v2
e Expected ratio is:
ar v3
e One-tailed p value (with continuity correction):
ar 1-pn((abs(v1-v2*v3)-0.5)/((v2*v3*(1-v3))pow(0.5)))
i close
This calculates an approximation to a binomial probability of an observed event occurring x times out of n trials if the chance of such an event occurring on each trial is p. If the command file name is BINOM it can be run as follows:

Enter command -  INPUT BINOM 12 15 0.4
Here x is 12, n is 15 and p is 0.4.

Here's another file to solve quadratic equations. The three coefficients are passed as parameters to the file:

Enter command -  INPUT QUAD 3 5 1
Command file QUAD contains the following lines:

der v1 %1
der v2 %2
der v3 %3
e Solving quadratic equation with following coefficients:
ar
v1
v2
v3
((v2*v2-4*v1*v3)pow0.5-v2)/(2*v1)
(0-(v2*v2-4*v1*v3)pow0.5-v2)/(2*v1)

; blank line above to finish arithmetic command
i close
With coefficients 3, 5 and 1, these formulae find roots at -0.232 and -1.434.

Using this kind of technique one can build up a collection of command files for evaluating different expressions and can use EASISTAT like a programmable calculator. If the number output is very large or very small then it will be output in exponential notation (described in the section on arithmetic expressions).