scipy.special.elliprc#
- scipy.special.elliprc(x, y, out=None) = <wrapped_ufunc 'elliprc'>#
Degenerate symmetric elliptic integral.
The function RC is defined as [1]
\[R_{\mathrm{C}}(x, y) = \frac{1}{2} \int_0^{+\infty} (t + x)^{-1/2} (t + y)^{-1} dt = R_{\mathrm{F}}(x, y, y)\]- Parameters:
- x, yarray_like
Real or complex input parameters. x can be any number in the complex plane cut along the negative real axis. y must be non-zero.
- outndarray, optional
Optional output array for the function values
- Returns:
- Rscalar or ndarray
Value of the integral. If y is real and negative, the Cauchy principal value is returned. If both of x and y are real, the return value is real. Otherwise, the return value is complex.
See also
Notes
RC is a degenerate case of the symmetric integral RF:
elliprc(x, y) == elliprf(x, y, y). It is an elementary function rather than an elliptic integral.The code implements Carlson’s algorithm based on the duplication theorems and series expansion up to the 7th order. [2]
Added in version 1.8.0.
Array API Standard Support
elliprchas 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.elliprcdoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
References
[1]B. C. Carlson, ed., Chapter 19 in “Digital Library of Mathematical Functions,” NIST, US Dept. of Commerce. https://dlmf.nist.gov/19.16.E6
[2]B. C. Carlson, “Numerical computation of real or complex elliptic integrals,” Numer. Algorithm, vol. 10, no. 1, pp. 13-26, 1995. DOI:10.1007/BF02198293. https://arxiv.org/abs/math/9409227
Examples
Basic homogeneity property:
>>> import numpy as np >>> from scipy.special import elliprc
>>> x = 1.2 + 3.4j >>> y = 5. >>> scale = 0.3 + 0.4j >>> elliprc(scale*x, scale*y) (0.5484493976710874-0.4169557678995833j)
>>> elliprc(x, y)/np.sqrt(scale) (0.5484493976710874-0.41695576789958333j)
When the two arguments coincide, the integral is particularly simple:
>>> x = 1.2 + 3.4j >>> elliprc(x, x) (0.4299173120614631-0.3041729818745595j)
>>> 1/np.sqrt(x) (0.4299173120614631-0.30417298187455954j)
Another simple case: the first argument vanishes:
>>> y = 1.2 + 3.4j >>> elliprc(0, y) (0.6753125346116815-0.47779380263880866j)
>>> np.pi/2/np.sqrt(y) (0.6753125346116815-0.4777938026388088j)
When x and y are both positive, we can express \(R_C(x,y)\) in terms of more elementary functions. For the case \(0 \le x < y\),
>>> x = 3.2 >>> y = 6. >>> elliprc(x, y) 0.44942991498453444
>>> np.arctan(np.sqrt((y-x)/x))/np.sqrt(y-x) 0.44942991498453433
And for the case \(0 \le y < x\),
>>> x = 6. >>> y = 3.2 >>> elliprc(x,y) 0.4989837501576147
>>> np.log((np.sqrt(x)+np.sqrt(x-y))/np.sqrt(y))/np.sqrt(x-y) 0.49898375015761476