http://zorba.io/modules/math

View as XML or JSON.

Extensive math library.

Function Summary

acosh ($arg as double) as double external

Inverse hyperbolic cosine.

asinh ($arg as double) as double external

Calculate the inverse hyperbolic sine.

atanh ($arg as double) as double external

Calculate the hyperbolic tangent.

avedev ($numbers as double+) as double

Returns the average of the absolute deviations of data points from their mean.

cast-as-numeric ($number as anyAtomicType) as anyAtomicType

Cast the anyAtomicType to a numeric type.

ceiling ($number as double, $significance as double) as double

Returns number rounded up, away from zero, to the nearest multiple of significance.

cosh ($arg as double) as double external

Returns the hyperbolic cosine of x.

deg-to-rad ($deg as double) as double

Convert angle from degrees to radians.

even ($number as double) as integer

Returns number rounded up to the nearest even integer.

fact ($number as integer) as integer

Returns the factorial of a number.

factdouble ($number as integer) as integer

Returns the double factorial of a number.

floor ($number as double, $significance as double) as double

Rounds number down, toward zero, to the nearest multiple of significance.

fmod ($x as double, $y as double) as double external

Function performing the modulo operation between the two arguments.

frexp ($arg as double) as double+ external

Returns the argument split as mantissa and exponent.

gcd ($numbers as integer+) as integer

Returns the greatest common divisor GCD of a sequence of integers.

int ($number as double) as integer

Rounds a number down to the nearest integer.

is-a-number ($value as anyAtomicType) as boolean

Checks if the anyAtomicType argument is actually a numeric type or can be converted to numeric.

is_inf ($arg as double) as boolean external

Checks if the double value is positive or negative infinite.

is_nan ($arg as double) as boolean external

Checks if the double value is Not a Number (NaN).

large ($numbers as double+, $k as integer) as double

Returns the k-th largest value in a data set.

lcm ($numbers as integer+) as integer

Returns the least common multiple of integers.

ldexp ($x as double, $i as integer) as double external

Computes a real number from the mantissa and exponent.

median ($numbers as double*) as double

Returns the median of the given numbers.

mod ($number as double, $divisor as double) as double

Returns the remainder after number is divided by divisor.

mode ($numbers as double*) as double

Returns the most frequently occurring, or repetitive, value in a sequence.

modf ($arg as double) as double+ external

Splits a floating-point value into fractional and integer parts.

mround ($number as decimal, $multiple as double) as double

Returns a number rounded to the desired multiple.

odd ($number as double) as integer

Returns number rounded up to the nearest odd integer, away from zero.

percentile ($numbers as double*, $k_at as double) as double

Returns the k-th percentile of values in a sequence.

percentrank ($numbers as double*, $x as double) as double

Returns the rank of a value in a data set as a percentage of the data set.

prob ($x_range as double+, $prob_range as double+, $range_lower_limit as double) as double

This is the same as math:prob#4, only that upper_limit is not specified.

prob ($x_range as double+, $prob_range as double+, $range_lower_limit as double, $upper_limit as double) as double

Returns the probability that values in a range are between two limits.

product ($numbers as double*) as double

Multiplies all the numbers given as arguments and returns the product.

quartile ($numbers as double*, $quart as integer) as double

Returns the quartile of a data set.

quotient ($numerator as double, $denominator as double) as integer

Returns the integer portion of a division.

rad-to-deg ($rad as double) as double

Convert angle from radians to degrees.

rank ($x as double, $numbers as double*) as double

This RANK function is same as the above, only that $order_ascending is set by default to false.

rank ($x as double, $numbers as double*, $order_ascending as boolean) as double

Returns the rank of a number in a list of numbers.

roman ($number as integer) as string

Converts an Arabic numeral to roman, as text.

round ($number as double, $precision as integer) as double

Rounds a number to a specified number of digits.

rounddown ($number as double, $precision as integer) as double

Rounds a number down, toward zero.

roundup ($number as double, $precision as integer) as double

Rounds a number up, away from 0 (zero).

sign ($number as double) as integer

Determines the sign of a number.

sinh ($arg as double) as double external

Calculate the hyperbolic sine.

slope ($known_y as double+, $known_x as double+) as double

Returns the slope of the linear regression line through data points in known_y's and known_x's.

small ($numbers as double*, $k as integer) as double

This function computes the k-th smallest value in a data set.

