Base (i.e., lower-level) special math functions.
var special = require( '@stdlib/math/base/special' );Namespace for "base" (i.e., lower-level) special math functions.
var fcns = special;
// returns {...}exp( x ): natural exponential function.exp10( x ): base10exponential function.exp2( x ): base2exponential function.expit( x ): compute the standard logistic function.expm1( x ): computeexp(x) - 1.expm1rel( x ): compute the relative error exponential.kernelLog1p( f ): evaluate a correction term for double-precision base-2 and base-10 logarithms when1+fis in[√2/2, √2].kernelLog1pf( f ): evaluate a correction term for single-precision base-2 and base-10 logarithms when1 + fis in[√2/2, √2].ln( x ): evaluate the natural logarithm of a double-precision floating-point number.log( x, b ): compute the baseblogarithm 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).logf( x, b ): compute the baseblogarithm of a single-precision floating-point number.logitf( p ): compute the logit function for a single-precision floating-point number.pow( base, exponent ): exponential function.powm1( b, x ): evaluatebˣ - 1.xlog1py( x, y ): computex * ln(y+1)so that the result is0ifx = 0.xlogy( x, y ): computex * ln(y)so that the result is0ifx = 0.xlogyf( x, y ): computex * ln(y)so that the result is0ifx = 0for single-precision floating-point numbersxandy.
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.acosdf( x ): compute the arccosine (in degrees) of a single-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.acovercosf( x ): compute the inverse coversed cosine of a single-precision floating-point number (in radians).acoversin( x ): compute the inverse coversed sine.acoversinf( x ): compute the inverse coversed sine of a single-precision floating-point number (in radians).ahavercos( x ): compute the inverse half-value versed cosine.ahavercosf( x ): compute the inverse half-value versed cosine of a single-precision floating point number.ahaversin( x ): compute the inverse half-value versed sine.ahaversinf( x ): compute the inverse half-value versed sine of a single-precision floating-point number.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).atan2d( y, x ): compute the angle in the plane (in degrees) between the positive x-axis and the ray from(0,0)to the point(x,y).atan2f( 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)as a single-precision floating-point number.atand( x ): compute the arctangent in degrees of a double-precision floating-point number.atandf( x ): compute the arctangent (in degrees) of a single-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.avercosf( x ): compute the inverse versed cosine of a single-precision floating-point number (in radians).aversin( x ): compute the inverse versed sine.aversinf( x ): compute the inverse versed sine of a single-precision floating-point number (in radians).cos( x ): compute the cosine of a number.cosd( x ): computes the cosine of an angle measured in degrees.cosdf( x ): computes the cosine of a single-precision floating-point number (in degrees).cosf( x ): compute the cosine of a single-precision floating-point number (in radians).cosh( x ): compute the hyperbolic cosine of a double-precision floating-point number.cosm1( x ): computecos(x) - 1.cosm1f( x ): computecos(x) - 1.cospi( x ): compute the cosine of a number times π.cospif( x ): compute the cosine of a number times π.covercos( x ): compute the coversed cosine.covercosf( x ): compute the coversed cosine of a single-precision floating-point number (in radians).coversin( x ): compute the coversed sine.coversinf( x ): compute the coversed sine of a single-precision floating-point number (in radians).hacovercos( x ): compute the half-value coversed cosine.hacovercosf( x ): compute the half-value coversed cosine of a single-precision floating-point number (in radians).hacoversin( x ): compute the half-value coversed sine.hacoversinf( x ): compute the half-value coversed sine of a single-precision floating-point number (in radians).havercos( x ): compute the half-value versed cosine.havercosf( x ): compute the half-value versed cosine of a single-precision floating-point number (in radians).haversin( x ): compute the half-value versed sine.haversinf( x ): compute the half-value versed sine of a single-precision floating-point number (in radians).kernelCosf( x ): compute the cosine of a number on[-π/4, π/4]in single-precision floating-point format.kernelSincos( x, y, out, stride, offset ): simultaneously compute the sine and cosine of an angle measured in radians on the interval[-π/4, π/4].kernelSincosf( x ): simultaneously compute the sine and cosine of an angle measured in radians on[-π/4, π/4]in single-precision floating-point format.kernelSinf( x ): compute the sine of a number on[-π/4, π/4]in single-precision floating-point format.kernelTanf( x, iy ): compute the tangent of a number on[-π/4, π/4]in single-precision floating-point format.risingFactorial( x, n ): compute the rising factorial.sin( x ): compute the sine of a number.sinc( x ): compute the cardinal sine of a number.sincf( x ): compute the cardinal sine of a single-precision floating-point number (in radians).sincos( x ): simultaneously compute the sine and cosine of an angle measured in radians.sincosd( x ): simultaneously compute the sine and cosine of an angle measured in degrees.sincosf( x ): simultaneously compute the sine and cosine of a single-precision floating-point number (in radians).sincospi(): simultaneously compute the sine and cosine of a number times π.sind( x ): compute the sine of an angle measured in degrees.sindf( x ): compute the sine of a single-precision floating-point number (in degrees).sinf( x ): compute the sine of a single-precision floating-point number (in radians).sinh( x ): compute the hyperbolic sine of a double-precision floating-point number.sinpi( x ): compute the sine of a number times π.sinpif( x ): compute the sine of a number times π.tan( x ): evaluate the tangent of a number.tand( x ): compute the tangent of an angle measured in degrees.tandf( x ): compute the tangent of a single-precision floating-point number (in degrees).tanf( x ): evaluate the tangent of a single-precision floating-point number (in radians).tanh( x ): compute the hyperbolic tangent of a double-precision floating-point number.vercos( x ): compute the versed cosine.vercosf( x ): compute the versed cosine of a single-precision floating-point number (in radians).versin( x ): compute the versed sine.versinf( x ): compute the versed sine of a single-precision floating-point number (in radians).
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.
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.absgammalnf( x ): natural logarithm of the absolute value of the gamma function.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 each component of a double-precision complex floating-point number toward positive infinity.cceilf( z ): round each component of 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^ntoward 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.cfloorf( z ): round each component of a single-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^ntoward 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.croundf( z ): round each component of a single-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.csignumf( z ): evaluate the signum function of a single-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.maxabsf( x, y ): return the maximum absolute single-precision floating-point number.maxabsn( [x[, y[, ...args]]] ): return the maximum absolute value.minabs( x, y ): return the minimum absolute value.minabsf( x, y ): return the minimum absolute single-precision floating-point number.minabsn( [x[, y[, ...args]]] ): return the minimum absolute value.minmaxabs( x, y ): return the minimum and maximum absolute values.minmaxabsf( x, y ): return the minimum and maximum absolute values of two single-precision floating-point numbers.minmaxabsn( [x[, y[, ...args]]] ): return the minimum and maximum absolute values.roundNearestEven( x ): round a double-precision floating-point number to the nearest integer value with ties rounding to the nearest even integer.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.roundf( x ): round a single-precision floating-point number to the nearest integer.roundn( x, n ): round a double-precision floating-point number to the nearest multiple of 10^n.roundsd( x, n[, b] ): round a double-precision floating-point number to the nearest value withnsignificant 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 withnsignificant figures.
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.acotdf( x ): compute the arccotangent in degrees of a single-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.bernoullif( n ): compute the nth Bernoulli number as a single-precision floating-point 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.binomcoeff( n, k ): compute the binomial coefficient as a single-precision floating-point number.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 aszand the sign ofy*z.cflipsignf( z, y ): return a single-precision complex floating-point number with the same magnitude aszand the sign ofy*z.cinv( z ): compute the inverse of a double-precision complex floating-point number.cinvf( z ): compute the inverse of a single-precision complex floating-point number.copysign( x, y ): return a double-precision floating-point number with the magnitude ofxand the sign ofy.copysignf( x, y ): return a single-precision floating-point number with the magnitude ofxand the sign ofy.cot( x ): evaluate the cotangent of a number.cotd( x ): compute the cotangent of an angle measured in degrees.cotdf( x ): compute the cotangent of a single-precision floating-point number (in degrees).cotf( x ): evaluate the cotangent of a single-precision floating-point number (in radians).coth( x ): compute the hyperbolic cotangent of a number.cphase( z ): compute the argument of a double-precision complex floating-point number in radians.cphasef( z ): compute the argument of a single-precision complex floating-point number in radians.cpolar( z ): compute the absolute value and phase of a double-precision complex floating-point number.cpolarf( z ): compute the absolute value and phase of a single-precision complex floating-point number.csc( x ): evaluate the cosecant of a number.cscd( x ): compute the cosecant of a degree.cscdf( x ): compute the cosecant of a single-precision floating-point number (in degrees).cscf( x ): evaluate the cosecant of a single-precision floating-point number (in radians).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.diracDeltaf( x ): evaluate the Dirac delta function for a single-precision floating-point number.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.factorial2f( n ): evaluate the double factorial function as a single-precision floating-point number.factorialln( x ): natural logarithm of the factorial function.factoriallnf( x ): natural logarithm of the factorial of a single-precision floating-point number.fallingFactorial( x, n ): compute the falling factorial.fibonacciIndex( F ): compute the Fibonacci number index.fibonacciIndexf( F ): compute the Fibonacci number index of a single-precision floating-point number.fibonacci( n ): compute the nth Fibonacci number.fibonaccif( n ): compute the nth Fibonacci number as a single-precision floating-point number.flipsign( x, y ): return a double-precision floating-point number with the magnitude ofxand the sign ofx*y.flipsignf( x, y ): return a single-precision floating-point number with the magnitude ofxand the sign ofx*y.fmod( x, y ): modulus function.fmodf( x, y ): evaluate the Modulus function for single-precision floating-point numbers.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.frexpf( x ): split a single-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.gammasgnf( x ): sign of the gamma function for a single-precision floating-point number.gcd( a, b ): compute the greatest common divisor (gcd).gcdf( a, b ): compute the greatest common divisor (gcd) of two single-precision floating-point numbers.heaviside( x[, continuity] ): evaluate the Heaviside function.heavisidef( x[, continuity] ): evaluate the Heaviside function for a single-precision floating-point number.hyp2f1( a, b, c, x ): evaluates the Gaussian hypergeometric function.hypot( x, y ): compute the hypotenuse avoiding overflow and underflow.hypotf( x, y ): compute the hypotenuse avoiding overflow and underflow (single-precision).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).lcmf( a, b ): compute the least common multiple (lcm) of two single-precision floating-point numbers.ldexp( frac, exp ): multiply a double-precision floating-point number by an integer power of two.ldexpf( frac, exp ): multiply a single-precision floating-point number by an integer power of two.lnf( x ): evaluate the natural logarithm of a single-precision floating-point number.lucas( n ): compute the nth Lucas number.lucasf( n ): compute the nth Lucas number as a single-precision floating-point number.max( x, y ): return the maximum value.maxf( x, y ): return the maximum single-precision floating-point number.maxn( [x[, y[, ...args]]] ): return the maximum value.min( x, y ): return the minimum value.minf( x, y ): return the minimum single-precision floating-point number.minmax( x, y ): return the minimum and maximum values.minmaxf( x, y ): return the minimum and maximum of two single-precision floating-point numbers.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.modff( x ): decompose a single-precision floating-point number into integral and fractional parts.nanmax( x, y ): return the maximum value, ignoring NaN.nanmaxf( x, y ): return the maximum value of two single-precision floating-point numbers, ignoring NaN.nanmin( x, y ): return the minimum value, ignoring NaN.nanminf( x, y ): return the minimum value of two single-precision floating-point numbers, ignoring NaN.negafibonacci( n ): compute the nth negaFibonacci number.negafibonaccif( n ): compute the nth negaFibonacci number as a single-precision floating-point number.negalucas( n ): compute the nth negaLucas number.negalucasf( n ): compute the nth negaLucas number in single-precision floating-point format.nonfibonacci( n ): compute the nth non-Fibonacci number.nonfibonaccif( n ): compute the nth non-Fibonacci single-precision floating-point number.pdiff( x, y ): return the positive difference betweenxandy.pdifff( x, y ): return the positive difference betweenxandy.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.rempio2f( x, y ): computex - nπ/2 = r(single-precision).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.sec( x ): evaluate the secant of a number.secd( x ): compute the secant of an angle measured in degrees.secdf( x ): compute the secant of a single-precision floating-point number (in degrees).secf( x ): evaluate the secant of a single-precision floating-point number (in radians).sech( x ): compute the hyperbolic secant of a double-precision floating-point number.sici( x ): compute the sine and cosine integrals.spence( x ): spence's function, also known as the dilogarithm.spencef( x ): spence's function (the dilogarithm) for a single-precision floating-point number.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.sqrtpif( x ): compute the principal square root of the product of π and a positive single-precision floating-point number.tribonacci( n ): compute the nth Tribonacci number.tribonaccif( n ): compute the nth Tribonacci number as a single-precision floating-point number.trigamma( x ): trigamma function.trigammaf( x ): trigamma function for a single-precision floating-point number.wrap( v, min, max ): wrap a value to the half-open interval[min,max).wrapf( v, min, max ): wrap a single-precision floating-point value to 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.
var objectKeys = require( '@stdlib/utils/keys' );
var special = require( '@stdlib/math/base/special' );
console.log( objectKeys( special ) );