Thanks for the bug report and analysis. You are right. Some different method needs to be used.
I also notice that there are lots of other issues with inverse elliptic functions. It will take some time to sort this all out.
Numeric evaluation of inverse Jacobi elliptic functions is wrong for some inputs. For example,
(%i6) jacobi_dn(float(inverse_jacobi_dn(-2, 3)), 3); (%o6) 2.0000000000000004 - 2.4980018054066022e-16 %i
is clearly wrong; it should be -2, as you can see with the symbolic simplification:
(%i1) jacobi_dn(inverse_jacobi_dn(-2, 3), 3); (%o1) - 2
The reason for this problem is that inverse_jacobi_dn
is computed as inverse_jacobi_dn(u, m)=elliptic_f(asin(sqrt((1 - u^2)/m)), m)
. Since that function is even in u
, inverse_jacobi_dn(-2, 3)=inverse_jacobi_dn(2, 3)
, which is wrong. It should be computed in some other way.
Presumably this problem will also cause errors with some of the other inverse Jacobi functions, since I think some are defined in terms of inverse_jacobi_dn
for numeric evaluation.
Thanks for the bug report and analysis. You are right. Some different method needs to be used.
I also notice that there are lots of other issues with inverse elliptic functions. It will take some time to sort this all out.
I implemented them in Sage for real input at http://trac.sagemath.org/ticket/14996 using the paper https://researchspace.auckland.ac.nz/bitstream/handle/2292/5042/390.pdf for reference. Perhaps a similar method could be used.
A new implementation of inverse_jacobi_dn has been checked in. Please test this, if you can.
The new version uses the relationship
dn(z | m) = cn(sqrt(m)*z | 1/m)
Great! I'll test this when I get a chance.
Log in to post a comment.