@stdlib/math-base-special-erfcx
v0.3.1
Published
Scaled complementary error function.
Downloads
3,325
Readme
erfcx
Scaled complementary error function.
The scaled complementary error function is defined as
For large values, the scaled complementary error function is approximately equal to
Installation
npm install @stdlib/math-base-special-erfcxUsage
var erfcx = require( '@stdlib/math-base-special-erfcx' );erfcx( x )
Evaluates the scaled complementary error function.
var y = erfcx( 0.0 );
// returns 1.0
y = erfcx( 1.0 );
// returns ~0.4276
y = erfcx( -1.0 );
// returns ~5.01
y = erfcx( 50.0 );
// returns ~0.011
y = erfcx( -50.0 );
// returns +InfinityIf provided NaN, the function returns NaN.
var y = erfcx( NaN );
// returns NaNExamples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var erfcx = require( '@stdlib/math-base-special-erfcx' );
var opts = {
'dtype': 'float64'
};
var x = uniform( 100, -30.0, 30.0, opts );
logEachMap( 'x: %0.4f, erfcx(x): %0.4f', x, erfcx );C APIs
Usage
#include "stdlib/math/base/special/erfcx.h"stdlib_base_erfcx( x )
Evaluates the scaled complementary error function.
double y = stdlib_base_erfcx( 0.0 );
// returns 1.0
y = stdlib_base_erfcx( 1.0 );
// returns ~0.4276The function accepts the following arguments:
- x:
[in] doubleinput value.
double stdlib_base_erfcx( const double x );Examples
#include "stdlib/math/base/special/erfcx.h"
#include <stdio.h>
int main( void ) {
const double x[] = { 0.0, 0.22, 0.44, 0.67, 0.89, 1.11, 1.33, 1.56, 1.78, 2.0 };
double v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_erfcx( x[ i ] );
printf( "x: %lf, erfcx(x): %lf\n", x[ i ], v );
}
}See Also
@stdlib/math-base/special/erfc: complementary error function.@stdlib/math-base/special/erfcinv: inverse complementary error function.@stdlib/math-base/special/erf: error function.@stdlib/math-base/special/erfinv: inverse error function.
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
Copyright
Copyright © 2016-2026. The Stdlib Authors.
