scipy.special.ellipkinc#
- scipy.special.ellipkinc(phi, m, out=None) = <wrapped_ufunc 'ellipkinc'>#
Incomplete elliptic integral of the first kind.
This function is defined as
\[K(\phi, m) = \int_0^{\phi} [1 - m \sin(t)^2]^{-1/2} dt\]This function is also called \(F(\phi, m)\).
- Parameters:
- phiarray_like
amplitude of the elliptic integral
- marray_like
parameter of the elliptic integral
- outndarray, optional
Optional output array for the function values
- Returns:
- Kscalar or ndarray
Value of the elliptic integral
See also
Notes
Wrapper for the Cephes [1] routine ellik. The computation is carried out using the arithmetic-geometric mean algorithm.
The parameterization in terms of \(m\) follows that of section 17.2 in [2]. Other parameterizations in terms of the complementary parameter \(1 - m\), modular angle \(\sin^2(\alpha) = m\), or modulus \(k^2 = m\) are also used, so be careful that you choose the correct parameter.
The Legendre K incomplete integral (or F integral) is related to Carlson’s symmetric R_F function [3]. Setting \(c = \csc^2\phi\),
\[F(\phi, m) = R_F(c-1, c-k^2, c) .\]Array API Standard Support
ellipkinchas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but typically none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.ellipkincdoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
References
[1]Cephes Mathematical Functions Library, http://www.netlib.org/cephes/
[2]Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.
[3]NIST Digital Library of Mathematical Functions. http://dlmf.nist.gov/, Release 1.0.28 of 2020-09-15. See Sec. 19.25(i) https://dlmf.nist.gov/19.25#i
Examples
>>> from scipy.special import ellipkinc >>> phi = 0.3 >>> m = 0.8 >>> u = ellipkinc(phi, m) >>> u np.float64(0.30365239221539364)
The result should be consistent with the known relations for the Jacobi elliptic functions:
sn(u|m) = sin(phi)andcn(u|m) = cos(phi).>>> from math import cos, pi, sin >>> from scipy.special import ellipj >>> sn, cn, _, _ = ellipj(u, m) >>> sn, sin(phi) (np.float64(0.2955202066613395), 0.29552020666133955) >>> cn, cos(phi) (np.float64(0.9553364891256061), 0.955336489125606)
For \(\phi=\pi/2\), the incomplete elliptic integral should equal the complete elliptic integral.
>>> from scipy.special import ellipk >>> ellipkinc(pi/2, m), ellipk(m) (np.float64(2.257205326820854), np.float64(2.257205326820854))