Also fix test noise.
Merge branch 'tecki/elliptic-k-minus1'
The function special.agm suffered from the lack of precision in ellipk. By replacing it with ellipkm1, precision could be retained. Example y = agm(1, x) x y before y after 0.1 0.425 0.425 1e-10 0.064 0.064 1e-16 0.040 0.041 1e-17 4.4e-309 0.039 1e-20 4.4e-309 0.033
The complete elliptic integral of the first kind K, implemented as special.ellipk, diverges around 1. This has the unfortunate disadvantage that rounding errors in its parameters have tremendous, unwanted effects, as 1-1e-17 is rounded to 1 (float64), and thus ellipk reports infinte at this point. This is why the underlying cephes library defines a different funktion, K'(m) := K(1 - m). No rounding problems here, because the divergence has moved to zero, and significantly smaller numbers > 0 can be represented with float64. Unfortunately, scipy re-wrote the cephes library to undo just this, killing the precision actually supplied by cephes. This patch undoes that, but renames the function from ellipk to ellipkm1 (defined as ellipkm1(m) == ellipk(1 - m)) for backward compatibility, and adds a new python function ellipk which works as the original function.