From: SourceForge.net <no...@so...> - 2011-03-24 13:27:50
|
Bugs item #3220118, was opened at 2011-03-17 11:02 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3220118&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Raymond Toy (rtoy) Assigned to: Nobody/Anonymous (nobody) Summary: erf(1+5*%i) not accurate Initial Comment: erf(1.0+5*%i) returns - 2.7837671212125964e+9 %i - 1.0786562260474622e+9 But the true answer (as given by Wolfram/Alpha) is - 2.7837702922089653e+9 %i - 1.0786931161985406e+9 Only about 4 digits are correct. ---------------------------------------------------------------------- >Comment By: Raymond Toy (rtoy) Date: 2011-03-24 09:27 Message: I think the inaccuracy comes from gamma-incomplete, which is used to evaluate erf. For this particular argument, gamma-incomplete uses the series. I think the test of when to use the series could be relaxed a bit. When I set *gamma-imag* to 0.1, the continued fraction is used, which gives - 2.7837770292209086e+9 %i - 1.0786931161985383e+9 This is better. I've done some experiments using the continued fraction http://functions.wolfram.com/06.06.10.0005.01. This seems to work a bit better. ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2011-03-17 22:51 Message: By the way: using a 1F1 representation for erf, the values agree with Wolfram | Alpha. But the hypergeometric code has to switch to bigfloats to do this: (%i11) my_erf(x) := nfloat(2*x*hypergeometric([1/2],[3/2],-x^2)/sqrt(%pi),[]); (%o11) my_erf(x):=nfloat((2*x*hypergeometric([1/2],[3/2],-x^2))/sqrt(%pi),[]) (%i12) load(hypergeometric)$ (%i14) my_erf(1.0+5*%i); (%o14) -2.783777029220896b9*%i-1.078693116198541b9 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3220118&group_id=4933 |