sort-numbers ($numbers as double*) as double*

Sorts a sequence of numbers or arguments castable to numeric.

standardize ($x as double, $mean as double, $standard_dev as double) as double

Returns a normalized value from a distribution characterized by mean and standard_dev.

stdev ($numbers as double+) as double

Estimates standard deviation based on a sample.

stdeva ($numbers as double+) as double

Estimates standard deviation based on a sample.

stdevp ($numbers as double+) as double

Calculates standard deviation based on the entire population given as arguments.

stdevpa ($numbers as double+) as double

Calculates standard deviation based on the entire population given as arguments.

subtotal ($function_num as integer, $numbers as double*) as double

Returns a subtotal in a sequence of numbers.

sumproduct ($array1 as double*, $array2 as double*) as double

Multiplies the elements on the same position in each sequence and sums up the results.

sumsq ($numbers as double+) as double

Returns the sum of the squares of the arguments.

tanh ($arg as double) as double external

Calculate the hyperbolic tangent.

trunc ($number as double) as integer

Truncates a number to an integer by removing the fractional part of the number.

trunc ($number as double, $precision as integer) as double

Truncates a number down to precision.

var ($numbers as double+) as double

Estimates variance based on a sample.

vara ($numbers as double+) as double

Estimates variance based on a sample.

varp ($numbers as double+) as double

Calculates variance based on the entire population.

varpa ($numbers as double+) as double

Calculates variance based on the entire population.

Functions

acosh#1

declare  function math:acosh($arg as double) as double external
Inverse hyperbolic cosine.

Parameters

arg as double
the arg

Returns

double
the result of acosh(arg)

asinh#1

declare  function math:asinh($arg as double) as double external
Calculate the inverse hyperbolic sine.

Parameters

arg as double
the arg

Returns

double
the result of asinh(arg)

atanh#1

declare  function math:atanh($arg as double) as double external
Calculate the hyperbolic tangent.

Parameters

arg as double
must be in range -1 ... +1 (exclusive)

Returns

double
the result of atanh(arg)

avedev#1

declare  function math:avedev($numbers as double+) as double
Returns the average of the absolute deviations of data points from their mean.

The formula is sum(abs(x - average_x))/n, where n is the count of x in the sequence.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. Sequence can be of any length from 1 up.

Returns

double
The formula result

cast-as-numeric#1

declare  function math:cast-as-numeric($number as anyAtomicType) as anyAtomicType
Cast the anyAtomicType to a numeric type.

If the value is already of a numeric type then nothing is changed. Otherwise the value is casted to the numeric type that is most appropriate.

Borrowed from excel module.

Parameters

number as anyAtomicType
The parameter can be a number, string, boolean value.

Returns

anyAtomicType
The casted value.

ceiling#2

declare  function math:ceiling($number as double, $significance as double) as double
Returns number rounded up, away from zero, to the nearest multiple of significance.

Significance must have the same sign as number. Number and significance must be of a numeric type or castable to numeric. Significance must not be zero.

Borrowed from excel module.

Parameters

number as double
The value you want to round.
significance as double
The multiple to which you want to round.

Returns

double
The rounded value.

cosh#1

declare  function math:cosh($arg as double) as double external
Returns the hyperbolic cosine of x.

If the result it too large, INF is returned.

Parameters

arg as double
must be smaller than 7.104760e+002

Returns

double
cosh(arg)

deg-to-rad#1

declare  function math:deg-to-rad($deg as double) as double
Convert angle from degrees to radians.

The parameter is first converted to value range of (-360, 360).

Parameters

deg as double
angle in degrees

Returns

double
value in radians (-2PI, 2PI)

even#1

declare  function math:even($number as double) as integer
Returns number rounded up to the nearest even integer.

Regardless of the sign of number, a value is rounded up when adjusted away from zero.

Borrowed from excel module.

Parameters

number as double
The value to round.

Returns

integer
The rounded value casted as numeric type.

fact#1

declare  function math:fact($number as integer) as integer
Returns the factorial of a number.

Borrowed from excel module.

Parameters

number as integer
The non-negative number you want the factorial of.

Returns

integer
Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.

factdouble#1

declare  function math:factdouble($number as integer) as integer
Returns the double factorial of a number.

Computes the double factorial of n as n(n-2)(n-4)...

Borrowed from excel module.

Parameters

number as integer
The positive integer value.

Returns

