Short Description
Execute complex math operations on sequences, such as ‘3*sequence1 + log(sequence2)/sequence3’, in a single step. All the operations are executed pointwise.
Documentation
This plugin is similar to the Math operations plugin: it provides usual pointwise math operations on sequences, such as addition, product, absolute value extraction, rounding to the closest integer, etc. However, it also allows the user to perform complex combinations of theses operations, using a mathematical expression interpretor.
Please have a look to the Math operations plugin documentation: it will give you details about the general behaviour of Math operations++. Mathematical expressions, which are specific to this plugin, are described below.
The features provided by this plugin can be accessed:
- directly through the GUI (using a EzPlug interface),
- through the protocol editor provided by the Blocks plugin,
- from the java code (see the documentation in the Functor.java (in the Math operation plugin package) and Expression.java files for more details).
Mathematical expression
Using mathematical expressions, it is possible to define math operations such as:
- 5*a + 1/2*b
- rho*cos(theta) + alpha^(-2)
The first example defines an expression which is a linear combination of two variables (a and b); the second example involves three variables (rho, theta and alpha) in a more complex operation. Each of these variables represents a sequence, a scalar value or an array (see the Math operations plugin documentation for details about the objects that can be used as inputs of math operations).
In the EzPlug interface, variables can have any name composed of a–z, A–Z, 0–9 or _ characters. In the protocol editor, variable names must correspond to the names of block entries, i.e. a, b, c or d.
The lists of available operators and functions that can be used to define mathematical expressions are presented below.
Available operators
- + : addition
- - : subtraction
- * : multiplication
- / : division
- ^ : power
All the operators are left-associative, which means that a/b/c will be evaluated as (a/b)/c. Usual precedence rules between operators apply: operator ^ is evaluated first, then * and /, and finally + and -. For instance, -a^3 + 4/3*b will be interpreted as (-(a^3)) + ((4/3)*b).
Available functions
All the following functions expect one argument, unless otherwise specified.
- abs : absolute value
- sign : sign extraction
- sqrt : square root
- exp : exponential function
- log : natural logarithm
- log10 : decimal logarithm
- cos : cosine
- sin : sine
- tan : tangent
- acos : arc cosine
- asin : arc sine
- atan : arc tangent
- cosh : hyperbolic cosine
- sinh : hyperbolic sine
- tanh : hyperbolic tangent
- round : rounding to the closest integer
- floor : rounding to the largest previous integer
- ceil : rounding to the smallest following integer
- max : maximum (expects two arguments)
- min : minimum (expects two arguments)