Home, Up: Operators and Constants
n-argument operators consider all values to their left as their arguments, either to the beginning of the calculation line or to the n-argument delimiter vertical bar | (see below) and replace all of them and themselves with the result of the operation.
On this page:
Statistical Operators, The ITEM Operator, The n-Argument Delimiter, Notes.
N means "number of arguments"
N+ means "number of positive values"
N0 means "number of zeros"
N- means "number of negative values"
SUM means "sum of all values"
MEAN means "mean value"
GMEAN means "geometric mean" (all values must be >0)
HMEAN means "harmonic mean" (all values must be >0)
MEDIAN means "median"
SDEV means "standard deviation"
SQSUM means "sum of squares"
RCPSUM means "sum of reciprocals" (no value must be zero)
PROD means "product of all values"
MIN means "minimum value"
MAX means "maximum value"
The ITEM operator is a special n-argument operator that returns the value of a single item from its list of arguments.
The index of this item is the value immediately to the left of the ITEM operator, it itself is not a part of the list.
If the index is negative items are counted backwards, beginning with the second item to the left of the ITEM operator.
Examples:
1 3 5 7 2 ITEM = 3
1 3 5 7 -2 ITEM = 5
The ITEM operator is meant to be used in a loop, usually with data stored in a user defined element (UDE) and the loop index I as the index.
(See page User-Defined Elements in chapter "Insert Files and User Defined Elements" and page Loop Index, Start and End Lines in chapter "Loops". Do not confuse the index of the ITEM operator with the loop index -- they can be identical, but do not have to be.)
In a loop, after the last item of the list has been referenced (or the first item if the index is negative) the loop ends.
There is an exception: the loop will not end when a negative index references the first item of the list in the first pass of the loop.
While n-argument operators take anything to their left as their list of arguments, the vertical bar | can serve as a delimiter, hiding anything to its left from the next n-argument operator.
Anything left to the delimiter remains hidden until an n-argument operator is encountered, and then becomes visible again.
In principle there can be more than one delimiter in a calculation line, but each delimiter must be followed by a corresponding n-argument operator.
Example:
20 | 3 1 4 SUM - = 12
(20 is hidden, the sum of 3, 1 and 4 is 8 which replaces the expression "3 1 4 SUM", then 20 becomes visible again, and 20 minus 8 is 12.)
N+, N0 and N- observe the zero threshold -- see page The Zero Threshold in chapter "Numbers".
N-argument operators need at least one argument, except for N which can have zero arguments, SDEV which needs at least two, and ITEM which also needs at least two (at least one item in the list, and the index).
N-argument operators can be used with data from a file by including the file name in parentheses, for instance (mydata.txt) MEAN -- see chapter Insert Files and User Defined Elements.
Home, Up: Operators and Constants, Prev: 2-Argument Operators, Next: Pseudo Operators