Learn R Programming

pracma (version 1.7.9)

ellipke,ellipj: Elliptic and Jacobi Elliptic Integrals

Description

Complete elliptic integrals of the first and second kind, and Jacobi elliptic integrals.

Usage

ellipke(m, tol = .Machine$double.eps)

ellipj(u, m, tol = .Machine$double.eps)

Arguments

u
numeric vector.
m
input vector, all input elements must satisfy 0 <= x="" <="1.
tol
tolerance; default is machine precision.

Value

  • ellipke returns list with two components, k the values for the first kind, e the values for the second kind.

    ellipj returns a list with components the three Jacobi elliptic integrals sn, cn, and dn.

Details

ellipke computes the complete elliptic integrals to accuracy tol, based on the algebraic-geometric mean.

ellipj computes the Jacobi elliptic integrals sn, cn, and dn. For instance, $sn$ is the inverse function for $$u = \int_0^\phi dt / \sqrt{1 - m \sin^2 t}$$ with $sn(u) = \sin(\phi)$.

Some definitions of the elliptic functions use the modules k instead of the parameter m. They are related by k^2=m=sin(a)^2 where a is the `modular angle'.

References

Abramowitz, M., and I. A. Stegun (1965). Handbook of Mathematical Functions. Dover Publications, New York.

See Also

elliptic::sn,cn,dn

Examples

Run this code
x <- linspace(0, 1, 20)
ke <- ellipke(x)

plot(x, ke$k, type = "l", col ="darkblue", ylim = c(0, 5),
     main = "Elliptic Integrals")
lines(x, ke$e, col = "darkgreen")
legend( 0.01, 4.5,
        legend = c("Elliptic integral of first kind",
                   "Elliptic integral of second kind"),
        col = c("darkblue", "darkgreen"), lty = 1)
grid()

u <- c(0, 1, 2, 3, 4, 5)
m <- seq(0.0, 1.0, by = 0.2)
je <- ellipj(u, m)
# $sn       0.0000  0.8265  0.9851  0.7433  0.4771  0.9999
# $cn       1.0000  0.5630 -0.1720 -0.6690 -0.8789  0.0135
# $dn       1.0000  0.9292  0.7822  0.8176  0.9044  0.0135
je$sn^2 + je$cn^2       # 1 1 1 1 1 1
je$dn^2 + m * je$sn^2   # 1 1 1 1 1 1

Run the code above in your browser using DataLab