What is the complete elliptic integral of the first kind?
The complete elliptic integral of the first kind, written \(K(k)\), is a classical special function defined by the integral of \(d\theta / \sqrt{1 - k^{2}\cdot\sin^{2}\theta}\) taken from 0 to \(\pi/2\). It appears whenever you need the exact (large-amplitude) period of a pendulum, the mutual inductance of coaxial coils via Neumann's formula, arc lengths, and stress fields around elliptic cracks. This calculator returns the real value of \(K(k)\) for a given elliptic modulus \(k\).
Convention: modulus k, not parameter m
There are two common conventions. This tool uses the modulus \(k\) directly, so the parameter is \(m = k^{2}\). That means this site's \(K(k)\) equals MATLAB's ellipke(m) with \(m = k^{2}\). For example, MATLAB ellipke(0.5) corresponds to entering \(k = \sqrt{0.5} \approx 0.7071\) here. Always confirm which convention a reference uses before comparing numbers.
How to use it
Enter the elliptic modulus \(k\) in the range \(-1 \le k \le 1\) and read off \(K(k)\). Because \(K\) is even in \(k\), the sign does not matter (\(K(-k) = K(k)\)); the tool takes the absolute value internally. The function is finite for \(|k| < 1\) and diverges logarithmically as \(|k|\) approaches 1.
The formula and method
We use the arithmetic-geometric mean:
$$K(k) = \int_{0}^{\pi/2} \frac{d\theta}{\sqrt{1 - k^{2}\,\sin^{2}\theta}} = \frac{\pi}{2\,\mathrm{AGM}\!\left(1,\;\sqrt{1 - k^{2}}\right)}$$Starting from \(a = 1\) and \(b = \sqrt{1 - k^{2}}\) (the complementary modulus), repeatedly replace them by their arithmetic and geometric means until they agree. AGM converges quadratically, so about a dozen iterations give full double precision.
Worked example
For \(k = 0.1\): \(m = 0.01\), and the complementary modulus is \(\sqrt{0.99} \approx 0.994987\). The AGM of 1 and 0.994987 converges to about 0.9974921. Then
$$K(0.1) = \frac{\pi}{2 \times 0.9974921} \approx 1.5747456$$FAQ
What is \(K(0)\)? Exactly \(\pi/2 \approx 1.5707963\), since the integrand reduces to 1.
Why does it blow up at \(k = 1\)? The complementary modulus becomes 0, \(\mathrm{AGM}(1,0) = 0\), and \(K(k)\) has a logarithmic singularity, so \(K \to +\infty\).
Can I enter \(|k| > 1\)? No. Outside \(-1 \le k \le 1\) the real integral is undefined; a reciprocal-modulus transformation is required, so the tool rejects such input.