Operations and functions in expressions
Operators
Operation | Character | Description |
---|---|---|
Addition | + | Produces the sum of numeric values. |
Subtraction | - | Subtracts the two numeric values. |
Multiplication | * | Multiplies the numeric values. |
Division | / | Divides two numeric values. |
Exponentiation | ^ | Calculates the exponential value of the given numbers. |
Remainder operator | % | Gives the remainder after the division of one numeric value to another. e.g. 5%2 = 1, because 5/2 leaves remainder of 1. |
Expressions
Expressions are evaluated according to the standard mathematical rules of precedence:
- Expressions within brackets; innermost sets first.
- Standard operations order:
- 1. exponent
- 2. multiplication and division
- 3. addition and subtraction
- Operators of equal precedence from left to right.
The following functions can be used in expressions:
Function | Syntax |
---|---|
Sine | sin(expression) |
Cosine | cos(expression) |
Tangent | tan(expression) |
Arc sine | asin(expression) |
Arc cosine | acos(expression) |
Arc tangent | atan(expression) |
Hyperbolic sine | sinh(expression) |
Hyperbolic cosine | cosh(expression) |
Hyperbolic tangent | tanh(expression) |
Arc hyperbolic sine | asinh(expression) |
Arc hyperbolic cosine | acosh(expression) |
Arc hyperbolic tangent | atanh(expression) |
Square root | sqrt(expression) |
Signum function (-1,0,1) | sign(expression) |
Round to nearest integer | round(expression) |
Truncate decimal | trunc(expression) |
Round down | floor(expression) |
Round up | ceil(expression) |
Absolute value | abs(expression) |
Largest element in array | max(expression1;expression2)* |
Smallest element in array | min(expression1;expression2)* |
Degrees to radians | d2r(expression) |
Radians to degrees | r2d(expression) |
Logarithm, base e | ln(expression) |
Logarithm, base 10 | log(expression) |
Exponent, base e | exp(expression) |
Exponent, base 10 | exp10(expression) |
Power function | pow(expression1;expression2)* |
Random decimal between 0 and 1 | Random |
* Use the list separator character as defined on your system: , (comma) or ; (semicolon).
Note:
- The constants Pi=3.14... and e=2.72... can be used in expressions. The constants names are not allowed to be used as a parameter or constraint name.
- The CLEANUNUSEDVARIABLES command purges parameters that are not used in constraint expressions or linked to dimensions.