1.0.0 • Published 2 years ago
@toshiara/special-erf v1.0.0
erf / erfc
Evaluates the error and complementary error functions.
This package is a rewrite of math-erf and math-erfc in Typescript. This package supports both CommonJs and ES Modules.
The error function is defined as
\mathrm{erf}(x) = \frac{2}{\sqrt\pi}\int_0^x e^{-t^2}\,\mathrm dtThe complementary error function is defined as
\mathrm{erfc}(x) = 1 - \mathrm{erf}(x) = \frac{2}{\sqrt\pi} \int_x^{\infty} e^{-t^2}\, dtInstallation
$ npm install @toshiara/special-erfUsage
// for CommonJs
const { erf, erfc } = require('@toshiara/special-erf');
// for ES Modules
import { erf, erfc } from '@toshiara/special-erf';erf(x)
Evaluates the error function.
erf(2);
// returns 0.9953222650189527
erf(-1);
// returns -0.8427007929497149If provided NaN, the function returns NaN.
erf(NaN);
// returns NaNThe error function is an odd function; i.e., erf(-x) = -erf(x). Thus, in accordance with the IEEE 754 standard, if provided -0, the function returns -0.
erf(-0);
// returns -0erfc( x )
Evaluates the complementary error function.
erfc(2);
// returns 0.004677734981047266
erfc(-1);
// returns 1.8427007929497148
erfc(Number.POSITIVE_INFINITY);
// returns 0
erfc(Number.NEGATIVE_INFINITY);
// returns 2If provided NaN, the function returns NaN.
erfc(NaN);
// returns NaNLicense
Copyright
Copyright © 2016. The Compute.io Authors.
1.0.0
2 years ago