Calculation
| Inputs |
Continuous data (unlimited number)
or
Continuous matrices (unlimited number) |
| Output |
Continuous data
or
Continuous matrix |
Display:

Description :
The module carries out the operation described by the formula. The inputs are coded using letters (capitals and small
letters are possible). You can use as many letters as there are inputs.
An red/green indicator allows to check the syntax of the formula.
You can change the order of the inputs by moving them vertically, and then clicking on the Apply button or on
OK.
This module changes its type of output as a function of the data entered. On default setting, it makes calculations
on continuous data. But if you connect it to a matrix data item, its output will also be a matrix output.
On the other hand, if the module already has output connections, its input type is fixed. To connect matrix data to
it, it must first be disconnected from its sons.
If the box Unavailable data is considered as zero, all unavailable input data is set to zero before
computation. If not, any object with an unavailable data will be set to unavailable.
Attention: the following descriptions are also valid for the filter module.
"Formulas" tab:
Formulas list :
| Formula |
meaning |
sample |
| A>average of A |
Select the values of A which are higher than the average of A |
A>A_avg |
| A<average of A |
Select the values of A which are lower than the average of A |
A<A_avg |
| A<inferior quartile |
Select the values of A which are lower than the inferior quartile of A |
A<A_quart_inf |
| inferior quartile<A<superior quartile |
Select the values of A between the inferior quartile and the superior quartile of A |
(A>A_quart_inf) & (A<A_quart_sup) |
| A>superior quartile |
Select the values of A which are higher than the superior quartile of A |
A>A_quart_sup |
| 10 first values of A |
Select the 10 smallest values of A |
A<A_11 |
| 50 first values of A |
Select the 50 smallest values of A |
A<A_51 |
| 100 first values of A |
Select the 100 smallest values of A |
A<A_101 |
| 10 last values of A |
Select the 10 highest values of A |
A>A_n* |
| 50 last values of A |
Select the 50 highest values of A |
A>A_n* |
| 100 last values of A |
Select the 100 highest values of A |
A>A_n* |
| A equals to B |
Select the values of A equal to the values of B |
A=B |
| A equals to B with a margin of 10% |
Select the values of A between -10% and +10% of the values of B |
(A>B*0.9) & (A<B*1.1) |
| A different from B |
Select the values of A which are different from the values of B |
A<>B |
| A strictly higher than B |
Select the values of A which are strictly higher than the values of B |
A>B |
| A is equal to or higher than B |
Select the values of A which are equal of higher than B |
A>=B |
| A strictly lower than B |
Select the values of A which are stricly lower than the values of B |
A<B |
| A equals to or lower than B |
Select the values of A which are equal to or lower than the values of B |
A<=B |
* "n" is the total number of values in the statistical series A minus the number of values to select
"Operators" tab :
List of the operators available, with their order of priority:
| Order |
Operator |
Meaning |
Example |
| 1 |
, |
separator |
min(A/B,C) |
| 2 |
: |
definition of variable |
var : A/2 |
| 3 |
& |
and |
(A>5) & (A<20) |
| 3 |
| |
or |
(A<10) | (A>=20) |
| 4 |
< |
strict inferior |
B<4 |
| 4 |
> |
strict superior |
A>5 |
| 4 |
= |
equal |
A=3 |
| 4 |
>= |
superior or equal |
A*(A>=5) |
| 4 |
<= |
inferior or equal |
A-(A<=B) |
| 4 |
<> |
different |
A<>5 |
| 5 |
+ |
addition |
A+5 |
| 5 |
- |
subtraction |
A-B |
| 6 |
* |
multiplication |
A*3 |
| 6 |
/ |
division |
A/B |
| 7 |
^ |
power |
A^2 |
| 8 |
! |
negation |
!A |
| 9 |
( ) |
brackets |
(A+5)/(A*9) |
Remark : to obtain the operator | on Mac, you must use the following keys
combination : alt+shift+l.
The order of priority of the operators is strongest for brackets and weakest for the comma (separator).
Remark:
The operators <,>, <=,>=,<>,=,&,|, ! refer to Boolean data: their
value is 1 if the formula is true for the original values, and otherwise 0.
"Functions" tab :
List of the functions available, with their number of parameters:
| Function |
Meaning |
Parameter |
Example |
| random |
random value |
0 |
5*random() |
| abs |
absolute value |
1 |
abs(A) |
| cos |
cosinus |
1 |
cos(A) |
| sin |
sinus |
1 |
sin(A) |
| tan |
tangent |
1 |
tan(A) |
| coshyp |
hyperbolic cosinus |
1 |
coshyp(A) |
| sinhyp |
hyperbolic sinus |
1 |
sinhyp(A) |
| tanhyp |
hyperbolic tangent |
1 |
tanhyp(A) |
| arccos |
cosinus arc |
1 |
arccos(A) |
| arcsin |
sinus arc |
1 |
arcsin(A) |
| arctan |
tangent arc |
1 |
arctan(A) |
| exp |
exponential |
1 |
exp(A-B) |
| ln |
Neperian logarithm |
1 |
ln(A/B) |
| log10 |
base ten logarithm |
1 |
log10(A+5*B) |
| ceil |
smallest superior integer |
1 |
ceil(A) |
| floor |
largest lower integer |
1 |
floor(A) |
| round |
closest integer |
1 |
round(A) |
| root |
square root |
1 |
root(A) |
| arctan2 |
tangent arc of (B/A) |
2 |
arctan2(A,B) |
| equal |
equality |
unlimited |
equal(A/2,B,C) |
| min |
minimum value |
unlimited |
min(A,B,C) |
| max |
maximum value |
unlimited |
max(A,B) |
Remark:
- round(A) gives 45 if the initial value is 44.5
- equal(A,B) gives a Boolean data item (0 or 1)
"Variables" tab :
List of the variables available:
| Variable |
Meaning |
Example |
| _min |
minimum value |
C_MIN+10 |
| _max |
maximum value |
(B_MAX-B_MIN)/2 |
| _sum |
sum total of the values |
A_SUM>B_SUM |
| _avg |
average of the values |
A>A_AVG |
These five variables are thus used by putting the letter corresponding to an input data item in front of them.
"Thresholds" tab :
The data are sorted by ascending order. The threshold corresponds to the position, the index in the list, of the
sorted data. This threshold is identified in the column "Threshold N".
Sample :
To obtain the 11th smallest of your data, just enter "11" into the table. You can the use the created variable named
"A_11".
High-level functions:
-
Calculation with Boolean data items
The opérateurs <, >, <=, >=, <>, =, &, |, ! give a data item whose
value is 1 if the formula is true for the initial values, and otherwise 0 sinon.
Examples :
Data item A has the following values:
2 5 6 8 15 2 40 56
this means that the result of the calculation with A>10 is as
follows:
0 0 0 0 1 0 1 1
and the result with A*(A>10) is :
0 0 0 0 15 0 40 56
- Calculation with powers of 10
You can use the powers of 10 in the formula with the following notation: 1e+10
Example :
A*0.053 can also be writtenA*5.3e-2
- Definition of variables in the formula
Example :
weight : ln(A)/2 , weight/2 + weight + 5/weight
The variable weight has been once defined, and has been used 3 times in the formula to simplify it and
accelerate computation.
- Limit number of digit
Round 2 digits after the decimal point:
value:log10(A+5) , round(value*100)/100
- Avoid division by zero
A2:A-(A=0), (A2>0)*B/A2
We first replace the zero by -1 with A:A-(A=0)
Then the computation can be done, only for positive values of A (A>0)*B/A
This formula does not work if some values of A are negative.
Script:
2 module untyped_list ""
3 mod_type integer "103"
3 mod_subtype integer "501"
3 mod_name string "Calcul"
3 mod_dads integer_list ""
4 ? integer "7"
4 ? integer "6"
3 formule string "B/A*100"
3 work_on_matrix boolean "F"
3 unavail_is_zero boolean "F"
Samples
|