Special Functions
Base (i.e., lower-level) special math functions.
Usage
var special = require( '@stdlib/math/base/special' );
special
Namespace for "base" (i.e., lower-level) special math functions.
var fcns = special;
// returns {...}
Exponential & Logarithmic Functions
exp( x )
: natural exponential function.exp10( x )
: base10
exponential function.exp2( x )
: base2
exponential function.expit( x )
: compute the standard logistic function.expm1( x )
: computeexp(x) - 1
.expm1rel( x )
: compute the relative error exponential.kernelLog1p( f )
: computelog(1+f) - f
for1+f
in~[sqrt(2)/2, sqrt(2)]
.ln( x )
: evaluate the natural logarithm of a double-precision floating-point number.log( x, b )
: compute the baseb
logarithm of a double-precision floating-point number.log10( x )
: evaluate the common logarithm.log1mexp( x )
: evaluates the natural logarithm of1-exp(-|x|)
.log1p( x )
: evaluate the natural logarithm of1+x
.log1pexp( x )
: evaluates the natural logarithm of1+exp(x)
.log1pmx( x )
: evaluateln(1+x) - x
.log2( x )
: evaluate the binary logarithm.logaddexp( x, y )
: evaluates the natural logarithm ofexp(x) + exp(y)
.pow( base, exponent )
: exponential function.powm1( b, x )
: evaluatebˣ - 1
.xlog1py( x, y )
: computex * ln(y+1)
so that the result is0
ifx = 0
.xlogy( x, y )
: computex * ln(y)
so that the result is0
ifx = 0
.
Trigonometric Functions
acos( x )
: compute the arccosine of a double-precision floating-point number.acosd( x )
: compute the arccosine in degrees of a double-precision floating-point number.acosf( x )
: compute the arccosine of a single-precision floating-point number.acosh( x )
: compute the hyperbolic arccosine of a double-precision floating-point number.acovercos( x )
: compute the inverse coversed cosine.acoversin( x )
: compute the inverse coversed sine.ahavercos( x )
: compute the inverse half-value versed cosine.ahaversin( x )
: compute the inverse half-value versed sine.asin( x )
: compute the arcsine of a double-precision floating-point number.asind( x )
: compute the arcsine (in degrees) of a double-precision floating-point number.asindf( x )
: compute the arcsine (in degrees) of a single-precision floating-point number.asinf( x )
: compute the arcsine of a single-precision floating-point number.asinh( x )
: compute the hyperbolic arcsine of a double-precision floating-point number.atan( x )
: compute the arctangent of a double-precision floating-point number.atan2( y, x )
: compute the angle in the plane (in radians) between the positive x-axis and the ray from(0,0)
to the point(x,y)
.atand( x )
: compute the arctangent in degrees of a double-precision floating-point number.atanf( x )
: compute the arctangent of a single-precision floating-point number.atanh( x )
: compute the hyperbolic arctangent of a double-precision floating-point number.avercos( x )
: compute the inverse versed cosine.aversin( x )
: compute the inverse versed sine.cos( x )
: compute the cosine of a number.cosd( x )
: computes the cosine of an angle measured in degrees.cosh( x )
: compute the hyperbolic cosine of a double-precision floating-point number.cosm1( x )
: computecos(x) - 1
.cospi( x )
: compute the cosine of a number times π.covercos( x )
: compute the coversed cosine.coversin( x )
: compute the coversed sine.hacovercos( x )
: compute the half-value coversed cosine.hacoversin( x )
: compute the half-value coversed sine.havercos( x )
: compute the half-value versed cosine.haversin( x )
: compute the half-value versed sine.risingFactorial( x, n )
: compute the rising factorial.sin( x )
: compute the sine of a number.sinc( x )
: compute the cardinal sine of a number.sincos( x )
: simultaneously compute the sine and cosine of a number.sincospi()
: simultaneously compute the sine and cosine of a number times π.sinh( x )
: compute the hyperbolic sine of a double-precision floating-point number.sinpi( x )
: compute the sine of a number times π.tan( x )
: evaluate the tangent of a number.tand( x )
: computes the tangent of an angle measured in degrees.tanh( x )
: compute the hyperbolic tangent of a double-precision floating-point number.vercos( x )
: compute the versed cosine.versin( x )
: compute the versed sine.
Bessel Functions
besselj0( x )
: compute the Bessel function of the first kind of order zero.besselj1( x )
: compute the Bessel function of the first kind of order one.bessely0( x )
: compute the Bessel function of the second kind of order zero.bessely1( x )
: compute the Bessel function of the second kind of order one.
Absolute Value and Rounding Functions
abs( x )
: compute the absolute value of a double-precision floating-point number.abs2( x )
: compute the squared absolute value of a double-precision floating-point number.abs2f( x )
: compute the squared absolute value of a single-precision floating-point number.absf( x )
: compute the absolute value of a single-precision floating-point number.cabs( z )
: compute the absolute value of a double-precision complex floating-point number.cabs2( z )
: compute the squared absolute value of a double-precision complex floating-point number.cabs2f( z )
: compute the squared absolute value of a single-precision complex floating-point number.cabsf( z )
: compute the absolute value of a single-precision complex floating-point number.cceil( z )
: round a double-precision complex floating-point number toward positive infinity.cceilf( z )
: round a single-precision complex floating-point number toward positive infinity.cceiln( z, n )
: round each component of a double-precision complex floating-point number to the nearest multiple of10^n
toward positive infinity.ceil( x )
: round a double-precision floating-point number toward positive infinity.ceil10( x )
: round a numeric value to the nearest power of 10 toward positive infinity.ceil2( x )
: round a numeric value to the nearest power of two toward positive infinity.ceilb( x, n, b )
: round a numeric value to the nearest multiple of b^n toward positive infinity.ceilf( x )
: round a single-precision floating-point number toward positive infinity.ceiln( x, n )
: round a numeric value to the nearest multiple of 10^n toward positive infinity.ceilsd( x, n, b )
: round a numeric value to the nearest number toward positive infinity with N significant figures.cfloor( z )
: round a double-precision complex floating-point number toward negative infinity.cfloorn( z, n )
: round each component of a double-precision complex floating-point number to the nearest multiple of10^n
toward negative infinity.clamp( v, min, max )
: restrict a double-precision floating-point number to a specified range.clampf( v, min, max )
: restrict a single-precision floating-point number to a specified range.cround( z )
: round each component of a double-precision complex floating-point number to the nearest integer.croundn( z, n )
: round each component of a double-precision complex floating-point number to the nearest multiple of10^n
.csignum( z )
: evaluate the signum function of a double-precision complex floating-point number.floor( x )
: round a double-precision floating-point number toward negative infinity.floor10( x )
: round a numeric value to the nearest power of 10 toward negative infinity.floor2( x )
: round a numeric value to the nearest power of two toward negative infinity.floorb( x, n, b )
: round a numeric value to the nearest multiple of b^n toward negative infinity.floorf( x )
: round a single-precision floating-point numeric value toward negative infinity.floorn( x, n )
: round a double-precision floating-point number to the nearest multiple of 10^n toward negative infinity.floorsd( x, n, b )
: round a numeric value to the nearest number toward negative infinity with N significant figures.labs( x )
: compute an absolute value of a signed 32-bit integer.maxabs( x, y )
: return the maximum absolute value.maxabsn( [x[, y[, ...args]]] )
: return the maximum absolute value.minabs( x, y )
: return the minimum absolute value.minabsn( [x[, y[, ...args]]] )
: return the minimum absolute value.minmaxabs( x, y )
: return the minimum and maximum absolute values.minmaxabsn( [x[, y[, ...args]]] )
: return the minimum and maximum absolute values.round( x )
: round a numeric value to the nearest integer.round10( x )
: round a numeric value to the nearest power of 10 on a linear scale.round2( x )
: round a numeric value to the nearest power of two on a linear scale.roundb( x, n, b )
: round a numeric value to the nearest multiple of b^n on a linear scale.roundn( x, n )
: round a double-precision floating-point number to the nearest multiple of 10^n.roundsd( x, n[, b] )
: round a numeric value to the nearest number withn
significant figures.signum( x )
: signum function.signumf( x )
: signum function.trunc( x )
: round a double-precision floating-point number toward zero.trunc10( x )
: round a numeric value to the nearest power of 10 toward zero.trunc2( x )
: round a numeric value to the nearest power of two toward zero.truncb( x, n, b )
: round a numeric value to the nearest multiple of b^n toward zero.truncf( x )
: round a single-precision floating-point number toward zero.truncn( x, n )
: round a numeric value to the nearest multiple of 10^n toward zero.truncsd( x, n, b )
: round a numeric value to the nearest number toward zero withn
significant figures.
Other Special Functions
acot( x )
: compute the inverse cotangent of a double-precision floating-point number.acotd( x )
: compute the arccotangent in degrees of a double-precision floating-point number.acotf( x )
: compute the inverse cotangent of a single-precision floating-point number.acoth( x )
: compute the inverse hyperbolic cotangent of a double-precision floating-point number.acsc( x )
: compute the arccosecant of a number.acscd( x )
: compute the arccosecant in degrees of a double-precision floating-point number.acscdf( x )
: compute the arccosecant (in degrees) of a single-precision floating-point number.acscf( x )
: compute the arccosecant of a single-precision floating-point number.acsch( x )
: compute the hyperbolic arccosecant of a number.asec( x )
: compute the inverse (arc) secant of a number.asecd( x )
: compute the arcsecant (in degrees) of a double-precision floating-point number.asecdf( x )
: compute the arcsecant (in degrees) of a single-precision floating-point number.asecf( x )
: compute the inverse (arc) secant of a single-precision floating-point number.asech( x )
: compute the hyperbolic arcsecant of a number.bernoulli( n )
: compute the nth Bernoulli number.beta( x, y )
: beta function.betainc( x, a, b[, regularized[, upper]] )
: incomplete beta function.betaincinv( p, a, b[, upper] )
: inverse of the incomplete beta function.betaln( x, y )
: natural logarithm of the beta function.binet( x )
: evaluate Binet's formula extended to real numbers.binomcoef( n, k )
: compute the binomial coefficient.binomcoefln( n, k )
: compute the natural logarithm of the binomial coefficient.boxcox( x, lambda )
: compute a one-parameter Box-Cox transformation.boxcox1p( x, lambda )
: compute a one-parameter Box-Cox transformation of1+x
.boxcox1pinv( y, lambda )
: compute the inverse of a one-parameter Box-Cox transformation for1+x
.boxcoxinv( y, lambda )
: compute the inverse of a one-parameter Box-Cox transformation.cbrt( x )
: compute the cube root of a double-precision floating-point number.cbrtf( x )
: compute the cube root of a single-precision floating-point number.ccis( z )
: evaluate the cis function for a double-precision complex floating-point number.cexp( z )
: evaluate the exponential function for a double-precision complex floating-point number.cflipsign( z, y )
: return a double-precision complex floating-point number with the same magnitude asz
and the sign ofy*z
.cflipsignf( z, y )
: return a single-precision complex floating-point number with the same magnitude asz
and the sign ofy*z
.cidentity( z )
: evaluate the identity function of a double-precision complex floating-point number.cidentityf( z )
: evaluate the identity function of a single-precision complex floating-point number.cinv( z )
: compute the inverse of a double-precision complex floating-point number.copysign( x, y )
: return a double-precision floating-point number with the magnitude ofx
and the sign ofy
.copysignf( x, y )
: return a single-precision floating-point number with the magnitude ofx
and the sign ofy
.cot( x )
: evaluate the cotangent of a number.cotd( x )
: compute the cotangent of an angle measured in degrees.coth( x )
: compute the hyperbolic cotangent of a number.cphase( z )
: compute the argument of a double-precision complex floating-point number in radians.cpolar( z )
: compute the absolute value and phase of a double-precision complex floating-point number.csc( x )
: evaluate the cosecant of a number.cscd( x )
: compute the cosecant of a degree.csch( x )
: compute the hyperbolic cosecant of a number.deg2rad( x )
: convert an angle from degrees to radians.deg2radf( x )
: convert an angle from degrees to radians (single-precision).digamma( x )
: digamma function.diracDelta( x )
: evaluate the Dirac delta function.eta( s )
: dirichlet eta function.ellipe( m )
: compute the complete elliptic integral of the second kind.ellipj( u, m )
: compute the Jacobi elliptic functions sn, cn, and dn.ellipk( m )
: compute the complete elliptic integral of the first kind.erf( x )
: error function.erfc( x )
: complementary error function.erfcinv( x )
: inverse complementary error function.erfcx( x )
: scaled complementary error function.erfinv( x )
: inverse error function.factorial( x )
: factorial function.factorial2( n )
: double factorial function.factorialln( x )
: natural logarithm of the factorial function.fallingFactorial( x, n )
: compute the falling factorial.fibonacciIndex( F )
: compute the Fibonacci number index.fibonacci( n )
: compute the nth Fibonacci number.flipsign( x, y )
: return a double-precision floating-point number with the magnitude ofx
and the sign ofx*y
.flipsignf( x, y )
: return a single-precision floating-point number with the magnitude ofx
and the sign ofx*y
.fresnel( x )
: compute the Fresnel integrals S(x) and C(x).fresnelc( x )
: compute the Fresnel integral C(x).fresnels( x )
: compute the Fresnel integral S(x).frexp( x )
: split a double-precision floating-point number into a normalized fraction and an integer power of two.gamma( x )
: gamma function.gamma1pm1( x )
: computegamma(x+1) - 1
.gammainc( x, s[, regularized[, upper ]] )
: incomplete gamma function.gammaincinv( p, s[, upper ] )
: inverse of incomplete gamma function.gammaln( x )
: natural logarithm of the gamma function.gammasgn( x )
: sign of the gamma function.gcd( a, b )
: compute the greatest common divisor (gcd).heaviside( x[, continuity] )
: evaluate the Heaviside function.hypot( x, y )
: compute the hypotenuse avoiding overflow and underflow.hypotf( x, y )
: compute the hypotenuse avoiding overflow and underflow (single-precision).identity( x )
: evaluate the identity function of a double-precision floating-point number.identityf( x )
: evaluate the identity function of a single-precision floating-point number.inv( x )
: compute the multiplicative inverse of a double-precision floating-point number.invf( x )
: compute the multiplicative inverse of a single-precision floating-point number.kroneckerDelta( i, j )
: evaluate the Kronecker delta.kroneckerDeltaf( i, j )
: evaluate the Kronecker delta (single-precision).lcm( a, b )
: compute the least common multiple (lcm).ldexp( frac, exp )
: multiply a double-precision floating-point number by an integer power of two.lucas( n )
: compute the nth Lucas number.max( x, y )
: return the maximum value.maxn( [x[, y[, ...args]]] )
: return the maximum value.min( x, y )
: return the minimum value.minmax( x, y )
: return the minimum and maximum values.minmaxn( [x[, y[, ...args]]] )
: return the minimum and maximum values.minn( [x[, y[, ...args]]] )
: return the minimum value.modf( x )
: decompose a double-precision floating-point number into integral and fractional parts.negafibonacci( n )
: compute the nth negaFibonacci number.negalucas( n )
: compute the nth negaLucas number.nonfibonacci( n )
: compute the nth non-Fibonacci number.pdiff( x, y )
: return the positive difference betweenx
andy
.pdifff( x, y )
: return the positive difference betweenx
andy
.polygamma( n, x )
: polygamma function.rad2deg( x )
: convert an angle from radians to degrees.rad2degf( x )
: convert an angle from radians to degrees (single-precision).ramp( x )
: evaluate the ramp function.rampf( x )
: evaluate the ramp function.rcbrt( x )
: compute the reciprocal of the principal cube root of a double-precision floating-point number.rcbrtf( x )
: compute the reciprocal of the principal cube root of a single-precision floating-point number.zeta( s )
: riemann zeta function.rsqrt( x )
: compute the reciprocal of the principal square root of a double-precision floating-point number.rsqrtf( x )
: compute the reciprocal of the principal square root of a single-precision floating-point number.secd( x )
: compute the secant of an angle measured in degrees.sici( x )
: compute the sine and cosine integrals.spence( x )
: spence's function, also known as the dilogarithm.sqrt( x )
: compute the principal square root of a double-precision floating-point number.sqrt1pm1( x )
: computesqrt( 1 + x ) - 1
.sqrtf( x )
: compute the principal square root of a single-precision floating-point number.sqrtpi( x )
: compute the principal square root of the product of π and a positive number.tribonacci( n )
: compute the nth Tribonacci number.trigamma( x )
: trigamma function.wrap( v, min, max )
: wrap a value on the half-open interval[min,max)
.
Fast algorithms of various special functions, which trade accuracy for increased speed, are available in the following sub-namespace:
fast
: fast math special functions.
Finally, the namespace exports the following kernel functions, which are mainly used internally. Beware that they may only be applicable for input values inside a certain number range and/or may not work as expected if not all arguments satisfy the parameter requirements.
kernelBetainc( x, a, b, regularized, upper )
: incomplete beta function and its first derivative.kernelBetaincinv( a, b, p, q )
: inverse of the lower incomplete beta function.kernelCos( x, y )
: compute the cosine of a double-precision floating-point number on[-π/4, π/4]
.kernelSin( x, y )
: compute the sine of a double-precision floating-point number on[-π/4, π/4]
.kernelTan( x, y, k )
: compute the tangent of a double-precision floating-point number on[-π/4, π/4]
.rempio2( x, y )
: computex - nπ/2 = r
.
Examples
var objectKeys = require( '@stdlib/utils/keys' );
var special = require( '@stdlib/math/base/special' );
console.log( objectKeys( special ) );