61 lines
1.9 KiB
JSON
61 lines
1.9 KiB
JSON
{
|
|
"name": "ErfApprox",
|
|
"summary": "The error function by Abramowitz and Stegun's formula 7.1.26, whose stated absolute error is below 1.5e-7 for every X.",
|
|
"tags": [
|
|
"special functions",
|
|
"approximation",
|
|
"statistics"
|
|
],
|
|
"sources": [
|
|
{
|
|
"title": "Abramowitz and Stegun, Handbook of Mathematical Functions (National Bureau of Standards, 1964), section 7.1, formula 7.1.26",
|
|
"url": "https://archive.org/details/HandbookOfMathematicalFunctions"
|
|
}
|
|
],
|
|
"cases": [
|
|
{
|
|
"call": "ErfApprox(0.0)"
|
|
},
|
|
{
|
|
"call": "ErfApprox(0.5)"
|
|
},
|
|
{
|
|
"call": "ErfApprox(-1.0)"
|
|
},
|
|
{
|
|
"call": "ErfApprox(2.0)"
|
|
},
|
|
{
|
|
"call": "ErfApprox(3.5)"
|
|
},
|
|
{
|
|
"call": "ErfApprox(0.0451)"
|
|
},
|
|
{
|
|
"call": "ErfApprox(1.0e-5)"
|
|
}
|
|
],
|
|
"references": [
|
|
{
|
|
"lang": "python",
|
|
"level": "plain",
|
|
"file": "ref/python/plain.py",
|
|
"note": "The same formula."
|
|
},
|
|
{
|
|
"lang": "python",
|
|
"level": "libm",
|
|
"file": "ref/python/libm.py",
|
|
"note": "Python's math.erf, which uses the platform C library's erf: the approximation must stay within its stated 1.5e-7 of it. ErfApprox(0.0451) sits next to the largest error, about 1.39e-7.",
|
|
"abs": 1.5e-07
|
|
},
|
|
{
|
|
"lang": "mojo",
|
|
"level": "plain",
|
|
"file": "ref/mojo/plain.mojo",
|
|
"note": "The same formula in Mojo. The compiled program calls Mojo's own exp(), which in Mojo 1.2.0 is off by up to about 6.5e-12 of the value on [-16, 0], so the last digits are not the pseudo's. The result is 1 - Poly * exp(-A * A), so the difference is small in absolute terms (at most 1.2e-13 over 640,000 values of X between -8 and 8, many of them near 0, computed at run time by Mojo 1.2.0), but not in relative terms near 0, where erf is small: at X = 1.0e-5 the difference is about 8e-12 of the value.",
|
|
"abs": 2e-13
|
|
}
|
|
]
|
|
}
|