id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
9044 Use mpmath for the erf() function rbeezer jason jkantor "Appears the current erf() function is limited to 53-bit accuracy, while using mpmath instead will provide greater accuracy and also (sometimes?) greater speed. This is from an IRC session - an edited version is below.
{{{
[09:55] --> E1ephant has joined this channel (~E1ephant@e1ephant.broker.freenet6.net).
[09:55] hi =)
[09:57] could you tell me please something? after integrating: integrate( (2/sqrt(2*pi)) * exp(-x^2/2), x, 0, 2) a have erf(sqrt(2))
[09:57] how can i calculate than that value numerically?
[09:57] i mean erf(sqrt(2))
[09:58] E1ephant: N(erf(sqrt(2)))
[09:59] :-* thx
[09:59] N? will give you documentation about using this to get different precision
[10:46] interesting, erf only works for the default 53 bits. if somebody needs more digits, resort to mpmath
[10:46] import mpmath; mpmath.mp.dps=200; mpmath.erf(mpmath.sqrt(2))
[10:50] mpmath is also neary 4 times faster for that one on my machine. i think the erf definition should be changed
[10:51] schilly: interesting (and even better that it is faster!)
[11:00] ah. end 16.5 times faster for the same 53bits prec (i still had it at 200 for the benachmark, where it was also faster)
[11:02] mpmath is faster for 200 bits precision than sage is for 53 bits? uh :)
[11:03] logix: yes
}}}" enhancement closed minor sage-duplicate/invalid/wontfix numerical duplicate fredrik.johansson kcrisman Karl-Dieter Crisman N/A