elliptic_e(0.5, 0.1) differs from Mathematica 7 by about 0.04%.
Subject: elliptic_e(0.5, 0.1) differs from Mathematica 7 by about 0.04%.
From: Dr. David Kirkby
Date: Sun, 09 Aug 2009 21:10:13 +0100
I've built Sage on a sun4u SPARC machine, using Maxima 5.19.0 and ECL 9.8.1
Sage fails about 15 tests, one of which is below. I computed the result
in Mathematica too, and find the result on the SPARC does differ from
what Sage expects, and the result Sage expects is much closer to the
result from Mathematica.
sage: elliptic_eu (0.5, 0.1)
Expected:
0.496054551287
Got:
0.495848403419
Mathematica 7.0 gives:
In[4]:= N[EllipticE[1/2,1/10],50]
Out[4]= 0.49801139449883153311546104061744810584963105068054
William Stein asked Fredrik Johansson if he could verify the Mathematica
result. His reply it below. It suggest there is a new bug in Maxima.
I'm not a mathematician, so don't have a clue of the logic, so I am just
copying this verbatim.
I understand there will probably be other 5.19.x releases soon, so I
assume you want to know of problems.
Note, this was computed on a SPARC - I've not seen any results from
Sage/Maxima on an Intel CPU. I only made the Maxima and ECL packages in
the last 24 hours or so, and they are not currently in any Sage release
(including any developer release).
Dave
--------comment from Fredrik Johansson -----
mpmath doesn't have incomplete elliptic integrals yet, but they can be
computed using the Appell F1 function or directly using numerical
quadrature. (The following implementations assume |re(z)| < pi/2 and
possibly other restrictions on the variables.)
>>> >>> from mpmath import mp, mpf, sin, appellf1, quad
>>> >>>
>>> >>> def E(z,m):
... return sin(z)*appellf1(0.5,0.5,-0.5,1.5, sin(z)**2, m*sin(z)**2)
...
>>> >>> def E2(z,m):
... return quad(lambda t: (1-m*sin(t)**2)**0.5, [0,z])
...
>>> >>> mp.dps = 50; mp.pretty = True
>>> >>> E(0.5, mpf('0.1'))
0.49801139449883153311546104061744810584963105068054
>>> >>> E2(0.5, mpf('0.1'))
0.49801139449883153311546104061744810584963105068054
Which is the same as Mathematica's output, so this looks like a Maxima bug.
Fredrik