# ellipticK

Complete elliptic integral of the first kind

ellipticK(m)

## Description

ellipticK(m) returns the complete elliptic integral of the first kind.

## Input Arguments

 m Number, symbolic number, variable, expression, or function. This argument also can be a vector or matrix of numbers, symbolic numbers, variables, expressions, or functions.

## Examples

Compute the complete elliptic integrals of the first kind for these numbers. Because these numbers are not symbolic objects, you get floating-point results.

s = [ellipticK(1/2), ellipticK(pi/4), ellipticK(1),  ellipticK(-5.5)]
s =
1.8541    2.2253       Inf    0.9325

Compute the complete elliptic integrals of the first kind for the same numbers converted to symbolic objects. For most symbolic (exact) numbers, ellipticK returns unresolved symbolic calls.

s = [ellipticK(sym(1/2)), ellipticK(sym(pi/4)),...
ellipticK(sym(1)),  ellipticK(sym(-5.5))]
s =
[ ellipticK(1/2), ellipticK(pi/4), Inf, ellipticK(-11/2)]

Use vpa to approximate this result with floating-point numbers:

vpa(s, 10)
ans =
[ 1.854074677, 2.225253684, Inf, 0.9324665884]

Differentiate these expressions involving the complete elliptic integral of the first kind:

syms m
diff(ellipticK(m))
diff(ellipticK(m^2), m, 2)
ans =
- ellipticK(m)/(2*m) - ellipticE(m)/(2*m*(m - 1))

ans =
(2*ellipticE(m^2))/(m^2 - 1)^2 - (2*(ellipticE(m^2)/(2*m^2) -...
ellipticK(m^2)/(2*m^2)))/(m^2 - 1) + ellipticK(m^2)/m^2 +...
(ellipticK(m^2)/m + ellipticE(m^2)/(m*(m^2 - 1)))/m +...
ellipticE(m^2)/(m^2*(m^2 - 1))

Here, ellipticE represents the complete elliptic integral of the second kind.

Plot the complete elliptic integral of the first kind:

syms m
ezplot(ellipticK(m))
title('Complete elliptic integral of the first kind')
ylabel('ellipticK(m)')
grid on

Call ellipticK for this symbolic matrix. When the input argument is a matrix, ellipticK computes the complete elliptic integral of the first kind for each element.

ellipticK(sym([-2*pi -4; 0 1]))
ans =
[ ellipticK(-2*pi), ellipticK(-4)]
[             pi/2,           Inf]

## Alternatives

You can use ellipke to compute elliptic integrals of the first and second kinds in one function call.

collapse all

### Complete Elliptic Integral of the First Kind

The complete elliptic integral of the first kind is defined as follows:

$K\left(m\right)=F\left(\frac{\pi }{2}|m\right)=\underset{0}{\overset{\pi /2}{\int }}\frac{1}{\sqrt{1-m{\mathrm{sin}}^{2}\theta }}d\theta$

Note that some definitions use the elliptical modulus k or the modular angle α instead of the parameter m. They are related as m = k2 = sin2α.

### Tips

• ellipticK returns floating-point results for numeric arguments that are not symbolic objects.

• For most symbolic (exact) numbers, ellipticK returns unresolved symbolic calls. You can approximate such results with floating-point numbers using vpa.

• If m is a vector or a matrix, then ellipticK(m) returns the complete elliptic integral of the first kind, evaluated for each element of m.

## References

[1] Milne-Thomson, L. M. "Elliptic Integrals." Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.