I need to evaluate EllipticK[m] very close to 1. However, when I get too close to 1 the function defaults to the exact solution for 1 , which is ComplexInfinity. I can enter a comparable number in Wolfram|Alpha and get both the exact and the numerical approximation, but nothing I have tried gets me that approximate number in Mathematica:





I've tried various other combinations of precision manipulation as well, so far nothing has worked. Does anyone know how to override the exact answer?


I discovered half the solution immediately after posting. When I put a 0 at the end of the string of 9s, it will evaluate the decimal approximation. However, I don't know how to implement this for the purpose of, say, plotting the EllipticK.

  • $\begingroup$ Try EllipticK[0.9999999999999999999999999999999999999950]` $\endgroup$
    – Somos
    Apr 16 '19 at 23:43
  • $\begingroup$ Somos means EllipticK[0.99999999999999999999999999999999999999`50]. The editing is wonky with the backticks, and I don't remember how to escape them. $\endgroup$
    – march
    Apr 17 '19 at 0:05
  • 1
    $\begingroup$ @march Use double back-ticks: EllipticK[0.99999999999999999999999999999999999999`50] $\endgroup$
    – Michael E2
    Apr 17 '19 at 1:12

Your choice to evaluate EllipticK[m] for values of m near the logarithmic singularity at $1$ is doomed from the start. The numerically proper way to go about this is to use the relationship of the complete elliptic integral of the first kind with the arithmetic-geometric mean, so that you are evaluating an argument near $0$:

N[Pi/(2 ArithmeticGeometricMean[1, Sqrt[1*^-46]]), 20]
  • $\begingroup$ (I'm not quite back yet, I still don't have my own computer, and I just evaluated this on Wolfram One only to answer this question.) $\endgroup$
    – J. M.'s torpor
    Jul 23 '19 at 2:26
  • 3
    $\begingroup$ Glad you're at least partially back. Looking forward to you being fully back. $\endgroup$
    – JimB
    Jul 23 '19 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.