Evaluate a mathematical expression.
Expr expression
Expr evaluates mathematical expressions in a format resembling programming languages like C, Java or Tcl. The expression is composed of numbers, arithmetic operators, math functions like sin or log and variables.
Integer, floating-point, and complex numbers can be used as constants within an expression.
Variables are alphanumeric strings preceded by a $. The first letter or pair of letters after the $ determine the type of the variable:
For example $i1 would be an integer variable and $sfoo would be a audio-sample variable. For each variable used in the expression, an inlet of the same name and type is created for the Expr transform. So the expression $i1 + $f2 / $f3 would have one Integer inlet and two Float inlets.
The valid operators are listed below, in order of decreasing precedence:
Operator precedence can of course be overriden using parentheses.
Expr understands the following math functions:
See the documentation for the standalone versions of these functions for their valid argument types. It is possible to extend the set of available functions via special external libraries.
The expression is evaluated whenever a new value is received via any of the inlets. A single outlet is provided to transmit the result of the expression evaluation. If no variables are specified in the expression (i.e., the expression is constant), a single inlet of type unit is created. When this inlet receives a unit value, the constant expression is evaluated.