math-erf

Error function.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
math-erf
401.0.08 years ago8 years agoMinified + gzip package size for math-erf in KB

Readme

erf
!NPM versionnpm-imagenpm-url !Build Statusbuild-imagebuild-url !Coverage Statuscoverage-imagecoverage-url !Dependenciesdependencies-imagedependencies-url
Error functionerror-function.

The error functionerror-function is defined as
<img src="https://cdn.rawgit.com/math-io/erf/a04ac9320eaaca5f8a09fd4b590834bea0376361/docs/img/eqn.svg" alt="Error function.">
<br>

Installation

$ npm install math-erf

Usage

var erf = require( 'math-erf' );

erf( x )

Evaluates the error functionerror-function.
var y = erf( 2 );
// returns ~0.9953

y = erf( -1 );
// returns ~-0.8427

If provided NaN, the function returns NaN.
var y = erf( NaN );
// returns NaN

The error functionerror-function is an odd functionodd-function; i.e., erf(-x) = -erf(x). Thus, in accordance with the IEEE 754ieee754 standard, if provided -0, the function returns -0.
var y = erf( -0 );
// returns -0

Examples

var linspace = require( 'compute-linspace' );
var erf = require( 'math-erf' );

var x = linspace( -10, 10, 100 );
var y;
var i;

for ( i = 0; i < x.length; i++ ) {
	y = erf( x[ i ] );
	console.log( 'x: %d, erf(x): %d', x[ i ], y );
}

To run the example code from the top-level application directory,
$ node ./examples/index.js

Tests

Unit

This repository uses tapetape for unit tests. To run the tests, execute the following command in the top-level application directory:
$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbulistanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,
$ make view-cov

Browser Support

This repository uses Testlingtestling for browser testing. To run the tests in a (headless) local web browser, execute the following command in the top-level application directory:
$ make test-browsers

To view the tests in a local web browser,
$ make view-browser-tests


License

MIT license.

Copyright

Copyright © 2016. The Compute.iocompute-io Authors.