Elliptic Integrals
Overview
Elliptic integrals are a central class of special functions that arise when integrating square-root expressions tied to conic sections, pendulum motion, wave propagation, and geometric arc lengths. They appear in both pure mathematics and applied engineering whenever trigonometric substitutions lead to non-elementary antiderivatives. In practical modeling, elliptic integrals provide numerically stable ways to evaluate quantities that would otherwise require expensive numerical quadrature at runtime.
Core Concepts: This category combines the classical Legendre forms (complete and incomplete integrals of the first and second kinds), Jacobi elliptic functions, and Carlson symmetric forms. The complete integrals evaluate over [0,\pi/2], while incomplete integrals stop at a general amplitude \phi. Jacobi functions invert incomplete first-kind integrals and generalize circular/hyperbolic trigonometric behavior through the parameter m. Carlson forms rewrite many elliptic expressions into symmetric multivariable kernels that improve algorithmic robustness and composability.
Implementation: The functions are implemented with SciPy Special, specifically routines in scipy.special backed by established numerical methods for special functions. SciPy is a core scientific Python library for optimization, integration, linear algebra, statistics, and special-function evaluation. These wrappers expose that reliability in a spreadsheet-oriented workflow while preserving familiar notation from mathematical references.
The primary Legendre complete integrals are ELLIPE, ELLIPK, and ELLIPKM1. ELLIPE computes the complete second-kind integral E(m), while ELLIPK computes the complete first-kind integral K(m), a quantity that grows rapidly as m\to 1^-. ELLIPKM1 provides a specialized evaluation path for the near-singular regime around m=1, where naive formulas can lose precision. Together, these functions support high-accuracy evaluation in mechanics, electromagnetics, and geometric parameterization problems.
For amplitude-dependent quantities, ELLIPEINC and ELLIPKINC evaluate incomplete second- and first-kind elliptic integrals. These functions model partial trajectories and phase-limited dynamics, such as finite-angle pendulum motion and partial arc traversal. In notation, F(\phi,m)=\int_0^{\phi}\frac{dt}{\sqrt{1-m\sin^2 t}},\qquad E(\phi,m)=\int_0^{\phi}\sqrt{1-m\sin^2 t}\,dt. Because both depend on amplitude and parameter, they are frequently used as building blocks in inverse problems and parameter fitting.
ELLIPJ returns the Jacobi elliptic tuple (\mathrm{sn},\mathrm{cn},\mathrm{dn},\phi) for argument u and parameter m. These functions unify oscillatory and localized behavior in nonlinear ODEs, making them useful in soliton models, nonlinear wave equations, and periodic-orbit analysis. In many workflows, ELLIPJ complements ELLIPKINC by moving between amplitude and argument representations. This pairing is especially practical when converting between geometric phase and time-like integration variables.
The Carlson symmetric family includes ELLIPRC, ELLIPRD, ELLIPRF, ELLIPRG, and ELLIPRJ. These kernels represent degenerate and general symmetric elliptic integrals and are widely used to express Legendre forms and many application-specific formulas in a numerically stable way. For example, R_F and R_D appear in geodesy and potential calculations, while R_J captures higher-order pole structure through an additional parameter. Using this family enables consistent implementations across edge cases, including parameter ranges where direct classical formulas become ill-conditioned.
ELLIPE
The complete elliptic integral of the second kind is a special function that appears in arc-length and energy-style expressions involving elliptic geometry.
E(m)=\int_0^{\pi/2}\sqrt{1-m\sin^2(t)}\,dt
This wrapper evaluates E(m) for a scalar real parameter.
Excel Usage
=ELLIPE(m)
m(float, required): Elliptic parameter (dimensionless).
Returns (float): Complete elliptic integral of the second kind at parameter m.
Example 1: Second-kind complete integral at zero parameter
Inputs:
| m |
|---|
| 0 |
Excel formula:
=ELLIPE(0)
Expected output:
1.5708
Example 2: Second-kind complete integral at half parameter
Inputs:
| m |
|---|
| 0.5 |
Excel formula:
=ELLIPE(0.5)
Expected output:
1.35064
Example 3: Second-kind complete integral near one
Inputs:
| m |
|---|
| 0.99 |
Excel formula:
=ELLIPE(0.99)
Expected output:
1.01599
Example 4: Second-kind complete integral at negative parameter
Inputs:
| m |
|---|
| -0.5 |
Excel formula:
=ELLIPE(-0.5)
Expected output:
1.75177
Python Code
Show Code
from scipy.special import ellipe as scipy_ellipe
def ellipe(m):
"""
Compute the complete elliptic integral of the second kind.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipe.html
This example function is provided as-is without any representation of accuracy.
Args:
m (float): Elliptic parameter (dimensionless).
Returns:
float: Complete elliptic integral of the second kind at parameter m.
"""
try:
return float(scipy_ellipe(m))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPEINC
The incomplete elliptic integral of the second kind integrates the second-kind elliptic integrand up to amplitude \phi.
E(\phi,m)=\int_0^{\phi}\sqrt{1-m\sin^2(t)}\,dt
This wrapper evaluates E(\phi,m) for scalar real inputs.
Excel Usage
=ELLIPEINC(phi, m)
phi(float, required): Amplitude angle in radians.m(float, required): Elliptic parameter (dimensionless).
Returns (float): Incomplete elliptic integral of the second kind at amplitude phi and parameter m.
Example 1: Second-kind incomplete integral with zero amplitude
Inputs:
| phi | m |
|---|---|
| 0 | 0.5 |
Excel formula:
=ELLIPEINC(0, 0.5)
Expected output:
0
Example 2: Second-kind incomplete integral at moderate amplitude and parameter
Inputs:
| phi | m |
|---|---|
| 1 | 0.5 |
Excel formula:
=ELLIPEINC(1, 0.5)
Expected output:
0.92733
Example 3: Second-kind incomplete integral with negative amplitude
Inputs:
| phi | m |
|---|---|
| -0.8 | 0.3 |
Excel formula:
=ELLIPEINC(-0.8, 0.3)
Expected output:
-0.776908
Example 4: Second-kind incomplete integral with negative parameter
Inputs:
| phi | m |
|---|---|
| 0.7 | -0.4 |
Excel formula:
=ELLIPEINC(0.7, -0.4)
Expected output:
0.720225
Python Code
Show Code
from scipy.special import ellipeinc as scipy_ellipeinc
def ellipeinc(phi, m):
"""
Compute the incomplete elliptic integral of the second kind.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipeinc.html
This example function is provided as-is without any representation of accuracy.
Args:
phi (float): Amplitude angle in radians.
m (float): Elliptic parameter (dimensionless).
Returns:
float: Incomplete elliptic integral of the second kind at amplitude phi and parameter m.
"""
try:
return float(scipy_ellipeinc(phi, m))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPJ
Jacobi elliptic functions generalize circular and hyperbolic functions and are parameterized by an argument u and parameter m. This function returns the tuple \operatorname{sn}(u|m), \operatorname{cn}(u|m), \operatorname{dn}(u|m), and amplitude \phi.
The amplitude satisfies:
u = F(\phi,m),\qquad \operatorname{sn}(u|m)=\sin(\phi),\qquad \operatorname{cn}(u|m)=\cos(\phi)
This wrapper returns all four outputs in a single 2D row suitable for Excel spill output.
Excel Usage
=ELLIPJ(u, m)
u(float, required): Real argument of the Jacobi elliptic functions.m(float, required): Elliptic parameter, typically in the range from zero to one.
Returns (list[list]): One-row array with sn, cn, dn, and amplitude ph in that order.
Example 1: Jacobi outputs at zero argument
Inputs:
| u | m |
|---|---|
| 0 | 0.5 |
Excel formula:
=ELLIPJ(0, 0.5)
Expected output:
| Result | |||
|---|---|---|---|
| 0 | 1 | 1 | 0 |
Example 2: Jacobi outputs with zero parameter
Inputs:
| u | m |
|---|---|
| 1 | 0 |
Excel formula:
=ELLIPJ(1, 0)
Expected output:
| Result | |||
|---|---|---|---|
| 0.841471 | 0.540302 | 1 | 1 |
Example 3: Jacobi outputs at moderate argument and parameter
Inputs:
| u | m |
|---|---|
| 1 | 0.5 |
Excel formula:
=ELLIPJ(1, 0.5)
Expected output:
| Result | |||
|---|---|---|---|
| 0.803002 | 0.595977 | 0.823161 | 0.932315 |
Example 4: Jacobi outputs with parameter close to one
Inputs:
| u | m |
|---|---|
| 1 | 0.99 |
Excel formula:
=ELLIPJ(1, 0.99)
Expected output:
| Result | |||
|---|---|---|---|
| 0.762448 | 0.64705 | 0.651526 | 0.867088 |
Python Code
Show Code
from scipy.special import ellipj as scipy_ellipj
def ellipj(u, m):
"""
Compute Jacobi elliptic functions sn, cn, dn and amplitude for scalar input.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipj.html
This example function is provided as-is without any representation of accuracy.
Args:
u (float): Real argument of the Jacobi elliptic functions.
m (float): Elliptic parameter, typically in the range from zero to one.
Returns:
list[list]: One-row array with sn, cn, dn, and amplitude ph in that order.
"""
try:
sn, cn, dn, ph = scipy_ellipj(u, m)
return [[float(sn), float(cn), float(dn), float(ph)]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPK
The complete elliptic integral of the first kind is a special function that appears in geometry, mechanics, and wave problems. It is defined over a parameter m and integrates over a quarter period.
K(m)=\int_0^{\pi/2}\frac{1}{\sqrt{1-m\sin^2(t)}}\,dt
This wrapper evaluates K(m) for a scalar real input using SciPy.
Excel Usage
=ELLIPK(m)
m(float, required): Elliptic parameter (dimensionless).
Returns (float): Complete elliptic integral of the first kind at parameter m.
Example 1: First-kind complete integral at zero parameter
Inputs:
| m |
|---|
| 0 |
Excel formula:
=ELLIPK(0)
Expected output:
1.5708
Example 2: First-kind complete integral at half parameter
Inputs:
| m |
|---|
| 0.5 |
Excel formula:
=ELLIPK(0.5)
Expected output:
1.85407
Example 3: First-kind complete integral at quarter parameter
Inputs:
| m |
|---|
| 0.25 |
Excel formula:
=ELLIPK(0.25)
Expected output:
1.68575
Example 4: First-kind complete integral at negative parameter
Inputs:
| m |
|---|
| -0.5 |
Excel formula:
=ELLIPK(-0.5)
Expected output:
1.41574
Python Code
Show Code
from scipy.special import ellipk as scipy_ellipk
def ellipk(m):
"""
Compute the complete elliptic integral of the first kind.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipk.html
This example function is provided as-is without any representation of accuracy.
Args:
m (float): Elliptic parameter (dimensionless).
Returns:
float: Complete elliptic integral of the first kind at parameter m.
"""
try:
return float(scipy_ellipk(m))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPKINC
The incomplete elliptic integral of the first kind accumulates the first-kind integrand up to an amplitude \phi rather than over a full quarter period.
F(\phi,m)=\int_0^{\phi}\frac{1}{\sqrt{1-m\sin^2(t)}}\,dt
This wrapper evaluates F(\phi,m) for scalar real inputs.
Excel Usage
=ELLIPKINC(phi, m)
phi(float, required): Amplitude angle in radians.m(float, required): Elliptic parameter (dimensionless).
Returns (float): Incomplete elliptic integral of the first kind at amplitude phi and parameter m.
Example 1: First-kind incomplete integral with zero amplitude
Inputs:
| phi | m |
|---|---|
| 0 | 0.5 |
Excel formula:
=ELLIPKINC(0, 0.5)
Expected output:
0
Example 2: First-kind incomplete integral at moderate amplitude and parameter
Inputs:
| phi | m |
|---|---|
| 1 | 0.5 |
Excel formula:
=ELLIPKINC(1, 0.5)
Expected output:
1.08322
Example 3: First-kind incomplete integral with negative amplitude
Inputs:
| phi | m |
|---|---|
| -0.8 | 0.3 |
Excel formula:
=ELLIPKINC(-0.8, 0.3)
Expected output:
-0.824317
Example 4: First-kind incomplete integral with negative parameter
Inputs:
| phi | m |
|---|---|
| 0.7 | -0.4 |
Excel formula:
=ELLIPKINC(0.7, -0.4)
Expected output:
0.680725
Python Code
Show Code
from scipy.special import ellipkinc as scipy_ellipkinc
def ellipkinc(phi, m):
"""
Compute the incomplete elliptic integral of the first kind.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipkinc.html
This example function is provided as-is without any representation of accuracy.
Args:
phi (float): Amplitude angle in radians.
m (float): Elliptic parameter (dimensionless).
Returns:
float: Incomplete elliptic integral of the first kind at amplitude phi and parameter m.
"""
try:
return float(scipy_ellipkinc(phi, m))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPKM1
This function evaluates the complete elliptic integral of the first kind using the complementary parameter p=1-m, which improves numerical behavior when m is close to 1.
K(m)=\int_0^{\pi/2}\frac{1}{\sqrt{1-m\sin^2(t)}}\,dt,\qquad m=1-p
This wrapper computes the same K value by accepting p directly.
Excel Usage
=ELLIPKM1(p)
p(float, required): Complementary elliptic parameter where m equals one minus p (dimensionless).
Returns (float): Complete elliptic integral of the first kind for m equals one minus p.
Example 1: Stable first-kind complete integral with p one-half
Inputs:
| p |
|---|
| 0.5 |
Excel formula:
=ELLIPKM1(0.5)
Expected output:
1.85407
Example 2: Stable first-kind complete integral with small p
Inputs:
| p |
|---|
| 0.01 |
Excel formula:
=ELLIPKM1(0.01)
Expected output:
3.69564
Example 3: Stable first-kind complete integral with p equal to one
Inputs:
| p |
|---|
| 1 |
Excel formula:
=ELLIPKM1(1)
Expected output:
1.5708
Example 4: Stable first-kind complete integral with p greater than one
Inputs:
| p |
|---|
| 2 |
Excel formula:
=ELLIPKM1(2)
Expected output:
1.31103
Python Code
Show Code
from scipy.special import ellipkm1 as scipy_ellipkm1
def ellipkm1(p):
"""
Compute the complete elliptic integral of the first kind near m equals one.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipkm1.html
This example function is provided as-is without any representation of accuracy.
Args:
p (float): Complementary elliptic parameter where m equals one minus p (dimensionless).
Returns:
float: Complete elliptic integral of the first kind for m equals one minus p.
"""
try:
return float(scipy_ellipkm1(p))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPRC
Carlson’s degenerate symmetric integral R_C is a two-argument special case of R_F and can be written as:
R_C(x,y)=\frac{1}{2}\int_0^{\infty}(t+x)^{-1/2}(t+y)^{-1}\,dt
It also satisfies R_C(x,y)=R_F(x,y,y). This wrapper evaluates R_C for scalar real inputs with nonzero y.
Excel Usage
=ELLIPRC(x, y)
x(float, required): First real parameter.y(float, required): Second real parameter; must be nonzero.
Returns (float): Value of Carlson degenerate symmetric elliptic integral RC.
Example 1: Carlson RC with positive parameters
Inputs:
| x | y |
|---|---|
| 1 | 2 |
Excel formula:
=ELLIPRC(1, 2)
Expected output:
0.785398
Example 2: Carlson RC when both parameters are equal
Inputs:
| x | y |
|---|---|
| 2 | 2 |
Excel formula:
=ELLIPRC(2, 2)
Expected output:
0.707107
Example 3: Carlson RC with zero first parameter
Inputs:
| x | y |
|---|---|
| 0 | 2 |
Excel formula:
=ELLIPRC(0, 2)
Expected output:
1.11072
Example 4: Carlson RC with fractional parameters
Inputs:
| x | y |
|---|---|
| 0.5 | 1.5 |
Excel formula:
=ELLIPRC(0.5, 1.5)
Expected output:
0.955317
Python Code
Show Code
from scipy.special import elliprc as scipy_elliprc
def elliprc(x, y):
"""
Compute Carlson's degenerate symmetric elliptic integral RC.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.elliprc.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): First real parameter.
y (float): Second real parameter; must be nonzero.
Returns:
float: Value of Carlson degenerate symmetric elliptic integral RC.
"""
try:
if y == 0:
return "Error: y must be nonzero"
return float(scipy_elliprc(x, y))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPRD
Carlson’s symmetric integral R_D is a three-argument elliptic integral that emphasizes the third argument and is used in transformations of Legendre second-kind integrals.
R_D(x,y,z)=\frac{3}{2}\int_0^{\infty}[(t+x)(t+y)]^{-1/2}(t+z)^{-3/2}\,dt
This wrapper evaluates R_D for scalar real inputs with nonzero z.
Excel Usage
=ELLIPRD(x, y, z)
x(float, required): First nonnegative real parameter.y(float, required): Second nonnegative real parameter.z(float, required): Third real parameter and weighting pole location; must be nonzero.
Returns (float): Value of Carlson symmetric elliptic integral RD.
Example 1: Carlson RD with positive parameters
Inputs:
| x | y | z |
|---|---|---|
| 1 | 2 | 3 |
Excel formula:
=ELLIPRD(1, 2, 3)
Expected output:
0.29046
Example 2: Carlson RD with zero first parameter
Inputs:
| x | y | z |
|---|---|---|
| 0 | 2 | 1 |
Excel formula:
=ELLIPRD(0, 2, 1)
Expected output:
1.79721
Example 3: Carlson RD when all parameters are equal and nonzero
Inputs:
| x | y | z |
|---|---|---|
| 2 | 2 | 2 |
Excel formula:
=ELLIPRD(2, 2, 2)
Expected output:
0.353553
Example 4: Carlson RD with fractional parameters
Inputs:
| x | y | z |
|---|---|---|
| 0.5 | 1.5 | 2.5 |
Excel formula:
=ELLIPRD(0.5, 1.5, 2.5)
Expected output:
0.439501
Python Code
Show Code
from scipy.special import elliprd as scipy_elliprd
def elliprd(x, y, z):
"""
Compute Carlson's symmetric elliptic integral RD.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.elliprd.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): First nonnegative real parameter.
y (float): Second nonnegative real parameter.
z (float): Third real parameter and weighting pole location; must be nonzero.
Returns:
float: Value of Carlson symmetric elliptic integral RD.
"""
try:
if z == 0:
return "Error: z must be nonzero"
return float(scipy_elliprd(x, y, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPRF
Carlson’s symmetric integral R_F is a three-argument elliptic integral used to express Legendre forms in a numerically stable symmetric representation.
R_F(x,y,z)=\frac{1}{2}\int_0^{\infty}[(t+x)(t+y)(t+z)]^{-1/2}\,dt
This wrapper evaluates R_F for scalar real inputs in its valid domain.
Excel Usage
=ELLIPRF(x, y, z)
x(float, required): First nonnegative real parameter.y(float, required): Second nonnegative real parameter.z(float, required): Third nonnegative real parameter.
Returns (float): Value of Carlson symmetric elliptic integral RF.
Example 1: Carlson RF with positive parameters
Inputs:
| x | y | z |
|---|---|---|
| 1 | 2 | 3 |
Excel formula:
=ELLIPRF(1, 2, 3)
Expected output:
0.726946
Example 2: Carlson RF with one zero parameter
Inputs:
| x | y | z |
|---|---|---|
| 0 | 1 | 2 |
Excel formula:
=ELLIPRF(0, 1, 2)
Expected output:
1.31103
Example 3: Carlson RF when all parameters are equal
Inputs:
| x | y | z |
|---|---|---|
| 2 | 2 | 2 |
Excel formula:
=ELLIPRF(2, 2, 2)
Expected output:
0.707107
Example 4: Carlson RF with fractional parameters
Inputs:
| x | y | z |
|---|---|---|
| 0.5 | 1.5 | 2.5 |
Excel formula:
=ELLIPRF(0.5, 1.5, 2.5)
Expected output:
0.861996
Python Code
Show Code
from scipy.special import elliprf as scipy_elliprf
def elliprf(x, y, z):
"""
Compute Carlson's completely symmetric elliptic integral RF.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.elliprf.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): First nonnegative real parameter.
y (float): Second nonnegative real parameter.
z (float): Third nonnegative real parameter.
Returns:
float: Value of Carlson symmetric elliptic integral RF.
"""
try:
return float(scipy_elliprf(x, y, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPRG
Carlson’s symmetric integral R_G is a three-argument second-kind symmetric form that complements R_F and R_D in elliptic-integral identities.
R_G(x,y,z)=\frac{1}{4}\int_0^{\infty}[(t+x)(t+y)(t+z)]^{-1/2}\left(\frac{x}{t+x}+\frac{y}{t+y}+\frac{z}{t+z}\right)t\,dt
This wrapper evaluates R_G for scalar real inputs.
Excel Usage
=ELLIPRG(x, y, z)
x(float, required): First nonnegative real parameter.y(float, required): Second nonnegative real parameter.z(float, required): Third nonnegative real parameter.
Returns (float): Value of Carlson completely symmetric elliptic integral RG.
Example 1: Carlson RG with positive parameters
Inputs:
| x | y | z |
|---|---|---|
| 1 | 2 | 3 |
Excel formula:
=ELLIPRG(1, 2, 3)
Expected output:
1.40185
Example 2: Carlson RG with one zero parameter
Inputs:
| x | y | z |
|---|---|---|
| 0 | 2 | 2 |
Excel formula:
=ELLIPRG(0, 2, 2)
Expected output:
1.11072
Example 3: Carlson RG when all parameters are equal
Inputs:
| x | y | z |
|---|---|---|
| 2 | 2 | 2 |
Excel formula:
=ELLIPRG(2, 2, 2)
Expected output:
1.41421
Example 4: Carlson RG with fractional parameters
Inputs:
| x | y | z |
|---|---|---|
| 0.5 | 1.5 | 2.5 |
Excel formula:
=ELLIPRG(0.5, 1.5, 2.5)
Expected output:
1.20486
Python Code
Show Code
from scipy.special import elliprg as scipy_elliprg
def elliprg(x, y, z):
"""
Compute Carlson's completely symmetric elliptic integral RG.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.elliprg.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): First nonnegative real parameter.
y (float): Second nonnegative real parameter.
z (float): Third nonnegative real parameter.
Returns:
float: Value of Carlson completely symmetric elliptic integral RG.
"""
try:
return float(scipy_elliprg(x, y, z))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
ELLIPRJ
Carlson’s symmetric integral R_J is a four-argument elliptic integral associated with third-kind behavior and a simple pole at p.
R_J(x,y,z,p)=\frac{3}{2}\int_0^{\infty}[(t+x)(t+y)(t+z)]^{-1/2}(t+p)^{-1}\,dt
This wrapper evaluates R_J for scalar real inputs with nonzero p.
Excel Usage
=ELLIPRJ(x, y, z, p)
x(float, required): First nonnegative real parameter.y(float, required): Second nonnegative real parameter.z(float, required): Third nonnegative real parameter.p(float, required): Pole parameter and fourth argument; must be nonzero.
Returns (float): Value of Carlson symmetric elliptic integral RJ.
Example 1: Carlson RJ with positive parameters
Inputs:
| x | y | z | p |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
Excel formula:
=ELLIPRJ(1, 2, 3, 4)
Expected output:
0.239848
Example 2: Carlson RJ with p equal to z
Inputs:
| x | y | z | p |
|---|---|---|---|
| 1 | 2 | 3 | 3 |
Excel formula:
=ELLIPRJ(1, 2, 3, 3)
Expected output:
0.29046
Example 3: Carlson RJ with one zero among x y z
Inputs:
| x | y | z | p |
|---|---|---|---|
| 0 | 2 | 3 | 4 |
Excel formula:
=ELLIPRJ(0, 2, 3, 4)
Expected output:
0.421143
Example 4: Carlson RJ with fractional parameters
Inputs:
| x | y | z | p |
|---|---|---|---|
| 0.5 | 1.5 | 2.5 | 3.5 |
Excel formula:
=ELLIPRJ(0.5, 1.5, 2.5, 3.5)
Expected output:
0.348748
Python Code
Show Code
from scipy.special import elliprj as scipy_elliprj
def elliprj(x, y, z, p):
"""
Compute Carlson's symmetric elliptic integral RJ.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.elliprj.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): First nonnegative real parameter.
y (float): Second nonnegative real parameter.
z (float): Third nonnegative real parameter.
p (float): Pole parameter and fourth argument; must be nonzero.
Returns:
float: Value of Carlson symmetric elliptic integral RJ.
"""
try:
if p == 0:
return "Error: p must be nonzero"
return float(scipy_elliprj(x, y, z, p))
except Exception as e:
return f"Error: {str(e)}"Online Calculator