Math OperatorsAll math operators take one or more numbers as arguments and return a numeric result, generally a real number. Math operators that can return complex results will do so only if complex results are allowed in the current context. Elzed supports the following math operators:
absolute value
abs( number )
Returns the non-negative magnitude of the indicated number.
ceiling
ceil( number )
Returns the least integer not less than the passed-in number. For example, ceil( 10.9 ) is 11, but ceil( -10.9 ) is -10.
base-10 logarithm
log( number )
Returns the log base 10 of the indicated number.
complex argument
arg( number )
Returns the complex argument of the indicated number.
complex conjugate
conj( number )
Returns the complex conjugate of the indicated number.
cube root
cbrt( number )
Returns the cube root of the indicated number.
floor
floor( number )
Returns the largest integer not greater than the passed-in number. Don't confuse this operator with the integer function. For example, floor( 10.4 ) is 10, while floor( -10.4 ) is not -10 but -11, since -11 is less than -10.4, but -10 is greater.
fractional part
frac( number )
Returns the fractional part of the passed-in number. For example, frac( -3.45 ) is -0.45.
imaginary part
imag( number )
Returns the imaginary part of the passed-in number. For example, imag( sqrt( -1 ) ) is 1.0.
integer part
int( number )
Returns the integer part of the passed-in number. For example, int( -3.45 ) is -3.
natural logarithm
ln( number )
Returns the natural logarithm (log base e) of the passed-in number.
nearest integer
nint( number )
Returns the nearest integer to the passed-in number. For example, int( -3.45 ) is -3.
polar complex
( number |/ number )
Formed with the bar "|" and forward slash "/". Separates the real (left) and imaginary (right) parts of a complex number expressed in polar coordinates.
random number
rand( number )
Returns a random number between zero and the indicated number. Fraction parts are allowed and will be returned. Negative number are allowed, but will be returned only if the passed-in number is negative.
random number in range
randrange( minimum, maximum )
randrange( maximum, minimum )
Returns a random whole number between the minimum and maximum values passed in. Fractional parts of either extreme are ignored, but negative numbers are allowed.
random number seed
randseed( number )
Sets the seed used by the random number generator. The random number generator will produce the same series of numbers given the same seed.
real part
real( number )
Returns the real part of the passed-in number. For example, real( sqrt( -1 ) ) is 0.0.
rectangular complex
( number |_ number )
Formed with the bar "|" and underscore "_". Separates the real (left) and imaginary (right) parts of a complex number expressed in rectangular coordinates.
root
root( n, x )
Returns the nth root of x. For example, root( 2, 4 ) returns 2 (the square root of 4).
sign
sign( number )
Returns 1 for positive numbers, -1 for negative numbers, and 0 for zero.
square root
sqrt( number )
Returns the square root of the passed-in number.
|