STEM help / Editor skills

4.12.1 Operators and functions

The following table lists all the operators and functions you can use in formulae for the input data of a STEM model. Precedence and associativity of binary operators can be imposed with parentheses in the usual way. Note that STEM recognises the use of commas to format large numbers (e.g., 1,000,000) within expressions. For this reason, whenever you use commas to separate elements within a formula such as if(Input1, 1, 0) you must always follow each comma with a space. If you omit the space, STEM may treat two adjacent numbers as one. This requirement applies for all elements within a formula, not just numbers.

Binary Operators (in increasing order of precedence)
< <= == != >= > && || Relational and logical operators (&& for AND, || for OR)
+ – Addition and subtraction
* / Multiplication and division
^ Exponentiation
Unary Operators
Sign inversion
! Logical NOT
Functions
sin(x) cos(x) tan(x)
asin(x) acos(x) atan(x) atan2(x)
pi()
Trigonometric functions, inverse functions and p
exp(x) ln(x) log(x) ex, natural logarithm and logarithm base 10
int(x)
ceil(x)
floor(x)
Make integral
Round up: ceil(2.3) = 3, ceil(–2.3) = –2
Round down: floor(2.3) = 2, floor(–2.3) = –3
abs(x) sqrt(x) Absolute value and square root
mean(x, y) min(x, y) max(x, y) Average, minimum and maximum
mod(x, y) Remainder of dividing x by y
sum(x, y, z, …) Sum of several arguments
if(x, y, z) Conditional: if x is non zero, then y, else z
and(x, y) or(x, y) not(x) Functional forms of logical AND, OR and NOT operators
isNaN(x)
notNaN(x, y)
Not-a-number function, e.g., to trap division by zero
Equivalent to if(isNaN(x), y, x)

Operators and functions

 

       Buy SSL

© Implied Logic Limited