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 A collection of labels identifying the items of an array.), or a mixture of arrays of the same order and scalars (in which case the first argument cannot be a scalar An output consisting of a single value or condition.). |
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 A collection of variables that share common output attributes and can be manipulated in GoldSim elements or input expressions. 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 An output attribute for an element that defines the dimensionality (in terms of Length, Time and other fundamental dimensions) of the output., 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 |
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.