mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
57 lines
1.5 KiB
Markdown
57 lines
1.5 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-erf">Function erf <a href="#function-erf" title="Permalink">#</a></h1>
|
|
|
|
Compute the erf function of a value using a rational Chebyshev
|
|
approximations for different intervals of x.
|
|
|
|
This is a translation of W. J. Cody's Fortran implementation from 1987
|
|
( https://www.netlib.org/specfun/erf ). See the AMS publication
|
|
"Rational Chebyshev Approximations for the Error Function" by W. J. Cody
|
|
for an explanation of this process.
|
|
|
|
For matrices, the function is evaluated element wise.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.erf(x)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`x` | number | Array | Matrix | A real number
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | Array | Matrix | The erf of `x`
|
|
|
|
|
|
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.erf(0.2) // returns 0.22270258921047847
|
|
math.erf(-0.5) // returns -0.5204998778130465
|
|
math.erf(4) // returns 0.9999999845827421
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[zeta](zeta.html)
|