[Scipy-tickets] [SciPy] #683: scipy.special.erf has significant errors just within its switchover radius
SciPy Trac
scipy-tickets@scipy....
Sun Jun 20 17:43:33 CDT 2010
#683: scipy.special.erf has significant errors just within its switchover radius
----------------------------+-----------------------------------------------
Reporter: tardis | Owner: somebody
Type: defect | Status: closed
Priority: normal | Milestone: 0.8.0
Component: scipy.special | Version:
Resolution: fixed | Keywords: erf complex
----------------------------+-----------------------------------------------
Changes (by pv):
* status: new => closed
* resolution: => fixed
Comment:
Fixed in r6548
The current complex-valued algorithm is actually a bit lousy, as the
global maximum accuracy is theoretically limited to about 1e-8 due to
finite precision, even with an optimal cutoff choice. We inevitably lose
half of the digits at some points.
The asymptotic expansion error can be estimated by the magnitude of the
smallest term in the asymptotic series (R=|z|),
{{{
err ~ Gamma(2 R**2 + 2) / ((2 R)**(R**2 + 1/2) Gamma(R**2 + 3/2) 2**(R**2
+ 1/2))
}}}
and the roundoff error by the largest term in the Taylor series multiplied
by machine epsilon and number of terms,
{{{
err ~ EPS R**(2 R**2) / (2 Gamma(R**2 + 1/2))
}}}
This gives an "optimal" crossover point R = 4.36, pretty close to what you
got, with the best estimated relative accuracy around 2e-8.
I guess the previous cutoff R=5.8 was found by noting that at this point,
the asymptotic series (disregarding finite-precision arithmetic) gives
machine epsilon accuracy.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/683#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list