Functions

A supported function can be used to write an expression.

Trigonometric functions

Each function returns a real number value. By default, trigonometric functions use radians to calculate angles. You can append a function name with a "d" character to use degrees, for example sind(), sasad() and sasssa1d().

All standard trigonometric functions are implemented to resemble functions in standard C math library as close as possible. Therefore, radians are the default unit for calculations. This differs from matrix transformation functions, which operate using degrees.

You can perform unit specification, but remember to always use the canonical unit of angles. For example, sin(45 {deg}) and sind(.5 {rad}) are valid expressions.

Unit circle

Name Description
sin(a) Sine function.
cos(a) Cosine function.
tan(a) Tangent function.
asin(a) Inverse sine function.
acos(a) Inverse cosine function.
atan(a) Inverse tangent function.
atan2(a, b) If a is not zero, calculates inverse tangent of b/a; otherwise returns pi/2.

Generic triangles

Name Description
sasa(a, beta, c) Returns the value of alpha.
sass(a, beta, c) Returns the value of b.
sssa(a, b, c) Returns the value of alpha.

Quadrilaterals

Name Description
sasasa(A, a, B, b, C) Returns the value of c.
sasass(A, a, B, b, C) Returns the value of D.
sasssa1(A, a, B, C, D) Returns the value of b.
sasssa2(A, a, B, C, D) Returns the value of c.

Angle conversion functions

Name Description
degree(a) Converts a given radian value to degree value.
radian(a) Converts a given degree value to a radian value.

Power functions

Name Description
pow(a, b) Returns a to the power of b.
sqrt(a) Returns the square root of a.
exp(a) Returns the e value to the power of a.
log(a) Returns the natural logarithm of a.
log10(a) Returns the logarithm base 10 of a.

Hyperbolic functions

Name Description
sinh(a) Hyperbolic sine function.
cosh(a) Hyperbolic cosine function.
tanh(a) Hyperbolic tangent function.

Vector and matrix construction functions

The following functions can be used to return a vector or matrix in an expression.

Name Description
AxisAngle(i, j, k, angle) Returns identity matrix rotated around a given axis and angle.
Euler(a, b, c) Returns a matrix with given Euler angles and a zero position.
Identity() Returns identity matrix.
IJK(i, j, k) Returns identity matrix with its approach axis (Z-axis) parallel to a given vector.
Pos(x, y, z) Returns identity matrix translated to a given position.
Quaternion(q1, q2, q3, q4) Returns identity matrix rotated with given quaternion values.
Rx(angle) Returns identity matrix rotated around X-axis by a given angle.
Ry(angle) Returns identity matrix rotated around Y-axis by a given angle.
Rz(angle) Returns identity matrix rotated around Z-axis by a given angle.
Set(v1, v2, ..., v16) Returns matrix initialized with given values where v1...v4 are N vector values, v5...v8 are O vector values, v9...v12 are A vector values, and v13...16 are P vector values.
Sx(factor) Returns identity matrix scaled along X-axis by a given factor.
Sy(factor) Returns identity matrix scaled along Y-axis by a given factor.
Sz(factor) Returns identity matrix scaled along Z-axis by a given factor.
Tx(dist) Returns identity matrix translated along X-axis by a given distance.
Ty(dist) Returns identity matrix translated along Y-axis by a given distance.
Tz(dist) Returns identity matrix translated along Z-axis by a given distance.
Vector(x, y, z) Returns vector with given XYZ coordinates.
Vector(x, y, z, w) Returns vector with a given XYZ coordinates and W value.
WPR(w, p, r) Returns identity matrix rotated by given yaw, pitch, and roll angles.

Miscellaneous functions

Name Description
abs(x)

Returns the absolute value |x|.

ceil(x) Returns the smallest integer that is larger or equal to x.

Note: The return type is a real value.

floor(x) Returns the largest integer that is smaller or equal to x.

Note:  The return type is a real value.

inrange(a, b, c) Returns True if b is within range of a and c; otherwise returns False.
max(a, b) Returns a or b, whichever is the largest value.
min(a, b) Returns a or b, whichever is the smallest value.
mod(a, b) Returns the remainder of a/b.

ramp(x, x1, y1, x2, y2)

Returns the y value corresponding to x on the line (x1, y1) - (x2, y2).
range(a, b, c) Returns a if b is less than a.

Returns b if b is within range of a and c.

Returns c if b is greater than c.

round(x) Returns the integer nearest to x. This function rounds up in case x is exactly halfway between integers.

Note: The return type is a real value.

Pseudo-random distribution functions

Note: Only random streams function in Process Modeling Statements.

Distribution

Name Description
normal(u, s) Normal distribution for mean value of u and standard deviation of s.
lognormal(u, s) Log normal distribution for mean value of u and standard deviation of s.
uniform(a, b) Uniform distribution in range a <= x < b.
exponential(lambda) Exponential distribution where mean is 1/lambda and variance is 1/lambda^2.
gamma(k, theta) Gamma distribution with shape k and scale theta.
triangular(min, mode, max) Triangular distribution for given min, mode and max values.
weibull(k, lambda) Weibull distribution with shape k and scale lambda.

Random Stream

Name Description
normal(stream, u, s) Same as Distribution functions but with stream argument.
lognormal(stream, u, s)
uniform(stream, a, b)
exponential(stream, lambda)
gamma(stream, k, theta)
triangular(stream, min, mode, max)
weibull(stream, k, lambda)