integer
The result as integer.

floor#2

declare  function math:floor($number as double, $significance as double) as double
Rounds number down, toward zero, to the nearest multiple of significance.

Significance must have the same sign as number. Borrowed from excel module.

Parameters

number as double
The value you want to round.
significance as double
The multiple to which you want to round.

Returns

double
The rounded value as numeric type.

fmod#2

declare  function math:fmod($x as double, $y as double) as double external
Function performing the modulo operation between the two arguments.

Parameters

x as double
the x
y as double
the y

Returns

double
The remainder of x/y.

frexp#1

declare  function math:frexp($arg as double) as double+ external
Returns the argument split as mantissa and exponent.

The recombining formula is (mantissa * 2^exponent).

Parameters

arg as double
the double to be split.

Returns

double+
A sequence of two doubles (mantissa, exponent)

gcd#1

declare  function math:gcd($numbers as integer+) as integer
Returns the greatest common divisor GCD of a sequence of integers.

The sequence can have one or more positive integers.

Borrowed from excel module.

Parameters

numbers as integer
The sequence of positive integers.

Returns

integer
The GCD as integer.

int#1

declare  function math:int($number as double) as integer
Rounds a number down to the nearest integer.

Positive numbers are rounded toward zero, negative numbers are rounded away from zero.

Borrowed from excel module.

Parameters

number as double
The value to be rounded.

Returns

integer
The rounded integer.

is-a-number#1

declare  function math:is-a-number($value as anyAtomicType) as boolean
Checks if the anyAtomicType argument is actually a numeric type or can be converted to numeric.

Borrowed from excel module.

Parameters

value as anyAtomicType
Parameter to be checked.

Returns

boolean
true if the value can be casted to numeric.

is_inf#1

declare  function math:is_inf($arg as double) as boolean external
Checks if the double value is positive or negative infinite.

Parameters

arg as double
the double to be checked

Returns

boolean
boolean true if argument is pos INF or neg INF

is_nan#1

declare  function math:is_nan($arg as double) as boolean external
Checks if the double value is Not a Number (NaN).

Parameters

arg as double
the arg

Returns

boolean
boolean true if the double is NaN

large#2

declare  function math:large($numbers as double+, $k as integer) as double
Returns the k-th largest value in a data set.

If n is the number of data points in a range, then LARGE(array,1) returns the largest value, and LARGE(array,n) returns the smallest value.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers The sequence can be of any length, from 1 up.
k as integer
the position of largest value, with value from 1 to count of values

Returns

double
The k-th largest value as numeric type

lcm#1

declare  function math:lcm($numbers as integer+) as integer
Returns the least common multiple of integers.

LCM for two numbers is computed by multiplying them and dividing with GCD. The function is applied recursively replacing the first two numbers in the sequence with their LCM.

Borrowed from excel module.

Parameters

numbers as integer
The sequence of one or more positive integers.

Returns

integer
The LCM as integer.

ldexp#2

declare  function math:ldexp($x as double, $i as integer) as double external
Computes a real number from the mantissa and exponent.

The formula is (x * 2^i).

Parameters

x as double
the mantissa
i as integer
the exponent

Returns

double
the computed real number

median#1

declare  function math:median($numbers as double*) as double
Returns the median of the given numbers.

The median is the number in the middle of a set of numbers. Half the numbers have values that are greater than the median, and half the numbers have values that are less than the median.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers, of any length

Returns

double
for odd count of numbers return the number in the middle of the sorted sequence. For even count of numbers return the average of the two numbers in the middle.

mod#2

declare  function math:mod($number as double, $divisor as double) as double
Returns the remainder after number is divided by divisor.

The result has the same sign as divisor.

Borrowed from excel module.

Parameters

number as double
The number for which you want to find the remainder.
divisor as double
The number by which you want to divide number. This cannot be zero.

Returns

double
The remainder from division as numeric type.

mode#1

declare  function math:mode($numbers as double*) as double
Returns the most frequently occurring, or repetitive, value in a sequence.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers, of any length

Returns

double
The most occuring number

modf#1

declare  function math:modf($arg as double) as double+ external
Splits a floating-point value into fractional and integer parts.

Both the fraction and integer keep the original sign of the value.

Parameters

arg as double
the double to be split.

Returns

double+
A sequence of two doubles (fraction, integer)

mround#2

