# ellipke

Complete elliptic integrals of the first and second kinds

## Examples

### Compute Complete Elliptic Integrals of First and Second Kind

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

[K0, E0] = ellipke(0)
[K05, E05] = ellipke(1/2)
K0 =
1.5708

E0 =
1.5708

K05 =
1.8541

E05 =
1.3506

Compute the complete elliptic integrals for the same numbers converted to symbolic objects. For most symbolic (exact) numbers, ellipke returns results using the ellipticK and ellipticE functions.

[K0, E0] = ellipke(sym(0))
[K05, E05] = ellipke(sym(1/2))
K0 =
pi/2

E0 =
pi/2

K05 =
ellipticK(1/2)

E05 =
ellipticE(1/2)

Use vpa to approximate K05 and E05 with floating-point numbers:

vpa([K05, E05], 10)
ans =
[ 1.854074677, 1.350643881]

### Compute Integrals When Input is Not Between 0 and 1

If the argument does not belong to the range from 0 to 1, then convert that argument to a symbolic object before using ellipke:

[K, E] = ellipke(sym(pi/2))
K =
ellipticK(pi/2)

E =
ellipticE(pi/2)

Alternatively, use ellipticK and ellipticE to compute the integrals of the first and the second kinds separately:

K = ellipticK(sym(pi/2))
E = ellipticE(sym(pi/2))
K =
ellipticK(pi/2)

E =
ellipticE(pi/2)

### Compute Integrals for Matrix Input

Call ellipke for this symbolic matrix. When the input argument is a matrix, ellipke computes the complete elliptic integrals of the first and second kinds for each element.

[K, E] = ellipke(sym([-1 0; 1/2 1]))
K =
[  ellipticK(-1), pi/2]
[ ellipticK(1/2),  Inf]

E =
[  ellipticE(-1), pi/2]
[ ellipticE(1/2),    1]

## Input Arguments

collapse all

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

## Output Arguments

collapse all

Complete elliptic integral of the first kind, returned as a symbolic expression.

Complete elliptic integral of the second kind, returned as a symbolic expression.

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α.

### Complete Elliptic Integral of the Second Kind

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

$E\left(m\right)=E\left(\frac{\pi }{2}|m\right)=\underset{0}{\overset{\pi /2}{\int }}\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

• Calling ellipke for numbers that are not symbolic objects invokes the MATLAB® ellipke function. This function accepts only 0 <= m <= 1. To compute the complete elliptic integrals of the first and second kinds for the values out of this range, use sym to convert the numbers to symbolic objects, and then call ellipke for those symbolic objects. Alternatively, use the ellipticK and ellipticE functions to compute the integrals separately.

• For most symbolic (exact) numbers, ellipke returns results using the ellipticK and ellipticE functions. You can approximate such results with floating-point numbers using vpa.

• If m is a vector or a matrix, then [K,E] = ellipke(m) returns the complete elliptic integrals of the first and second kinds, evaluated for each element of m.

## Alternatives

You can use ellipticK and ellipticE to compute elliptic integrals of the first and second kinds separately.

## 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.

## Version History

Introduced in R2013a