# Functions and operators to use in simulations

You can use the following functions and operators in the equation editor in the Monte Carlo simulation tool.
Square root (√ )
Calculates the square root for a positive number. A negative number returns *.
• Syntax: sqrt(number)
• Example: sqrt(100) returns 10
X squared (X2)
Multiplies the number by itself, or X*X.
• Syntax: number^2
• Example: 4^2 returns 16
X cubed (X3)
Multiplies the number by itself twice, or X*X*X.
• Syntax: number^3
• Example: 4^3 returns 64
X to the nth (Xn)
Multiplies the number by itself the number of times you specify, or X*n.
• Syntax: number^n
• Example: 4^6 returns 4,096
Pi (π)
Multiplies the number by 3.14.
• Syntax: pi(number)
• Example: pi(4) returns 12.5663706144
Logten (log)
Calculates logarithm to the base 10.
• Syntax: logten(number, base)
• Example: log(7.38905) returns 2
Natural log or log base e (ln)
Calculates logarithm to the base e.
• Syntax: ln(number)
• Example: ln(7.38905) returns 2
Exponential (ex)
Calculates e raised to a power, where e is the constant 2.718281.
• Syntax: exp(number)
• Example: exp(2) returns 7.39
If
Checks whether a condition is met, and returns one value if true, and another value if false.
• Syntax: if(logical_test, value_if_true, value_if_false)
• Example: if(variable1>5, 1, 0) returns 1 if variable1 is greater than 5, and returns 0 if variable1 is less than or equal to 5
And
Checks whether all the conditions are true. Returns true if all conditions are met and false otherwise. It is often useful to use the "and" function as the first argument of an "if" function, for example, if(and(logical_test1, logical_test2, ...), 1, 0).
• Syntax: and(logical_test1, logical_test2, ...)
• Example: and(variableA>5, variableB >7) returns 1 if variableA is greater than 5 and variableB is greater than 7; returns 0 if either variableA is less than or equal to 5, or if variableB is less than or equal to 7
Or
Checks whether any of the conditions are true. Returns true if at least one condition is met and false otherwise. It is often useful to use the "or" function as the first argument of an "if" function, for example, if(or(logical_test1, logical_test2, ...), 1, 0).
• Syntax: or(logical_test1, logical_test2, ...)
• Example: or(variableA>5, variableB >7) returns 1 if variableA is greater than 5, or variableB is greater than 7, or both are true; returns 0 if both variableA is less than or equal to 5, and variableB is less than or equal to 7
Not
Changes false to true, or true to false. Used to negate a logical condition.
• Syntax: not(logical_test)
• Example: not(variableA>5) returns 1 if variableA is less than or equal to 5; returns 0 if variableA is greater than 5
Absolute value (abs)
Changes all negative numbers to positive numbers. Positive numbers and zero are unchanged.
• Syntax: abs(number)
• Example: abs(-5) returns 5
Minimum (min)
Returns the smallest value in a series of numbers, variables, constants, or functions.
• Syntax: not(logical_test)
• Example: not(variableA>5) returns 1 if variableA is less than or equal to 5; returns 0 if variableA is greater than 5
Maximum (max)
Returns the largest value in a series of numbers, variables, constants, or functions.
• Syntax: min(number)
• Example: min(2, 4, 6, 8, 10) returns 2
Round
Rounds a value to a specified number of decimal places. Round accepts negative arguments. When a second argument is not entered, 0 is used.
• Syntax: round(number, num_digits)
• Example: round(103.058, 2) returns 103.06; round(103.058, -2) returns 100; round(103.058) returns 103
Degrees
Converts angles measured in radians to degrees.
• Syntax: degrees(number)
• Example: degrees(1.5) returns 86º