Scaled complementary error function.
The scaled complementary error function is defined as
For large values, the scaled complementary error function is approximately equal to
var erfcx = require( '@stdlib/math/base/special/erfcx' );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 NaNvar 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 );#include "stdlib/math/base/special/erfcx.h"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 );#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 );
}
}@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.