declare  function math:mround($number as decimal, $multiple as double) as double
Returns a number rounded to the desired multiple.

MROUND rounds up, away from zero, if the remainder of dividing number by multiple is greater than or equal to half the value of multiple. MROUND is computed through math:floor function.

Borrowed from excel module.

Parameters

number as decimal
The value to round,
multiple as double
The multiple to which you want to round number.

Returns

double
The rounded number up to the desired multiple.

odd#1

declare  function math:odd($number as double) as integer
Returns number rounded up to the nearest odd integer, away from zero.

Borrowed from excel module.

Parameters

number as double
The value to round.

Returns

integer
The odd integer.

percentile#2

declare  function math:percentile($numbers as double*, $k_at as double) as double
Returns the k-th percentile of values in a sequence.

If k is not a multiple of 1/(n - 1), PERCENTILE interpolates to determine the value at the k-th percentile. The function is computed by (max-min)*k + min

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers, of any length
k_at as double
the percentile, with value between 0 .. 1 inclusive

Returns

double
The computed percentile

percentrank#2

declare  function math:percentrank($numbers as double*, $x as double) as double
Returns the rank of a value in a data set as a percentage of the data set.

If x does not match one of the values in array, PERCENTRANK interpolates to return the correct percentage rank.
The formula is uses: (RANK - 1) / (size - 1) .

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. The sequence can be of any length, from 1 up.
x as double
is the value for which you want to know the rank

Returns

double
The percentage of rank.

prob#3

declare  function math:prob($x_range as double+, $prob_range as double+, $range_lower_limit as double) as double
This is the same as math:prob#4, only that upper_limit is not specified.

The probability is computed only for range_lower_limit.

Borrowed from excel module.

Parameters

x_range as double
is the range of numeric values of x with which there are associated probabilities. This does not need to be ordered.
prob_range as double
is a set of probabilities associated with values in x_range.
range_lower_limit as double
is the value for which you want a probability.

Returns

double
The probability of the range_lower_limit value

prob#4

declare  function math:prob($x_range as double+, $prob_range as double+, $range_lower_limit as double, $upper_limit as double) as double
Returns the probability that values in a range are between two limits.

Borrowed from excel module.

Parameters

x_range as double
is the range of numeric values of x with which there are associated probabilities. This does not need to be ordered.
prob_range as double
is a set of probabilities associated with values in x_range.
range_lower_limit as double
is the lower bound on the value for which you want a probability.
upper_limit as double
is the upper bound on the value for which you want a probability.

Returns

double
The probability of the entire range

product#1

declare  function math:product($numbers as double*) as double
Multiplies all the numbers given as arguments and returns the product.

Borrowed from excel module.

Parameters

numbers as double
The sequence of arguments convertible to numeric types. The sequence can be of any length.

Returns

double
The multiplication result as numeric type.

quartile#2

declare  function math:quartile($numbers as double*, $quart as integer) as double
Returns the quartile of a data set.

Borrowed from excel module.

Parameters

numbers as double
sequence of numbers. The sequence can be of any length, from 1 up.
quart as integer
one of the values 0, 1, 2, 3, 4 with meaning:
0
compute minimum value
1
compute first quartile (25th percentile)
2
compute median value (50th percentile)
3
compute third quartile (75th percentile)
4
compute maximum value

Returns

double
the computed quartile, as numeric type

quotient#2

declare  function math:quotient($numerator as double, $denominator as double) as integer
Returns the integer portion of a division.

Borrowed from excel module.

Parameters

numerator as double
The divider.
denominator as double
The divisor. It cannot be zero.

Returns

integer
The result value as numeric type.

rad-to-deg#1

declare  function math:rad-to-deg($rad as double) as double
Convert angle from radians to degrees.

Parameters

rad as double
value in radians

Returns

double
value in degrees (-360, 360)

rank#2

declare  function math:rank($x as double, $numbers as double*) as double
This RANK function is same as the above, only that $order_ascending is set by default to false.

Borrowed from excel module.

Parameters

x as double
The number whose rank you want to find.
numbers as double
the sequence of numbers. The sequence can be of any length.

Returns

double
The rank of $x.

rank#3

declare  function math:rank($x as double, $numbers as double*, $order_ascending as boolean) as double
Returns the rank of a number in a list of numbers.

The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.) RANK gives duplicate numbers the same rank.

Borrowed from excel module.

Parameters

