Mathematical functions
Function summaries
abs
Returns the absolute value. That is, if the number is negative, the positive equivalent is returned. If it is positive already, the number provided is returned.
Parameters
0. number (required): the number from which to find the absolute value
Returns
number: the absolute value of the argument
Example
acos
Computes and returns the inverse cosine of the given number. The given argument must fall between -1 and 1 (inclusive.) This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the inverse cosine
Returns
number: the inverse cosine of the given number
Example
acosh
Computes and returns the inverse hyperbolic cosine of the given number. The argument must be 1 or greater. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number: the number from which to derive the inverse hyperbolic cosine
Returns
number: the inverse hyperbolic cosine of the given argument
Example
asin
Computes and returns the inverse sine of the given number. The given argument must fall between -1 and 1 (inclusive.) This function (and all the trigonometric functions) operate in radians.
Parameters
0. number: the number from which to derive the inverse sine
Returns
number: the inverse sine of the given number
Example
asinh
Computes and returns the inverse hyperbolic sine of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number: the number from which to derive the inverse hyperbolic sine
Returns
number: the inverse hyperbolic sine of the given argument
Example
atan
Computes and returns the inverse tangent of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number: the number from which to derive the inverse tangent
Returns
number: the inverse tangent of the given argument
Example
atanh
Computes and returns the inverse hyperbolic tangent of the given number. The argument must be between -1 and 1 (exclusive.) This function (and all the trigonometric functions) operate in radians.
Parameters
0. number: the number from which to derive the inverse hyperbolic tangent
Returns
number: the inverse hyperbolic tangent of the given argument
Example
ceil
Round number up to its nearest integer ceiling. If it's already an integer, the same number provided is returned.
Parameters
0. number (required): the number to round up
Returns
number: the integer ceiling of the argument
Example
choose
Parameters
Returns
Example
cos
Computes and returns the cosine of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the cosine
Returns
number: the cosine of the given number
Example
cosh
Computes and returns the hyperbolic cosine of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the hyperbolic cosine
Returns
number: the hyperbolic cosine of the given number
Example
diff
Parameters
Returns
Example
factorial
Computes the factorial of the argument. This is computed via the gamma function, thus allowing fractional numbers. The largest argument that can be provided is approximately 1754.548. Anything larger than that results in an out-of-range error.
Parameters
0. positive number (required): the number from which to compute the factorial
Returns
number: the computed factorial of the argument
Example
floor
Removes the fractional part of the provided argument, leaving only an integer.
Parameters
0. number (required): the number to find the floor of
Returns
number: the floor of the given number
Examples
log
With only one argument, computes the natural logarithm of the given number to base e. With two arguments, computes and returns the logarithm of the first argument (x) to the given base, calculated as log[x] / log[base].
Parameters
0. number (required): the number from which to derive the logarithm
1. number (optional): the logarithm base to use in the computation
Returns
number: the computed logarithm
Example
mean
Parameters
Returns
Example
median
Parameters
Returns
Example
neg
Negates the provided argument. That is, a given negative number returns positive, and a given positive number becomes negative.
Parameters
0. number (required): the number to negate
Returns
number: the negated argument
Examples
pow
Returns the exponent of the given base number raised to the given power. If the power is omitted, the base will be squared (power 2.)
Parameters
0. number (required): the base number to raise to the given power
1. number (optional): the power to which to raise the base number
Returns
number: the exponent of the given base raised to the given power
Examples
product
Parameters
Returns
Example
quotient
Parameters
Returns
Example
rand
Generates and returns a random number, most likely fractional, between the two arguments (exclusive.) It doesn't matter which is the high bound and which is the low bound--the number generated will be between them either way. If both parameters are the same number, that number will be returned.
Parameters
0. number (required): either the upper or lower bound of the number to generate
1. number (required): the other bound of the number to generate
Returns
number: a random number between the two arguments
Example
randint
Generates and returns a random integer between the two arguments (inclusive.) It doesn't matter which is the high bound and which is the low bound--the number generated will be between them either way. If both parameters are the same number, that number will be returned.
Parameters
0. number (required): either the upper or lower bound of the integer to generate
1. number (required): the other bound of the integer to generate
Returns
number: a random integer between the two arguments
Example
round
Rounds the given number to the nearest integer. If the number is exactly half-way between two integers, this function will round towards infinity if positive, and negative infinty if negative.
Parameters
0. number: the number to round
Returns
The rounded number of the given parameter.
Examples
shuffle
Parameters
Returns
Example
sin
Computes and returns the sine of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the sine
Returns
number: the sine of the given number
Example
sinh
Computes and returns the hyperbolic sine of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the hyperbolic sine
Returns
number: the hyperbolic sine of the given number
Example
sqrt
Returns the square root of the provided number.
Parameters
0. number (required): the number of which to find the square root
Returns
number: the square root of the provided number
Examples
sum
Parameters
Returns
Example
tan
Computes and returns the tangent of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the tangent
Returns
number: the tangent of the given number
Example
tanh
Computes and returns the hyperbolic tangent of the given number. This function (and all the trigonometric functions) operate in radians.
Parameters
0. number (required): the number from which to derive the hyperbolic tangent
Returns
number: the hyperbolic tangent of the given number