erfcx
Scaled complementary error function.
The scaled complementary error function is defined as
For large values, the complementary error function is approximately equal to
Installation
npm install @stdlib/math-base-special-erfcx
Alternatively,
- To load the package in a website via a
script
tag without installation and bundlers, use the ES Module available on theesm
branch. - If you are using Deno, visit the
deno
branch. - For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the
umd
branch.
The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.
Usage
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 +Infinity
If provided NaN
, the function returns NaN
.
var y = erfcx( NaN );
// returns NaN
Examples
var linspace = require( '@stdlib/array-base-linspace' );
var erfcx = require( '@stdlib/math-base-special-erfcx' );
var x = linspace( -30.0, 30.0, 100 );
var i;
for ( i = 0; i < x.length; i++ ) {
console.log( 'x: %d, erfcx(x): %d', x[ i ], erfcx( x[ i ] ) );
}
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
License
See LICENSE.
Copyright
Copyright © 2016-2022. The Stdlib Authors.