Complete and incomplete elliptic integrals in Legendre form, with the
parameter m (\(m = k^2\)) as scipy.special takes it, and the Jacobi
elliptic functions.
Usage
sc_ellipk(m)
sc_ellipkm1(p)
sc_ellipkinc(phi, m)
sc_ellipe(m)
sc_ellipeinc(phi, m)
sc_ellipj(u, m)Details
sc_ellipk(),sc_ellipe(): complete integrals \(K(m)\), \(E(m)\).sc_ellipkm1(): \(K(1 - p)\), accurate near \(m = 1\).sc_ellipkinc(),sc_ellipeinc(): incomplete \(F(\phi | m)\) and \(E(\phi | m)\).sc_ellipj(): \(sn\), \(cn\), \(dn\) and the amplitude \(\phi\), as a named list, as SciPy returns a tuple.
Arguments are recycled: each must have length one or the common length.
NA gives NA; NaN is evaluated as SciPy does. The result takes its
dimensions, or else its names, from the arguments as base R arithmetic
does, and so does each element of a list result. Conditions the kernels
raise, such as a pole, are handled as sc_seterr() says.
Windows
R on Windows is built with Rtools, whose C library (mingw-w64 v11)
computes sin() and cos() with x87 argument reduction. Near a zero of
the cosine it loses relative accuracy, and sc_ellipj(u, 0), which is
cos(u) exactly, inherits that for u near pi / 2 on Windows only.
Other packages
In gsl: ellint_Kcomp(), ellint_Ecomp(), ellint_F() and
ellint_E(), which take the modulus \(k\) where SciPy takes the
parameter \(m = k^2\): sc_ellipk(m) is ellint_Kcomp(sqrt(m)). Its
elljac(u, m) takes \(m\), as sc_ellipj() does.
Examples
sc_ellipk(c(0, 0.5, 0.9))
#> [1] 1.570796 1.854075 2.578092
sc_ellipkinc(pi / 4, 0.5)
#> [1] 0.8260179
sc_ellipj(1, 0.5)
#> $sn
#> [1] 0.8030018
#>
#> $cn
#> [1] 0.5959766
#>
#> $dn
#> [1] 0.823161
#>
#> $ph
#> [1] 0.9323151
#>