Numerical issues with jacobi_sn



Raymond Toy wrote:
> At this point, I'm stumped.  Neither AGM nor Landen/Gauss
> transformations produce the correct answers.
>
>   
I think I've found a solution to this.  Use the descending Landen
transformation to jacobi_sn.  This appears to work well for all real and
complex values of the argument and the parameter.

Then, for jacobi_dn, we use the Gauss transformation
(<http://functions.wolfram.com/09.29.16.0013.01>;) to express jacobi_dn
in terms of jacobi_sn.

Finally, jacobi_cn can be computed using the ascending Landen
transformation to express jacobi_cn in terms of jacobi_dn.

Simple tests of selected interesting points and random values indicates
that the algorithms work without undue loss of precision and without
returning bogus results like jacobi_dn or jacobi_cn greater then 1.

Ray