# Numerical evaluation of the first and second complete elliptic integrals

To get a numerical evaluation of the first (K) and second (E) complete elliptic integrals:

$$K(k)=\int_0^1\frac{dt}{(1-t^2)^{1/2}(1-k^2t^2)^{1/2}}, \ \ \ \ \ E(k)=\int_0^1\frac{(1-k^2t^2)^{1/2}}{(1-t^2)^{1/2}}dt$$

in a left neighbourhood of the point $k=1$. What numerical methods do you recommend to get a "good" approximation of K and E in a left neighbourhood of the point $k=1$?

A truncated power series about $k=1$ is one way. You can find several forms at functions.wolfram.com for $K(k)$ and $E(k)$. The number of terms used should allow you to estimate your error for a given neighborhood size.
Matlab's ellipke uses a simple arithmetic–geometric mean method (see Abramowitz & Stegun) to find values for any $k$.