Is there a way to calculate the inverse of $K(k)$ which is the complete elliptic integral of the first kind.
Ex:$$K^{-1}(K(k))=k$$
Is there a way to calculate the inverse of $K(k)$ which is the complete elliptic integral of the first kind.
Ex:$$K^{-1}(K(k))=k$$
On
As @user10560552 answered, solving for $y$ the equation $K(y)=x$ doesnot make much problems using Newton method.
The problem is to get a reasonable starting value for $y_0$.
For a rather large range $(0 \leq y \leq 0.8)$, we can use a $[2,2]$ Padé approximant built at $y=0$. It would be $$K(y) \simeq\frac \pi 2 \,\frac{1-\frac{249 }{304}y+\frac{409 }{4864}y^2 } {1-\frac{325 }{304}y+\frac{1025 }{4864}y^2 }$$ leaving us with a quadratic equation in $y$ and the retained solution being given by $$y_{est}= \frac{8 \left(650 x-249 \pi-\sqrt{110900 x^2-105732 \pi x+30917 \pi ^2} \right)}{2050 x-409 \pi }$$
Below are reproduced some results $$\left( \begin{array}{ccc} x & \text{approximation} & \text{solution} \\ 1.6 & 0.071353 & 0.071353 \\ 1.7 & 0.275811 & 0.275799 \\ 1.8 & 0.431626 & 0.431472 \\ 1.9 & 0.551809 & 0.551130 \\ 2.0 & 0.645716 & 0.643856 \\ 2.1 & 0.720101 & 0.716225 \\ 2.2 & 0.779850 & 0.773057 \\ 2.3 & 0.828504 & 0.817928 \\ 2.4 & 0.868645 & 0.853523 \\ 2.5 & 0.902173 & 0.881878 \\ 2.6 & 0.930496 & 0.904545 \\ 2.7 & 0.954672 & 0.922724 \\ 2.8 & 0.975507 & 0.937342 \end{array} \right)$$
Working with the bad case where $x=2.8$, Newton iterates would be $$\left( \begin{array}{cc} n & y_n \\ 0 & 0.975507 \\ 1 & 0.952724 \\ 2 & 0.939459 \\ 3 & 0.937380 \\ 4 & 0.937342 \end{array} \right)$$
For anyone in the future who needs this, $K(k)$ can be computed efficiently using the formula $$K(k)=\frac{.5\pi}{AGM(1,\sqrt{1-k^2})}$$ where $AGM(x,y)$ is the arithmetic-geometric mean and the derivative of $K(k)$ is $$\frac{E(k)}{k(1-k^2)}-\frac{K(k)}{k}$$ where $E(k)$ is the complete elliptic integral of the second kind, which can be calculated using$$E(k)=K(k)(1-\frac{k^2}{2}-\sum_{n=0}^\infty2^n(a_n-a_{n+1})^2)$$and $a_n$ is computed using the AGM where$$a_0=1;b_0=\sqrt{1-k^2}$$$$a_{n+1}=\frac{a_n+b_n}{2};b_{n+1}=\sqrt{a_nb_n}$$ Then using Newton-raphson functional inversion, define$$K^{-1}(x)=y$$$$x=K(y)$$$$0=K(y)-x$$$$y_{n+1}=y_n-\frac{K(y_n)-x}{\frac{E(y_n)}{y_n(1-y_n^2)}-\frac{K(y_n)}{y_n}}$$after when n > 6 you will get a reasonably accurate result