Complete elliptic integrals of first and second kind
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 = 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')
The default value of
eps. Find the runtime with the default value for arbitrary
tol by a factor of thousand and find the runtime. Compare the runtimes.
tic ellipke(0.904561) toc tic ellipke(0.904561,eps*1000) toc
ans = 2.6001 Elapsed time is 0.049308 seconds. ans = 2.6001 Elapsed time is 0.003492 seconds.
ellipke runs significantly faster when tolerance is significantly increased.
M— Input array
Input array, specified as a scalar, vector, matrix, or multidimensional
M is limited to values 0≤m≤1.
tol— Accuracy of result
eps(default) | nonnegative real number
Accuracy of result, specified as a nonnegative real number.
The default value is
K— Complete elliptic integral of first kind
Complete elliptic integral of the first kind, returned as a scalar, vector, matrix, or multidimensional array.
E— Complete elliptic integral of second kind
Complete elliptic integral of the second kind, returned as a scalar, vector, matrix, or multidimensional array.
The complete elliptic integral of the first kind is
where m is the first argument of
The complete elliptic integral of the second kind is
Some definitions of the elliptic functions use the elliptical modulus k or modular angle α instead of the parameter m. They are related by
 Abramowitz, M., and I. A. Stegun. Handbook of Mathematical Functions. Dover Publications, 1965.