EllipticK[m]
gives the complete elliptic integral of the first kind
.
EllipticK
EllipticK[m]
gives the complete elliptic integral of the first kind
.
Details
- Mathematical function, suitable for both symbolic and numerical manipulation.
- EllipticK is given in terms of the incomplete elliptic integral of the first kind by
. - EllipticK[m] has a branch cut discontinuity in the complex m plane running from
to
. - For certain special arguments, EllipticK automatically evaluates to exact values.
- EllipticK can be evaluated to arbitrary numerical precision.
- EllipticK automatically threads over lists.
- EllipticK can be used with Interval and CenteredInterval objects. »
Examples
open all close allBasic Examples (5)
EllipticK[0.5]Plot over a subset of the reals:
Plot[EllipticK[x], {x, -1, 1}]Plot over a subset of the complexes:
ComplexPlot3D[EllipticK[z], {z, -2 - 2I, 2 + 2I}, PlotLegends -> Automatic]Series expansion at the origin:
Series[EllipticK[x], {x, 0, 5}]Series expansion at Infinity:
Series[EllipticK[x], {x, ∞, 2}]//NormalScope (38)
Numerical Evaluation (5)
N[EllipticK[8 / 10], 50]The precision of the output tracks the precision of the input:
EllipticK[0.999999999999999990000000000000000]Evaluate numerically for complex arguments:
EllipticK[2.5 + I]Evaluate EllipticK efficiently at high precision:
EllipticK[0.4`500]//TimingEllipticK[0.4`100000];//TimingCompute worst-case guaranteed intervals using Interval and CenteredInterval objects:
EllipticK[Interval[{0.4, 0.5}]]EllipticK[CenteredInterval[4, 1 / 100]]Or compute average-case statistical intervals using Around:
EllipticK[ Around[1 / 2, 0.01]]Compute the elementwise values of an array:
EllipticK[{{-1, 0}, {1 / 2, -1}}]//FunctionExpandOr compute the matrix EllipticK function using MatrixFunction:
MatrixFunction[EllipticK, {{-1, 0}, {1 / 2, -1}}]//FunctionExpandSpecific Values (5)
Simple exact values are generated automatically:
{EllipticK[0], EllipticK[1]}Some exact values in terms of Gamma after applying FunctionExpand:
{EllipticK[-1], EllipticK[1 / 2]}//FunctionExpandFind directional limiting values at branch cuts:
Limit[EllipticK[2 + ε I], ε -> 0, Direction -> 1]Limit[EllipticK[2 + ε I], ε -> 0, Direction -> -1]EllipticK[Infinity]Find the root of the equation
:
f[m_] := EllipticK[m] - 2;
xzero = Solve[f[m] == 0 && 0.5 < m < 1, m][[1, 1, 2]]//QuietPlot[f[m], {m, -1, 1}, Epilog -> Style[Point[{xzero, f[xzero]}], PointSize[Large], Red]]Visualization (2)
Plot EllipticK:
Plot[{EllipticK[m]}, {m, -2, 1}]ComplexContourPlot[Re[EllipticK[z]], {z, -5 - 5I, 5 + 5I}, IconizedObject[«PlotOptions»]]ComplexContourPlot[Im[EllipticK[z]], {z, -5 - 5I, 5 + 5I}, IconizedObject[«PlotOptions»]]Function Properties (9)
EllipticK is defined for all real values less than 1:
FunctionDomain[EllipticK[m], m]EllipticK takes all real positive values:
FunctionRange[EllipticK[m], m, y]//QuietEllipticK is not an analytic function:
FunctionAnalytic[EllipticK[m], m]Has both singularities and discontinuities:
FunctionSingularities[EllipticK[m], m]//QuietFunctionDiscontinuities[EllipticK[m], m]//QuietEllipticK is not a meromorphic function:
FunctionMeromorphic[EllipticK[m], m]EllipticK is nondecreasing on its domain:
FunctionMonotonicity[{EllipticK[m], m < 1}, m]EllipticK is injective:
FunctionInjective[EllipticK[m], m]Plot[{EllipticK[m], 2}, {m, -2, 2}]EllipticK is not surjective:
FunctionSurjective[EllipticK[m], m]Plot[{EllipticK[m], -2}, {m, -2, 2}]EllipticK is non-negative on its domain:
FunctionSign[{EllipticK[m], m < 1}, m]EllipticK is convex on its domain:
FunctionConvexity[{EllipticK[m], m < 1}, m]Differentiation (3)
D[EllipticK[m], m]Table[D[EllipticK[m], {m, n}], {n, 1, 3}]//FullSimplifyPlot[Evaluate[%], {m, -1, 1}, PlotLegends -> Table[Inactive[D][EllipticK[m], {m, k}], {k, Length[%]}]]D[EllipticK[m], {m, n}]Integration (3)
Indefinite integral of EllipticK:
Integrate[EllipticK[m], m]Definite integral over an interval lying on the branch cut:
Integrate[EllipticK[m], {m, 1, 2}]Integrate[z^αEllipticK[z], z]Integrate[(z EllipticK[z^2]/(1 - z^2)^3 / 2), z]Series Expansions (3)
Taylor expansion for EllipticK:
Series[EllipticK[m], {m, 0, 3}]Plot the first three approximations for EllipticK around
:
terms = Normal@Table[Series[EllipticK[m], {m, 0, n}], {n, 1, 3}];
Plot[{EllipticK[m], terms}, {m, -2, 2}]Series expansions at branch points:
Series[EllipticK[x], {x, 1, 1}]EllipticK can be applied to power series:
EllipticK[Exp[x] - 1 + O[x] ^ 4]Integral Transforms (3)
Compute the Laplace transform using LaplaceTransform:
LaplaceTransform[EllipticK[-t], t, s]MellinTransform[EllipticK[-t], t, s ]HankelTransform[EllipticK[-r], r, s ]Function Representations (5)
Relation to other elliptic integrals:
EllipticPi[0, m]EllipticF[(π/2), m]Relation to the LegendreP:
(π/2)LegendreP[-(1/2), 1 - 2 m]//FullSimplifyRepresent in terms of MeijerG using MeijerGReduce:
MeijerGReduce[EllipticK[x], x]Activate[%]EllipticK can be represented as a DifferentialRoot:
DifferentialRootReduce[EllipticK[m], m]TraditionalForm formatting:
EllipticK[m]//TraditionalFormApplications (7)
Small-angle approximation to the period of a pendulum:
Series[4Sqrt[(d/g)]EllipticK[Sin[(α/2)]^2], {α, 0, 2}]Plot the period versus the initial angle:
Plot[EllipticK[Sin[(α/2)] ^ 2], {α, 0, Pi}, AxesOrigin -> {0, EllipticK[0]}]Vector potential due to a circular current flow, in cylindrical coordinates:
A = -2(((r + R)^2 + z^2) EllipticE[(4 r R/(r + R)^2 + z^2)] - (r^2 + R^2 + z^2) EllipticK[(4 r R/(r + R)^2 + z^2)]) / (r R Sqrt[(r + R)^2 + z^2]);The components of the magnetic field:
Bz = D[r A, r] / r//FullSimplifyBr = -D[A, z]//FullSimplifyPlot the magnitude of the magnetic field:
Plot3D[Sqrt[Br^2 + Bz^2] /. R -> 1, {r, 0.001, 3 / 2}, {z, -1, 1}]Resistance between the origin and the point
in an infinite 3D lattice of unit resistors:
ρ[n_] := (1/π^2)NIntegrate[EllipticK[((2/3 - Cos[x]))^2](2 - Cos[n x]/3 - Cos[x]), {x, 0, Pi}]DiscretePlot[ρ[n], {n, 50}, PlotRange -> All]Energy for the Onsager solution of the Ising model:
ℰ = With[{β = (1/Subscript[k, B]T)}, -2 n J Tanh[2 β J] - n J (Sinh[2 β J]^2 - 1/Sinh[2β J]Cosh[2β J])((2/π)EllipticK[(2 (Sinh[2β J]/Cosh[2β J]^2))^2] - 1)];Plot[Evaluate[D[ℰ, T] /. {n -> 1, J -> 1, Subscript[k, B] -> 1}], {T, 0.1, 4}, AxesOrigin -> {0, 0}]Find the critical temperature:
Select[Solve[1 / D[ℰ, T] == 0, T], (Subscript[k, B]T / J /. #) > 0&]//QuietFindRoot[Re[(EllipticK[1 - z^2]/EllipticK[z^2])] == Sqrt[2], {z, 1 / 2}, WorkingPrecision -> 50](z /. %) - (Sqrt[2] - 1)Current flow in a rectangular conducting sheet with voltage applied at a pair of opposite corners:
flow[m_] = (NevilleThetaD[x, m] NevilleThetaD[y, 1 - m] NevilleThetaS[x, m] NevilleThetaS[y, 1 - m]) / (NevilleThetaC[x, m] NevilleThetaC[y, 1 - m] NevilleThetaN[x, m] NevilleThetaN[y, 1 - m]);Plot the flow lines with bounds defined via EllipticK:
With[{m = 0.4}, ContourPlot[flow[m], {x, 0, EllipticK[m]}, {y, 0, EllipticK[1 - m]}, ContourShading -> False, MaxRecursion -> 1, Contours -> {0.02, 0.13, 0.3, 0.54, 0.9, 1.46, 2.53, 5.17, 28.4}]]Construct lowpass elliptic filter for analog signal:
𝒩 = 5;ωPass = 4.8;ℊPass = 0.92;ℊStop = 0.08;Compute filter ripple parameters and associate elliptic function parameter:
ϵp = Sqrt[ℊPass^-2 - 1];ϵs = Sqrt[ℊStop^-2 - 1];
m1 = (ϵp / ϵs)^2;
K1 = EllipticK[m1];
K1p = EllipticK[1 - m1];Use elliptic degree equation to find the ratio of the pass and the stop frequencies:
us = Range[1, 2⌊(𝒩/2)⌋ - 1, 2] / 𝒩;
m = 1 - (1 - m1) ^ 𝒩 Apply[Times, JacobiSN[us K1p, 1 - m1] ^ 8]Compute corresponding stop frequency and elliptic parameters:
K = EllipticK[m];Kp = EllipticK[1 - m];
ωStop = ωPass / Sqrt[m]Compute ripple locations and poles and zeros of the transfer function:
ζs = JacobiCD[us K, m];
zeros = I ωStop / ζs;Compute poles of the transfer function:
Subscript[ν, 0] = (1/𝒩 K1)InverseJacobiSC[(1/ϵp), 1 - m1];
poles = ωPass I JacobiCD[(us - I Subscript[ν, 0])K, m];Assemble the transfer function:
H[ω_] = Piecewise[{{ℊPass, Mod[𝒩, 2] == 0}, {(1/1 + I ω / ωPass JacobiCS[Subscript[ν, 0] K, 1 - m]), Mod[𝒩, 2] == 1}}] Apply[Times, ((1 - I ω / zeros)(1 - I ω / Conjugate[zeros])/(1 - I ω / poles)(1 - I ω / Conjugate[poles]))];Plot[Abs[H[ω]], {ω, 0, 8}, PlotRange -> All, Epilog -> {Pink, Dashed, Line[{{0, ℊPass}, {ωPass, ℊPass}, {ωPass, ℊStop}}], Line[{{ωStop, ℊPass}, {ωStop, ℊStop}, {10, ℊStop}}]}]Compare with the result of EllipticFilterModel:
tf = EllipticFilterModel[{"Lowpass", {ωPass, ωStop}, -20Log10[{ℊPass, ℊStop}]}];Plot[Abs[tf[I ω]], {ω, 0, 8}]Properties & Relations (4)
This shows the branch cuts of the EllipticK function:
Plot3D[Im[EllipticK[x + I y]], {x, -2, 2}, {y, -2, 2}]Numerically find a root of a transcendental equation:
FindRoot[EllipticK[z]^2 - 5 EllipticK[z + 2] + z == 6, {z, 10}]Solve a differential equation:
DSolve[z (1 - z) w''[z] + (1 - 2 z) w'[z] - w[z] / 4 == 0, w[z], z]//SimplifyEllipticK is a particular case of various mathematical functions:
{LegendreP[-(1/2), 1 - 2 z], AppellF1[(1/2), (1/2), (1/2), (3/2), 1, z ], EllipticF[(π/2), z], EllipticPi[0, (π/2), z], MeijerG[{{(1/2), (1/2)}, {}}, {{0}, {0}}, -z]}Possible Issues (3)
Machine-precision evaluation can result in numerically inaccurate answers near branch cuts:
EllipticK[ 2 - I ((Pi + 1) ^ 2 - Pi ^ 2 - 2Pi - 1 - Exp[-Pi ^ 4])] // NEllipticK[2 - I ((Pi + 1) ^ 2 - Pi ^ 2 - 2Pi - 1 - Exp[-Pi ^ 4])] //N[#, 100]& // NThe defining integral converges only under additional conditions:
Integrate[1 / Sqrt[1 - m Sin[t] ^ 2], {t, 0, Pi / 2}]Different argument conventions exist that result in modified results:
Integrate[1 / Sqrt[1 - k ^ 2 Sin[t] ^ 2], {t, 0, Pi / 2}, Assumptions -> k ^ 2 < 1]Neat Examples (2)
Probability that a random walker in a 3D cubic lattice returns to the origin:
p = 1 - (π^2/72)(6 + 2 Sqrt[3] + Sqrt[6]) EllipticK[35 + 24 Sqrt[2] - 20 Sqrt[3] - 14 Sqrt[6]]^-2 //NCarry out a modeling run of 1000 walks and count how many it returns to the origin:
maxSteps = 500;
BlockRandom[SeedRandom[2021];
start = {0, 0, 0};Count[Table[walkerPosition = start;steps = 0;While[steps == 0 || (steps < maxSteps && walkerPosition =!= start), steps++;walkerPosition = walkerPosition + {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}[[RandomInteger[{1, 6}]]]];steps, {1000}], _ ? (# < maxSteps&)]]Compare with the expected count at
:
With[{countDist = BinomialDistribution[1000, p]}, Around[Mean[countDist], 2StandardDeviation[countDist]]
]Show[Plot3D[Evaluate[Table[Im[EllipticK[x + I y] - j 2 I EllipticK[1 - (x + I y)]], {j, -2, 2}]], {x, -9, 9}, {y, ##}, ClippingStyle -> None, PlotStyle -> Opacity[0.6], Mesh -> False, BoxRatios -> {1, 1, 1}, MaxRecursion -> 5, PlotRange -> {All, All, {-9, 9}}]&@@@{{-9, -10 ^ -6}, {10 ^ -6, 9}}]See Also
EllipticF EllipticE EllipticPi JacobiZeta EllipticNomeQ ArithmeticGeometricMean CarlsonRK
Function Repository: BulirschCEL BulirschEL2 BulirschEL1 HeumanLambda EllipticRationalR EpsteinHubbellOmega
Tech Notes
Related Guides
History
Introduced in 1988 (1.0) | Updated in 2021 (13.0) ▪ 2022 (13.1)
Text
Wolfram Research (1988), EllipticK, Wolfram Language function, https://reference.wolfram.com/language/ref/EllipticK.html (updated 2022).
CMS
Wolfram Language. 1988. "EllipticK." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/EllipticK.html.
APA
Wolfram Language. (1988). EllipticK. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EllipticK.html
BibTeX
@misc{reference.wolfram_2026_elliptick, author="Wolfram Research", title="{EllipticK}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/EllipticK.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_elliptick, organization={Wolfram Research}, title={EllipticK}, year={2022}, url={https://reference.wolfram.com/language/ref/EllipticK.html}, note=[Accessed: 13-June-2026]}