Learn how to use and combine different mathematical functions in APL
The table summarizes the mathematical functions available in APL.
Name | Description |
---|---|
abs | Calculates the absolute value of the input. |
acos | Returns the angle whose cosine is the specified number (the inverse operation of cos()). |
asin | Returns the angle whose sine is the specified number (the inverse operation of sin()). |
atan | Returns the angle whose tangent is the specified number (the inverse operation of tan()). |
atan2 | Calculates the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x). |
cos | Returns the cosine function. |
degrees | Converts angle value in radians into value in degrees, using formula degrees = (180 / PI) * angle-in-radians. |
exp | The base-e exponential function of x, which is e raised to the power x: e^x. |
exp10 | The base-10 exponential function of x, which is 10 raised to the power x: 10^x. |
exp2 | The base-2 exponential function of x, which is 2 raised to the power x: 2^x. |
gamma | Computes gamma function. |
isinf | Returns whether input is an infinite (positive or negative) value. |
isint | Returns whether input is an integer (positive or negative) value |
isnan | Returns whether input is Not-a-Number (NaN) value. |
log | Returns the natural logarithm function. |
log10 | Returns the common (base-10) logarithm function. |
log2 | Returns the base-2 logarithm function. |
loggamma | Computes log of absolute value of the gamma function. |
max_of | Returns the largest of the provided values. |
min_of | Returns the smallest of the provided values. |
not | Reverses the value of its bool argument. |
pi | Returns the constant value of Pi (π). |
pow | Returns a result of raising to power. |
radians | Converts angle value in degrees into value in radians, using formula radians = (PI / 180) * angle-in-degrees. |
round | Returns the rounded source to the specified precision. |
set_difference | Returns the difference between two arrays. |
set_has_element | Determines if a set contains a specific value. |
set_intersect | Returns the intersection of two arrays. |
set_union | Returns the union of two arrays. |
sign | Sign of a numeric expression. |
sin | Returns the sine function. |
sqrt | Returns the square root function. |
tan | Returns the tangent function. |
Calculates the absolute value of the input.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | int, real or timespan | Required | The value to make absolute |
Returns the angle whose cosine is the specified number (the inverse operation of cos()) .
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number in range [-1,. 1] |
null
if x
< -1 or x
> 1Returns the angle whose sine is the specified number (the inverse operation of sin()) .
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number in range [-1,. 1] |
Returns the angle whose tangent is the specified number (the inverse operation of tan()) .
x: A real number.
The value of the arc tangent of x
Calculates the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).
x: X coordinate (a real number). y: Y coordinate (a real number).
The angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x).
Returns the cosine function.
x: A real number.
The result of cos(x)
Converts angle value in radians into value in degrees, using formula degrees = (180 / PI ) * angle_in_radians
Name | Type | Required or Optional | Description |
---|---|---|---|
a | real | Required | Angle in radians. |
The corresponding angle in degrees for an angle specified in radians.
The base-e exponential function of x, which is e raised to the power x: e^x.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real number | Required | Value of the exponent. |
The base-2 exponential function of x, which is 2 raised to the power x: 2^x.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real number | Required | Value of the exponent. |
Computes gamma function
Returns whether input is an infinite (positive or negative) value.
x: A real number.
A non-zero value (true) if x is a positive or negative infinite; and zero (false) otherwise.
Returns whether input is Not-a-Number (NaN) value.
x: A real number.
A non-zero value (true) if x is NaN; and zero (false) otherwise.
log() returns the natural logarithm function.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number > 0. |
The natural logarithm is the base-e logarithm: the inverse of the natural exponential function (exp). null if the argument is negative or null or can’t be converted to a real value.
log10() returns the common (base-10) logarithm function.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number > 0. |
The common logarithm is the base-10 logarithm: the inverse of the exponential function (exp) with base 10. null if the argument is negative or null or can’t be converted to a real value.
log2() returns the base-2 logarithm function.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number > 0. |
The logarithm is the base-2 logarithm: the inverse of the exponential function (exp) with base 2. null if the argument is negative or null or can’t be converted to a real value.
Computes log of absolute value of the gamma function
x: Parameter for the gamma function
Reverses the value of its bool argument.
Name | Type | Required or Optional | Description |
---|---|---|---|
Expr | bool | Required | A bool expression to be reversed. |
Returns the reversed logical value of its bool argument.
Returns the constant value of Pi.
Returns a result of raising to power
Returns base raised to the power exponent: base ^ exponent.
Converts angle value in degrees into value in radians, using formula radians = (PI / 180 ) * angle_in_degrees
Name | Type | Required or Optional | Description |
---|---|---|---|
a | real | Required | Angle in degrees (a real number). |
The corresponding angle in radians for an angle specified in degrees.
Returns the rounded source to the specified precision.
The rounded source to the specified precision.
Sign of a numeric expression
Returns the sine function.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number. |
The result of sin(x)
Returns the square root function.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number >= 0. |
Returns the tangent function.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number. |
tan(x)
The base-10 exponential function of x, which is 10 raised to the power x: 10^x.
Name | Type | Required or Optional | Description |
---|---|---|---|
x | real | Required | A real number, value of the exponent. |
Returns whether input is an integer (positive or negative) value.
A non-zero value (true) if expression is a positive or negative integer; and zero (false) otherwise.
Returns whether input is a finite value (is neither infinite nor NaN).
A non-zero value (true) if x is finite; and zero (false) otherwise.