Ecolego has a list of mathematical functions to use in expressions. A special function is the time function, which returns the simulation time.
It is also possible to create custom functions, written in Java. For more information see Creating custom functions.
Here follows a short description of functions included in the Expression editing tool.
Constant | |
| end_time | The simulation end time, as specified in simulation settings |
| EPS | the distance from 1.0 to the next larger double precision number, that is EPS=2-52. |
| iteration | The current iteration, for probabilistic simulations. |
| PI | 4×atan(1) = imag(log(-1)) = 3.1415926535897.... |
| start_time | The simulation start time, as specified in simulation settings |
| time | the current simulation time-point |
Trigonometric | |
| ACOS(X) | the arccosine of the elements of X. |
| ASIN(X) | the arcsine of the elements of X. |
| ATAN(X) | the arctangent of the elements of X. |
| ATAN2(Y,X) | the four quadrant arctangent of the real parts of the elements of X and Y. -pi <= ATAN2(Y,X) <= pi. |
| COS(X) | the cosine of the elements of X. |
| COSH(X) | the hyperbolic cosine of the elements of X. |
| SIN(X) | the sine of the elements of X. |
| SINH(X) | the hyperbolic sine of the elements of X. |
| TAN(X) | the tangent of the elements of X. |
| TANH(X) | the hyperbolic tangent of the elements of X. |
Exponential | |
| EXP(X) | the exponential of the elements of X, e to the X. |
| HYPOT(A,B) | returns SQRT(ABS(A)2+ABS(B)2) carefully computed to avoid underflow and overflow. |
| LOG(X) | the natural logarithm of the elements of X. |
| LOG10(X) | the base 10 logarithm of the elements of X. |
| LOG2(X) | the base 2 logarithm of the elements of X. |
| SQRT(X) | the square root of the elements of X. |
Rounding and Remainder | |
| CEIL(X) | rounds the elements of X to the nearest integers towards infinity. |
| FIX(X) | rounds the elements of X to the nearest integers towards zero. |
| FLOOR(X) | rounds the elements of X to the nearest integers towards minus infinity. |
| MOD(x,y) | is x - n×y where n = floor(x/y) if y <> 0. If y is not an integer and the quotient x/y is within roundoff error of an integer, then n is that integer. |
| REM(x,y) | is x - n×y where n = fix(x/y) if y <> 0. If y is not an integer and the quotient x/y is within roundoff error of an integer, then n is that integer. |
| ROUND(X) | rounds the elements of X to the nearest integers. |
General | |
| ABS(X) | the absolute value of the elements of X. |
| MAX(X,Y) | returns an array the same size as X and Y with the largest elements taken from X or Y. Either one can be a scalar. |
| MIN(X,Y) | returns an array the same size as X and Y with the smallest elements taken from X or Y. Either one can be a scalar. |
| SIGN(X) | For each element of X, SIGN(X) returns 1 if the element is greater than zero, 0 if it equals zero and -1 if it is less than zero. |