Skip to main content

# Math functions

These functions can be used when analysing numeric data and numeric collections.

FunctionDescription
`math::abs()`Returns the absolute value of a number
`math::bottom()`Returns the bottom X set of numbers in a set of numbers
`math::ceil()`Rounds a number up to the next largest integer
`math::fixed()`Returns a number with the specified number of decimal places
`math::floor()`Rounds a number down to the nearest integer
`math::interquartile()`Returns the interquartile of an array of numbers
`math::max()`Returns the maximum number in a set of numbers
`math::mean()`Returns the mean of a set of numbers
`math::median()`Returns the median of a set of numbers
`math::midhinge()`Returns the midhinge of a set of numbers
`math::min()`Returns the minimum number in a set of numbers
`math::mode()`Returns the value that occurs most often in a set of numbers
`math::nearestrank()`Returns the nearest rank of an array of numbers
`math::percentile()`Returns the value below which a percentage of data falls
`math::product()`Returns the product of a set of numbers
`math::round()`Rounds a number up or down to the nearest integer
`math::spread()`Returns the spread of an array of numbers
`math::sqrt()`Returns the square root of a number
`math::stddev()`Calculates how far a set of numbers are away from the mean
`math::sum()`Returns the total sum of a set of numbers
`math::top()`Returns the top X set of numbers in a set of numbers
`math::trimean()`The weighted average of the median and the two quartiles
`math::variance()`Calculates how far a set of numbers are spread out from the mean

## `math::abs`​

The `math::abs` function returns the absolute value of a number.

``API DEFINITIONmath::abs(number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::abs(-13.746189);13.746189``

## `math::bottom`​

The `math::bottom` function returns the bottom X set of numbers in a set of numbers.

``API DEFINITIONmath::bottom(array<number>, number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::bottom([1, 2, 3], 2);[ 2, 1 ]``

## `math::ceil`​

The `math::ceil` function rounds a number up to the next largest integer.

``API DEFINITIONmath::ceil(number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::ceil(13.146572);14``

## `math::fixed`​

The `math::fixed` function returns a number with the specified number of decimal places.

``API DEFINITIONmath::fixed(number, number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::fixed(13.146572, 2);13.15``

## `math::floor`​

The `math::floor` function rounds a number down to the nearest integer.

``API DEFINITIONmath::floor(number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::floor(13.746189);13``

## `math::interquartile`​

The `math::interquartile` function returns the interquartile of an array of numbers.

``API DEFINITIONmath::interquartile(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::interquartile([ 1, 40, 60, 10, 2, 901 ]);51``

## `math::max`​

The `math::max` function returns the maximum number in a set of numbers.

``API DEFINITIONmath::max(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::max([ 26.164, 13.746189, 23, 16.4, 41.42 ]);41.42``

## `math::mean`​

The `math::mean` function returns the mean of a set of numbers.

``API DEFINITIONmath::mean(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::mean([ 26.164, 13.746189, 23, 16.4, 41.42 ]);24.1460378``

## `math::median`​

The `math::median` function returns the median of a set of numbers.

``API DEFINITIONmath::median(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::median([ 26.164, 13.746189, 23, 16.4, 41.42 ]);23``

## `math::midhinge`​

The `math::midhinge` function returns the midhinge of an array of numbers.

``API DEFINITIONmath::midhinge(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::midhinge([ 1, 40, 60, 10, 2, 901 ]);29.5``

## `math::min`​

The `math::min` function returns the minimum number in a set of numbers.

``API DEFINITIONmath::min(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::min([ 26.164, 13.746189, 23, 16.4, 41.42 ]);13.746189``

## `math::mode`​

The `math::mode` function returns the value that occurs most often in a set of numbers. In case of a tie, the highest one is returned.

``API DEFINITIONmath::mode(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::mode([ 1, 40, 60, 10, 2, 901 ]);901``

## `math::nearestrank`​

The `math::nearestrank` function returns the nearestrank of an array of numbers.

``API DEFINITIONmath::nearestrank(array<number>, number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::nearestrank([1, 40, 60, 10, 2, 901], 50);40``

## `math::percentile`​

The `math::percentile` function returns the value below which a percentage of data falls.

``API DEFINITIONmath::percentile(array<number>, number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::percentile([1, 40, 60, 10, 2, 901], 50);25``

## `math::product`​

The `math::product` function returns the product of a set of numbers.

``API DEFINITIONmath::product(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::product([ 26.164, 13.746189, 23, 16.4, 41.42 ]);5619119.004884841504``

## `math::round`​

The `math::round` function rounds a number up or down to the nearest integer.

``API DEFINITIONmath::round(number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::round(13.53124);14``

## `math::spread`​

The `math::spread` function returns the spread of an array of numbers.

``API DEFINITIONmath::spread(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::spread([ 1, 40, 60, 10, 2, 901 ]);900``

## `math::sqrt`​

The `math::sqrt` function returns the square root of a number.

``API DEFINITIONmath::sqrt(number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::sqrt(15);3.872983346207417``

## `math::stddev`​

The `math::stddev` function calculates how far a set of numbers are away from the mean.

``API DEFINITIONmath::stddev(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::stddev([ 1, 40, 60, 10, 2, 901 ]);359.37167389765153``

## `math::sum`​

The `math::sum` function returns the total sum of a set of numbers.

``API DEFINITIONmath::sum(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::sum([ 26.164, 13.746189, 23, 16.4, 41.42 ]);120.730189``

## `math::top`​

The `math::top` function returns the top of an array of numbers.

``API DEFINITIONmath::top(array<number>, number) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::top([1, 40, 60, 10, 2, 901], 3);[ 40, 901, 60 ]``

## `math::trimean`​

The `math::trimean` function returns the trimean of an array of numbers.

``API DEFINITIONmath::trimean(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::trimean([ 1, 40, 60, 10, 2, 901 ]);27.25``

## `math::variance`​

The `math::variance` function returns the variance of an array of numbers.

``API DEFINITIONmath::variance(array<number>) -> number``

The following example shows this function, and its output, when used in a `RETURN` statement:

``RETURN math::variance([ 1, 40, 60, 10, 2, 901 ]);129148``