Main Content

ellipke

Complete elliptic integrals of first and second kind

Description

K = ellipke(M) returns the complete elliptic integral of the first kind for each element in M.

[K,E] = ellipke(M) returns the complete elliptic integral of the first and second kind.

example

[K,E] = ellipke(M,tol) computes the complete elliptic integral to accuracy tol. The default value of tol is eps. Increase tol for a less accurate but more quickly computed answer.

example

Examples

collapse all

Find the complete elliptic integrals of the first and second kind for M = 0.5.

M = 0.5;
[K,E] = ellipke(M)
K = 
1.8541
E = 
1.3506

Plot the complete elliptic integrals of the first and second kind for the allowed range of M.

M = 0:0.01:1;
[K,E] = ellipke(M);
plot(M,K,M,E)
grid on
xlabel('M')
title('Complete Elliptic Integrals of First and Second Kind')
legend('First kind','Second kind')

Figure contains an axes object. The axes object with title Complete Elliptic Integrals of First and Second Kind, xlabel M contains 2 objects of type line. These objects represent First kind, Second kind.

The default value of tol is eps. Find the runtime with the default value for arbitrary M using tic and toc. Increase tol by a factor of thousand and find the runtime. Compare the runtimes.

tic
ellipke(0.904561)
ans = 
2.6001
toc
Elapsed time is 0.021529 seconds.
tic
ellipke(0.904561,eps*1000)
ans = 
2.6001
toc
Elapsed time is 0.010459 seconds.

ellipke runs significantly faster when tolerance is significantly increased.

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array. M is limited to values 0≤m≤1.

Data Types: single | double

Accuracy of result, specified as a nonnegative real number. The default value is eps.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Complete elliptic integral of the first kind, returned as a scalar, vector, matrix, or multidimensional array.

Complete elliptic integral of the second kind, returned as a scalar, vector, matrix, or multidimensional array.

More About

collapse all

References

[1] Abramowitz, M., and I. A. Stegun. Handbook of Mathematical Functions. Dover Publications, 1965.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also