x as double
The number whose rank you want to find.
numbers as double
The sequence of numbers. The sequence can be of any length.
order_ascending as boolean
A boolean having the meaning:
false
then rank the number as if the sequence was sorted in descending order.
true
then rank the number as if the sequence was sorted in ascending order.

Returns

double
The rank of $x.

roman#1

declare  function math:roman($number as integer) as string
Converts an Arabic numeral to roman, as text.

Only the classic format is supported (out of all formats Excel requires). M is the largest digit, it represents 1000. Numbers bigger than 2000 will be represented by a sequence of "M". D = 500, C = 100, L = 50, X = 10, V = 5, I = 1.

Borrowed from excel module.

Parameters

number as integer
A positive integer.

Returns

string
The roman string representation.

round#2

declare  function math:round($number as double, $precision as integer) as double
Rounds a number to a specified number of digits.

If precision is greater than 0 (zero), then number is rounded to the specified number of decimal places. If num_digits is 0, then number is rounded to the nearest integer. If num_digits is less than 0, then number is rounded to the left of the decimal point. The 0.5 is rounded away from zero.

Borrowed from excel module.

Parameters

number as double
The number to round.
precision as integer
The number of decimal places to keep.

Returns

double
The rounded number as numeric type.

rounddown#2

declare  function math:rounddown($number as double, $precision as integer) as double
Rounds a number down, toward zero.

If num_digits is greater than 0 (zero), then number is rounded down to the specified number of decimal places. If num_digits is 0, then number is rounded down to the nearest integer. If num_digits is less than 0, then number is rounded down to the left of the decimal point.

Borrowed from excel module.

Parameters

number as double
The number to round
precision as integer
The number of decimal places to keep.

Returns

double
the truncated number toward zero, as numeric type.

roundup#2

declare  function math:roundup($number as double, $precision as integer) as double
Rounds a number up, away from 0 (zero).

If num_digits is greater than 0 (zero), then number is rounded down to the specified number of decimal places. If num_digits is 0, then number is rounded down to the nearest integer. If num_digits is less than 0, then number is rounded down to the left of the decimal point.

Borrowed from excel module.

Parameters

number as double
The number to round
precision as integer
The number of decimal places to keep.

Returns

double
The truncated number away from zero, as numeric type.

sign#1

declare  function math:sign($number as double) as integer
Determines the sign of a number.

Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.

Borrowed from excel module.

Parameters

number as double
The argument

Returns

integer
The sign as (-1, 0, 1).

sinh#1

declare  function math:sinh($arg as double) as double external
Calculate the hyperbolic sine.

Parameters

arg as double
the arg

Returns

double
the result of sinh(arg)

slope#2

declare  function math:slope($known_y as double+, $known_x as double+) as double
Returns the slope of the linear regression line through data points in known_y's and known_x's.

The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line. It computes the formula:

sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)

where average_x and average_y are computed with AVERAGE function.

Borrowed from excel module.

Parameters

known_y as double
the sequence of y numbers. The sequence can be of any length, from 1 up.
known_x as double
the sequence of x numbers. The sequence can be of any length, from 1 up.

Returns

double
The slope value, as numeric type

small#2

declare  function math:small($numbers as double*, $k as integer) as double
This function computes the k-th smallest value in a data set.

Use this function to return values with a particular relative standing in a data set. If n is the number of data points in array, SMALL(array,1) equals the smallest value, and SMALL(array,n) equals the largest value. Borrowed from excel module.

Parameters

numbers as double
A sequence of numbers. The sequence can be of any length, from 1 up.
k as integer
The position (from the smallest) in the sequence of data to return. Must have value between 1 and size of sequence.

Returns

double
The k-th smallest value of $numbers.

sort-numbers#1

declare  function math:sort-numbers($numbers as double*) as double*
Sorts a sequence of numbers or arguments castable to numeric.

It first casts all arguments to numeric and then sorts ascending.

Helper function.
Borrowed from excel module.

Parameters

numbers as double
The sequence of arguments castable to numeric.

Returns

double*
The sorted sequence as numeric types.

standardize#3

declare  function math:standardize($x as double, $mean as double, $standard_dev as double) as double
Returns a normalized value from a distribution characterized by mean and standard_dev.

The formula is (x - mean) / standard_dev .

Borrowed from excel module.

Parameters

x as double
is the value you want to normalize
mean as double
is the arithmetic mean of the distribution.
standard_dev as double
is the standard deviation of the distribution.

