# Math Functions

There is an extensive list of math functions available in Simul8 through the Formula Editor in Visual Logic.

ABS
Converts a number to a positive number.

ARCTAN
Returns Arc Tangent of the parameter.

COS
Returns Cosine of the parameter.

DAY
Converts number from time to day 1-7 calculated from the Clock Properties.

EXP
Returns e to the power of the parameter (natural anti-log).

HOUR
Converts number from time to hour 1-23.

INSET
Search through a series of numbers without needing to use multiple IF Statements, e.g. IF variable INSET[1-5,9,12] will allow to test if the variable is equal to 1, 2, 3, 4, 5, 9, or 12. Please Note: This Command is case sensitive and must be in capital letters.

LOG
Returns the natural logarithm of the parameter.

MINUTE
Converts number from time to minute 1-59.

NEG
Multiplies the number by -1.

RANDOM
Returns a random number between 1 and 0. The parameter entered must be zero.

REALMOD
Calculates the mod (remainder after divide) for real number, e.g. REALMOD[8\7.5] would give 0.5, where \ is the mod operator.

ROUND
Rounds a number to the nearest integer. If the number to be rounded is exactly halfway between two whole numbers, the result is always the even number. This method of rounding is often called “Banker’s Rounding”. If you wish to round to the lower integer value always use the TRUNC function.

SAMPLE
Gets a random value from a statistical distribution.

SHEETCOLN
Converts text sheet columns labels to numbers (e.g. column A = 1).

SIN
Returns the Sine of the parameter.

SQRT
Retruns the square root of the parameter.

TAN
Retruns the tangent of the parameter.

TRUNC
Rounds number to integer by moving towards zero.

WEEK
Converts number from time to week number 1, week number 2 etc. Calculated using Clock Properties.

WIPROPERTY 