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.
ans = 2.6001
Elapsed time is 0.412887 seconds.
ans = 2.6001
Elapsed time is 0.028556 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.
backgroundPoolor accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.