65 KiB
65 KiB
Special Functions
Standard library base special math functions.
Usage
var special = require( '@stdlib/math/base/special' );
special
Standard library base 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.ln( x )
: evaluate the natural logarithm.log( x, b )
: compute the baseb
logarithm.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)
.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 number.acosh( x )
: compute the hyperbolic arccosine of a 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 number.asinh( x )
: compute the hyperbolic arcsine of a number.atan( x )
: compute the arctangent of a 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)
.atanh( x )
: compute the hyperbolic arctangent of a number.avercos( x )
: compute the inverse versed cosine.aversin( x )
: compute the inverse versed sine.cos( x )
: compute the cosine of a number.cosh( x )
: compute the hyperbolic cosine of a 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( [out,] x )
: simultaneously compute the sine and cosine of a number.sincospi( [out,] x )
: simultaneously compute the sine and cosine of a number times π.sinh( x )
: compute the hyperbolic sine of a number.sinpi( x )
: compute the sine of a number times π.tan( x )
: evaluate the tangent of a number.tanh( x )
: compute the hyperbolic tangent of a 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( re, im )
: compute an absolute value of a complex number.cabs2( re, im )
: compute the squared absolute value of a complex number.cceil( [out,] re, im )
: round a complex number toward positive infinity.cceiln( [out,] re, im, n )
: round a complex 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( [out,] re, im )
: round a complex number toward negative infinity.cfloorn( [out,] re, im, n )
: round a complex 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( [out,] re, im )
: round a complex number to the nearest integer.croundn( [out,] re, im, n )
: round a complex number to the nearest multiple of10^n
.csignum( [out,] re, im )
: evaluate the signum function of a complex 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 numeric value 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[, ...args]]] )
: return the maximum absolute value.minabs( [x[, y[, ...args]]] )
: return the minimum absolute value.minmaxabs( [out,] 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 numeric value 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 number.acoth( x )
: compute the inverse hyperbolic cotangent 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( [out,] re, im )
: compute the cis function of a complex number.cexp( [out,] re, im )
: compute the exponential function of a complex number.cflipsign( [out,] re, im, y )
: return a complex number with the same magnitude asz
and the sign ofy*z
.cinv( [out,] re1, im1 )
: compute the inverse of a complex number.copysign( x, y )
: return a double-precision floating-point number with the magnitude ofx
and the sign ofy
.cphase( re, im )
: compute the argument of a complex number in radians.cpolar( [out,] re, im )
: compute the absolute value and phase of a complex 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.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.erfinv( x )
: inverse error function.factorial( x )
: 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
.fresnel( [out,] 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( [out,] 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.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.imul( a, b )
: perform C-like multiplication of two signed 32-bit integers.imuldw( [out,] a, b )
: compute the double word product of two signed 32-bit integers.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[, ...args]]] )
: return the maximum value.min( [x[, y[, ...args]]] )
: return the minimum value.minmax( [out,] x[, y[, ...args]] )
: return the minimum and maximum values.modf( [out,] 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.ramp( x )
: evaluate the ramp function.rampf( x )
: evaluate the ramp function.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.sici( [out,] 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.tribonacci( n )
: compute the nth Tribonacci number.trigamma( x )
: trigamma function.uimul( a, b )
: perform C-like multiplication of two unsigned 32-bit integers.uimuldw( [out,] a, b )
: compute the double word product of two unsigned 32-bit integers.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
: standard library 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 number on[-π/4, π/4]
.kernelSin( x, y )
: compute the sine of a number on[-π/4, π/4]
.kernelTan( x, y, k )
: compute the tangent of a 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 ) );