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 as Number)¶
Returns the absolute value of x.
- abs(x as Array)¶
Returns a copy of the array in which abs has been applied to each element.
- acos(x as Number)¶
Returns the arccosine of x.
- acos(x as Array)¶
Returns a copy of the array in which acos has been applied to each element.
- asin(x as Number)¶
Returns the arcsine of x.
- asin(x as Array)¶
Returns a copy of the array in which asin has been applied to each element.
- atan(x as Number)¶
Returns the arctangent of x.
- atan(x as Array)¶
Returns a copy of the array in which atn has been applied to each element.
- atan2(y as Number, x as Number)¶
Returns the four-quadrant inverse tangent of y and x.
- ceil(x as Number)¶
Returns the smallest integer no smaller than x.
- ceil(x as Array)¶
Returns a copy of the array in which ceil has been applied to each element.
- cos(x as Number)¶
Returns the cosine of x.
- cos(x as Array)¶
Returns a copy of the array in which cos has been applied to each element.
- exp(x as Number)¶
Returns the exponential of x.
- exp(x as Array)¶
Returns a copy of the array in which exp has been applied to each element.
- floor(x as Nubmer)¶
Returns the largest integer that is no larger than x.
- floor(x as Array)¶
Returns a copy of the array in which floor has been applied to each element.
- log(x as Number)¶
Returns the natural logarithm of x.
- log(x as Array)¶
Returns a copy of the array in which log has been applied to each element.
- log2(x as Number)¶
Returns the logarithm of x in base 2.
- log2(x as Array)¶
Returns a copy of the array in which log2 has been applied to each element.
- log10(x as Number)¶
Returns the logarithm of x in base 10.
- log10(x as Array)¶
Returns a copy of the array in which log10 has been applied to each element.
- max(x as Number, y as Number)¶
Returns the larger value between x and y.
- max(x as Integer, y as Integer)¶
Returns the larger value between x and y.
- min(x as Number, y as Number)¶
Returns the smaller value between x and y.
- min(x as Integer, y as Integer)¶
Returns the smaller value between x and y.
- random()¶
Returns a pseudo-random value in the interval [0, 1[ according to a uniform distribution.
- round(x as Number)¶
Rounds x to the nearest integer.
- round(x as Array)¶
Returns a copy of the array in which round has been applied to each element.
- sin(x as Number)¶
Returns the sine of x.
- sin(x as Array)¶
Returns a copy of the array in which sin has been applied to each element.
- sqrt(x as Number)¶
Returns the square root of x.
- sqrt(x as Array)¶
Returns a copy of the array in which sqrt has been applied to each element.
- tan(x as Number)¶
Returns the tangent of x.
- tan(x as Array)¶
Returns a copy of the array in which tan 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).