Returns

double
The normalized x, as numeric type

stdev#1

declare  function math:stdev($numbers as double+) as double
Estimates standard deviation based on a sample.

The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VAR(numbers) )

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers The sequence can be of any length, from 1 up.

Returns

double
the standard deviation, as numeric type

stdeva#1

declare  function math:stdeva($numbers as double+) as double
Estimates standard deviation based on a sample.

The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VARA(numbers) )

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. The sequence can be of any length, from 1 up.

Returns

double
the standard deviation, as numeric type

stdevp#1

declare  function math:stdevp($numbers as double+) as double
Calculates standard deviation based on the entire population given as arguments.

The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARP(numbers) )

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.

Returns

double
the standard deviation, as numeric type

stdevpa#1

declare  function math:stdevpa($numbers as double+) as double
Calculates standard deviation based on the entire population given as arguments.

The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARPA(numbers) )

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.

Returns

double
the standard deviation, as numeric type

subtotal#2

declare  function math:subtotal($function_num as integer, $numbers as double*) as double
Returns a subtotal in a sequence of numbers.

The function applied is given by $function_num.

Borrowed from excel module.

Parameters

function_num as integer
defines the function to be applied on sequence values. The possible values are:
1 or 101
AVERAGE
2 or 102
COUNT
3 or 103
COUNTA
4 or 104
MAX
5 or 105
MIN
6 or 106
PRODUCT
7 or 107
STDEV
8 or 108
STDEVP
9 or 109
SUM
10 or 110
VAR
11 or 111
VARP
In this implementation there is no difference between x and 10x.
numbers as double
the sequence of numbers. The sequence can be of any length.

Returns

double
The function result, as numeric type

sumproduct#2

declare  function math:sumproduct($array1 as double*, $array2 as double*) as double
Multiplies the elements on the same position in each sequence and sums up the results.

Borrowed from excel module.

Parameters

array1 as double
the sequences of numbers
array2 as double
the sequences of numbers

Returns

double
the sum of products

sumsq#1

declare  function math:sumsq($numbers as double+) as double
Returns the sum of the squares of the arguments.

It uses the sumproduct function.

Borrowed from excel module.

Parameters

numbers as double
the sequence of one or more numbers

Returns

double
the sum of squared values, as numeric type

tanh#1

declare  function math:tanh($arg as double) as double external
Calculate the hyperbolic tangent.

Parameters

arg as double
the arg

Returns

double
the result of tanh(arg)

trunc#1

declare  function math:trunc($number as double) as integer
Truncates a number to an integer by removing the fractional part of the number.

Borrowed from excel module.

Parameters

number as double
The argument .

Returns

integer
The integer value.

trunc#2

declare  function math:trunc($number as double, $precision as integer) as double
Truncates a number down to precision.

This behaves exactly like rounddown.

Borrowed from excel module.

Parameters

number as double
The argument castable to numeric type.
precision as integer
The number of decimal places to keep .

Returns

double
The integer value.

var#1

declare  function math:var($numbers as double+) as double
Estimates variance based on a sample.

The formula is sum(x - average_x)^2 / (n - 1). average_x is computed with AVERAGE function. n is the count of numbers from the sequence, excluding empty values.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. The sequence can be of any length, from 1 up.

Returns

double
The variance, as numeric type

vara#1

declare  function math:vara($numbers as double+) as double
Estimates variance based on a sample.

The formula is sum(x - average_x)^2 / (n - 1). average_x is computed with AVERAGE function. n is the size of sequence, including empty values.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. The sequence can be of any length, from 1 up.

Returns

double
The variance, as numeric type

varp#1

declare  function math:varp($numbers as double+) as double
Calculates variance based on the entire population.

The formula is sum(x - average_x)^2 / n. average_x is computed with AVERAGE function. n is the count of numbers from the sequence, excluding empty values.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. The sequence can be of any length, from 1 up.

Returns

double
The variance, as numeric type

varpa#1

declare  function math:varpa($numbers as double+) as double
Calculates variance based on the entire population.

The formula is sum(x - average_x)^2 / n. average_x is computed with AVERAGE function. n is the size of sequence, including empty values.

Borrowed from excel module.

Parameters

numbers as double
the sequence of numbers. The sequence can be of any length, from 1 up.

Returns

double
The variance, as numeric type