Math Functions

GoldSim provides the following standard mathematical functions:

 

Function

Description

abs(X)

Absolute value of X

exp(U)

Exponential (e^U)

ln(U)

Natural logarithm of U

log(U)

Logarithm base 10 of U

max(X,Y,…)

Returns the maximum of a list of arguments.  The first argument determines the order of the output. Arguments must either be all scalars, all arrays of the same order (and set of array labels), or a mixture of arrays of the same order and scalars (in which case the first argument cannot be a scalar).

min(X,Y,…)

Returns the minimum of a list of arguments. The first argument determines the order of the output. Arguments must either be all scalars, all arrays of the same order (and set of array labels), or a mixture of arrays of the same order and scalars (in which case the first argument cannot be a scalar).

mod(X,Y)

Modulus: remainder of X/Y; sign is sign of X.  The first argument determines the order of the output. Arguments can be scalars, arrays of the same order (and set of array labels) or mixed (in particular, if X is an array, Y can be a scalar; if X is a scalar, however, Y cannot be an array). If X and Y have dimensions, they must have the same dimension (although the units can be different), and the result has the same dimension as X and Y.

round(U)

Rounds off U

sqrt(X)

Square root of X.  Note: if X has units, they must be an even power, for example: sqrt(5 m2) is OK, but sqrt(5m) is not.

trunc(U)

Truncates U

ceil(U)

Returns the next integer that is greater than U

floor(U)

Returns the next integer that is less than U

U: Must be a unitless value. Can be a scalar or an array.
X, Y: A value. Can be a scalar or an array.

   Note: Because round-off may result in a calculated integer value being slightly above or below the exact integer, GoldSim allows for a fractional error of 1e-12 when evaluating the ceil() and floor() functions.  For example, although ceil(4.000001) returns 5, ceil(4.000000000001) returns 4.

Related Topics…