Mathematical functions and constants

This page describes the mathematical functions and constants that are available in Phonometrica. Functions that usually accept a Number, such as log(), can also work with arrays, in which case the operation is applied to each element in the array.

Global functions

abs(x)

Returns the absolute value of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


acos(x)

Returns the arccosine of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


asin(x)

Returns the arcsine of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


atan(x)

Returns the arctangent of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


atan2(y, x)

Returns the four-quadrant inverse tangent of y and x.


ceil(x)

Returns the smallest integer no smaller than x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


cos(x)

Returns the cosine of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


exp(x)

Returns the exponential of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


floor(x)

Returns the largest integer that is no larger than x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


log(x)

Returns the natural logarithm of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


log2(x)

Returns the logarithm of x in base 2. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


log10(x)

Returns the logarithm of x in base 10. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


max(x, y[, ...])

Returns the maximum value among the arguments passed to the function.


min(x, y[, ...])

Returns the minimum value among the arguments passed to the function.


pow(x, y)

Returns x raised to the power of y.


random()

Returns a pseudo-random value in the interval [0, 1[ according to a uniform distribution.


round(x)

Rounds x to the nearest integer. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


sin(x)

Returns the sine of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


sqrt(x)

Returns the square root of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.


tan(x)

Returns the tangent of x. If x is an array, the function returns a copy of the array in which the function has been applied to each element.

Constants

E

Returns the value of e, the base of the natural logarithm (approximately 2.718281).


PHI

Returns the value of the golden ratio \(\phi\) (approximately 1.618033).


PI

Returns the value of pi (approximately 3.141593).


SQRT2

Returns the square root of 2 (approximately 1.414214).