datatable.math

Trigonometric functions

sin(x)

Compute \(\sin x\) (the trigonometric sine of x).

cos(x)

Compute \(\cos x\) (the trigonometric cosine of x).

tan(x)

Compute \(\tan x\) (the trigonometric tangent of x).

arcsin(x)

Compute \(\sin^{-1} x\) (the inverse sine of x).

arccos(x)

Compute \(\cos^{-1} x\) (the inverse cosine of x).

arctan(x)

Compute \(\tan^{-1} x\) (the inverse tangent of x).

atan2(x, y)

Compute \(\tan^{-1} (x/y)\).

hypot(x, y)

Compute \(\sqrt{x^2 + y^2}\).

deg2rad(x)

Convert an angle measured in degrees into radians.

rad2deg(x)

Convert an angle measured in radians into degrees.

Hyperbolic functions

sinh(x)

Compute \(\sinh x\) (the hyperbolic sine of x).

cosh(x)

Compute \(\cosh x\) (the hyperbolic cosine of x).

tanh(x)

Compute \(\tanh x\) (the hyperbolic tangent of x).

arsinh(x)

Compute \(\sinh^{-1} x\) (the inverse hyperbolic sine of x).

arcosh(x)

Compute \(\cosh^{-1} x\) (the inverse hyperbolic cosine of x).

artanh(x)

Compute \(\tanh^{-1} x\) (the inverse hyperbolic tangent of x).

Exponential/logarithmic functions

exp(x)

Compute \(e^x\) (the exponent of x).

exp2(x)

Compute \(2^x\).

expm1(x)

Compute \(e^x - 1\).

log(x)

Compute \(\ln x\) (the natural logarithm of x).

log10(x)

Compute \(\log_{10} x\) (the decimal logarithm of x).

log1p(x)

Compute \(\ln(1 + x)\).

log2(x)

Compute \(\log_{2} x\) (the binary logarithm of x).

logaddexp(x)

Compute \(\ln(e^x + e^y)\).

logaddexp2(x)

Compute \(\log_2(2^x + 2^y)\).

cbrt(x)

Compute \(\sqrt[3]{x}\) (the cubic root of x).

pow(x, a)

Compute \(x^a\).

sqrt(x)

Compute \(\sqrt{x}\) (the square root of x).

square(x)

Compute \(x^2\) (the square of x).

Special mathemetical functions

erf(x)

The error function \(\operatorname{erf}(x)\).

erfc(x)

The complimentary error function \(1 - \operatorname{erf}(x)\).

gamma(x)

Euler gamma function of x.

lgamma(x)

Natual logarithm of the Euler gamma function of.

Floating-point functions

abs(x)

Absolute value of x.

ceil(x)

The smallest integer not less than x.

copysign(x, y)

Number with the magnitude of x and the sign of y.

fabs(x)

The absolute value of x, returned as a float.

floor(x)

The largest integer not greater than x.

fmod(x, y)

Remainder of a floating-point division x/y.

isclose(x, y)

Check whether x y (up to some tolerance level).

isfinite(x)

Check if x is finite.

isinf(x)

Check if x is a positive or negative infinity.

isna(x)

Check if x is a valid (not-NaN) value.

ldexp(x, y)

Compute \(x\cdot 2^y\).

rint(x)

Round x to the nearest integer.

sign(x)

The sign of x, as a floating-point value.

signbit(x)

The sign of x, as a boolean value.

trunc(x)

The value of x truncated towards zero.

Mathematical constants

e

Euler’s constant \(e\).

golden

Golden ratio \(\varphi\).

inf

Positive infinity.

nan

Not-a-number.

pi

Mathematical constant \(\pi\).

tau

Mathematical constant \(\tau\).

Comparison table

The set of functions provided by the datatable.math module is very similar to the standard Python’s math module, or numpy math functions. Below is the comparison table showing which functions are available:

math

numpy

datatable

Trigonometric/hyperbolic functions

sin(x)

sin(x)

sin(x)

cos(x)

cos(x)

cos(x)

tan(x)

tan(x)

tan(x)

asin(x)

arcsin(x)

arcsin(x)

acos(x)

arccos(x)

arccos(x)

atan(x)

arctan(x)

arctan(x)

atan2(y, x)

arctan2(y, x)

atan2(y, x)

sinh(x)

sinh(x)

sinh(x)

cosh(x)

cosh(x)

cosh(x)

tanh(x)

tanh(x)

tanh(x)

asinh(x)

arcsinh(x)

arsinh(x)

acosh(x)

arccosh(x)

arcosh(x)

atanh(x)

arctanh(x)

artanh(x)

hypot(x, y)

hypot(x, y)

hypot(x, y)

radians(x)

deg2rad(x)

deg2rad(x)

degrees(x)

rad2deg(x)

rad2deg(x)

Exponential/logarithmic/power functions

exp(x)

exp(x)

exp(x)

exp2(x)

exp2(x)

expm1(x)

expm1(x)

expm1(x)

log(x)

log(x)

log(x)

log10(x)

log10(x)

log10(x)

log1p(x)

log1p(x)

log1p(x)

log2(x)

log2(x)

log2(x)

logaddexp(x, y)

logaddexp(x, y)

logaddexp2(x, y)

logaddexp2(x, y)

cbrt(x)

cbrt(x)

pow(x, a)

power(x, a)

pow(x, a)

sqrt(x)

sqrt(x)

sqrt(x)

square(x)

square(x)

Special mathematical functions

erf(x)

erf(x)

erfc(x)

erfc(x)

gamma(x)

gamma(x)

heaviside(x)

i0(x)

lgamma(x)

lgamma(x)

sinc(x)

Floating-point functions

abs(x)

abs(x)

abs(x)

ceil(x)

ceil(x)

ceil(x)

copysign(x, y)

copysign(x, y)

copysign(x, y)

fabs(x)

fabs(x)

fabs(x)

floor(x)

floor(x)

floor(x)

fmod(x, y)

fmod(x, y)

fmod(x)

frexp(x)

frexp(x)

isclose(x, y)

isclose(x, y)

isclose(x, y)

isfinite(x)

isfinite(x)

isfinite(x)

isinf(x)

isinf(x)

isinf(x)

isnan(x)

isnan(x)

isna(x)

ldexp(x, n)

ldexp(x, n)

ldexp(x, n)

modf(x)

modf(x)

nextafter(x, y)

rint(x)

rint(x)

round(x)

round(x)

round(x)

sign(x)

sign(x)

signbit(x)

signbit(x)

spacing(x)

trunc(x)

trunc(x)

trunc(x)

Miscellaneous

clip(x, a, b)

comb(n, k)

divmod(x, y)

factorial(n)

gcd(a, b)

gcd(a, b)

maximum(x, y)

minimum(x, y)

Mathematical constants

e

e

e

golden

inf

inf

inf

nan

nan

nan

pi

pi

pi

tau

tau