@c -*- mode: texinfo -*-

@menu
* Introduction to Elliptic Functions and Integrals::
* Functions and Variables for Elliptic Functions::
* Functions and Variables for Elliptic Integrals::
@end menu



@node Introduction to Elliptic Functions and Integrals, Functions and Variables for Elliptic Functions, , Elliptic Functions
@comment  node-name,  next,  previous,  up
@section Introduction to Elliptic Functions and Integrals

Maxima includes support for Jacobian elliptic functions and for
complete and incomplete elliptic integrals.  This includes symbolic
manipulation of these functions and numerical evaluation as well.
Definitions of these functions and many of their properties can by
found in Abramowitz and Stegun, @urlaands{Chapter 16, 567} and
@urlaands{Chapter 17., 587}  See also @urldlmf{22.2}.  As much as possible,
we use the definitions and relationships given in Abramowitz and Stegun.

In particular, all elliptic functions and integrals use the parameter
@math{m} instead of the modulus @math{k} or the modular angle
@math{\alpha}.  The following relationships are true:

@html
$$
\eqalign{
m &= k^2 \cr
k &= \sin\alpha
}

$$
@end html
@ifinfo
@math{m = k^2}

@math{k = sin(alpha)}

@end ifinfo
@tex
$$\eqalign{
m &= k^2 \cr
k &= \sin\alpha
}
$$
@end tex


Note that Abramowitz and Stegun uses the notation 
@html
\({\rm
sn}(u|m)\)
@end html
@ifinfo
@math{sn(u|m)}
@end ifinfo
@iftex
@math{{\rm
sn}(u|m)}
@end iftex 
where we use 
@html
\({\rm
sn}(u,m)\)
@end html
@ifinfo
@math{sn(u,m)}
@end ifinfo
@iftex
@math{{\rm
sn}(u,m)}
@end iftex 
instead.  The DLMF uses modulus @math{k}
instead of the parameter @math{m}.

The elliptic functions and integrals are primarily intended to support
symbolic computation.  Therefore, most of derivatives of the functions
and integrals are known.  However, if floating-point values are given,
a floating-point result is returned.

Support for most of the other properties of elliptic functions and
integrals other than derivatives has not yet been written.

Some examples of elliptic functions:
@c ===beg===
@c jacobi_sn (u, m);
@c jacobi_sn (u, 1);
@c jacobi_sn (u, 0);
@c diff (jacobi_sn (u, m), u);
@c diff (jacobi_sn (u, m), m);
@c ===end===
@example maxima
@group
(%i1) jacobi_sn (u, m);
(%o1)                    jacobi_sn(u, m)
@end group
@group
(%i2) jacobi_sn (u, 1);
(%o2)                        tanh(u)
@end group
@group
(%i3) jacobi_sn (u, 0);
(%o3)                        sin(u)
@end group
@group
(%i4) diff (jacobi_sn (u, m), u);
(%o4)            jacobi_cn(u, m) jacobi_dn(u, m)
@end group
@group
(%i5) diff (jacobi_sn (u, m), m);
(%o5) (jacobi_cn(u, m) jacobi_dn(u, m)
      elliptic_e(asin(jacobi_sn(u, m)), m)
 (u - ------------------------------------))/(2 m)
                     1 - m
            2
   jacobi_cn (u, m) jacobi_sn(u, m)
 + --------------------------------
              2 (1 - m)
@end group
@end example

Some examples of elliptic integrals:
@c ===beg===
@c elliptic_f (phi, m);
@c elliptic_f (phi, 0);
@c elliptic_f (phi, 1);
@c elliptic_e (phi, 1);
@c elliptic_e (phi, 0);
@c elliptic_kc (1/2);
@c makegamma (%);
@c diff (elliptic_f (phi, m), phi);
@c diff (elliptic_f (phi, m), m);
@c ===end===
@example maxima
@group
(%i1) elliptic_f (phi, m);
(%o1)                  elliptic_f(phi, m)
@end group
@group
(%i2) elliptic_f (phi, 0);
(%o2)                          phi
@end group
@group
(%i3) elliptic_f (phi, 1);
                               phi   %pi
(%o3)                  log(tan(--- + ---))
                                2     4
@end group
@group
(%i4) elliptic_e (phi, 1);
                    phi                  phi
(%o4)       2 round(---) - sin(%pi round(---) - phi)
                    %pi                  %pi
@end group
@group
(%i5) elliptic_e (phi, 0);
(%o5)                          phi
@end group
@group
(%i6) elliptic_kc (1/2);
                                3/2
                             %pi
(%o6)                      -----------
                                  2 3
                           2 gamma (-)
                                    4
@end group
@group
(%i7) makegamma (%);
                                3/2
                             %pi
(%o7)                      -----------
                                  2 3
                           2 gamma (-)
                                    4
@end group
@group
(%i8) diff (elliptic_f (phi, m), phi);
                                1
(%o8)                 ---------------------
                                    2
                      sqrt(1 - m sin (phi))
@end group
@group
(%i9) diff (elliptic_f (phi, m), m);
       elliptic_e(phi, m) - (1 - m) elliptic_f(phi, m)
(%o9) (-----------------------------------------------
                              m
                                 cos(phi) sin(phi)
                             - ---------------------)/(2 (1 - m))
                                             2
                               sqrt(1 - m sin (phi))
@end group
@end example

Support for elliptic functions and integrals was written by Raymond
Toy.  It is placed under the terms of the General Public License (GPL)
that governs the distribution of Maxima.

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox

@node Functions and Variables for Elliptic Functions, Functions and Variables for Elliptic Integrals, Introduction to Elliptic Functions and Integrals, Elliptic Functions
@comment  node-name,  next,  previous,  up
@section Functions and Variables for Elliptic Functions
See @urlaands{Section 6.12, 569} and @urldlmf{22.2} for more
information.

@anchor{jacobi_sn}
@deffn {Function} jacobi_sn (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm sn}(u,m).\)
@end html
@ifinfo
@math{sn(u,m).}
@end ifinfo
@iftex
@math{{\rm sn}(u,m).}
@end iftex


@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_cn}
@deffn {Function} jacobi_cn (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm cn}(u,m).\)
@end html
@ifinfo
@math{cn(u,m).}
@end ifinfo
@iftex
@math{{\rm cn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_dn}
@deffn {Function} jacobi_dn (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm dn}(u,m).\)
@end html
@ifinfo
@math{dn(u,m).}
@end ifinfo
@iftex
@math{{\rm dn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_ns}
@deffn {Function} jacobi_ns (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm ns}(u,m) = 1/{\rm
sn}(u,m).\)
@end html
@ifinfo
@math{ns(u,m) = 1/sn(u,m).}
@end ifinfo
@iftex
@math{{\rm ns}(u,m) = 1/{\rm
sn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_sc}
@deffn {Function} jacobi_sc (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm sc}(u,m) = {\rm
sn}(u,m)/{\rm cn}(u,m).\)
@end html
@ifinfo
@math{sc(u,m) = sn(u,m)/cn(u,m).}
@end ifinfo
@iftex
@math{{\rm sc}(u,m) = {\rm
sn}(u,m)/{\rm cn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_sd}
@deffn {Function} jacobi_sd (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm sd}(u,m) = {\rm
sn}(u,m)/{\rm dn}(u,m).\)
@end html
@ifinfo
@math{sd(u,m) = sn(u,m)/dn(u,m).}
@end ifinfo
@iftex
@math{{\rm sd}(u,m) = {\rm
sn}(u,m)/{\rm dn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_nc}
@deffn {Function} jacobi_nc (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm nc}(u,m) = 1/{\rm cn}(u,m).\)
@end html
@ifinfo
@math{nc(u,m) = 1/cn(u,m).}
@end ifinfo
@iftex
@math{{\rm nc}(u,m) = 1/{\rm cn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_cs}
@deffn {Function} jacobi_cs (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm cs}(u,m) = {\rm
cn}(u,m)/{\rm sn}(u,m).\)
@end html
@ifinfo
@math{cs(u,m) = cn(u,m)/sn(u,m).}
@end ifinfo
@iftex
@math{{\rm cs}(u,m) = {\rm
cn}(u,m)/{\rm sn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_cd}
@deffn {Function} jacobi_cd (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm cd}(u,m) = {\rm cn}(u,m)/{\rm dn}(u,m).\)
@end html
@ifinfo
@math{cd(u,m) = cn(u,m)/dn(u,m).}
@end ifinfo
@iftex
@math{{\rm cd}(u,m) = {\rm cn}(u,m)/{\rm dn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_nd}
@deffn {Function} jacobi_nd (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm nd}(u,m) = 1/{\rm dn}(u,m).\)
@end html
@ifinfo
@math{nd(u,m) = 1/dn(u,m).}
@end ifinfo
@iftex
@math{{\rm nd}(u,m) = 1/{\rm dn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_ds}
@deffn {Function} jacobi_ds (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm ds}(u,m) =
{\rm dn}(u,m)/{\rm sn}(u,m).\)
@end html
@ifinfo
@math{ds(u,m) = dn(u,m)/sn(u,m).}
@end ifinfo
@iftex
@math{{\rm ds}(u,m) =
{\rm dn}(u,m)/{\rm sn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_dc}
@deffn {Function} jacobi_dc (@var{u}, @var{m})
The Jacobian elliptic function 
@html
\({\rm dc}(u,m) =
{\rm dn}(u,m)/{\rm cn}(u,m).\)
@end html
@ifinfo
@math{dc(u,m) = dn(u,m)/cn(u,m).}
@end ifinfo
@iftex
@math{{\rm dc}(u,m) =
{\rm dn}(u,m)/{\rm cn}(u,m).}
@end iftex

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{jacobi_am}
@deffn {Function} jacobi_am (@var{u}, @var{m})
The Jacobi amplitude function, @code{jacobi_am}, is defined implicitly by (see
@url{http://functions.wolfram.com/09.24.02.0001.01})
@html
\(z = {\rm am}(w, m)\)
@end html
@ifinfo
@math{z = am(w, m)}
@end ifinfo
@iftex
@math{z = {\rm am}(w, m)}
@end iftex
where @math{w = F(z,m)} where @math{F(z,m)} is the incomplete elliptic
integral of the first kind (@pxref{elliptic_f}).  It is defined for
all real and complex values of @math{z} and @math{m}.  In particular
for real @math{z} and @math{m} with @math{|m|<1},
@html
\({\rm am}(z,m)\)
@end html
@ifinfo
@math{am(z,m)}
@end ifinfo
@iftex
@math{{\rm am}(z,m)}
@end iftex
maps the entire real line to the entire real line.  For other values
of @math{z} and @math{m}, the following relationship is used:
@html
\({\rm am}(z,m) = \sin^{-1}({\rm jacobi\_sn}(z, m)).\)
@end html
@ifinfo
@math{am(z,m) = asin(jacobi_sn(z,m)).}
@end ifinfo
@iftex
@math{{\rm am}(z,m) = \sin^{-1}({\rm jacobi\_sn}(z, m)).}
@end iftex

Some examples:
@c ===beg===
@c jacobi_am(z,0);
@c jacobi_am(z,1);
@c jacobi_am(0,m);
@c jacobi_am(100, .5);
@c jacobi_am(0.5, 1.5);
@c jacobi_am(1.5b0, 1.5b0+%i);
@c ===end===
@example maxima
@group
(%i1) jacobi_am(z,0);
(%o1)                           z
@end group
@group
(%i2) jacobi_am(z,1);
                                 z    %pi
(%o2)                   2 atan(%e ) - ---
                                       2
@end group
@group
(%i3) jacobi_am(0,m);
(%o3)                           0
@end group
@group
(%i4) jacobi_am(100, .5);
(%o4)                   84.70311272411382
@end group
@group
(%i5) jacobi_am(0.5, 1.5);
(%o5)                  0.4707197897046991
@end group
@group
(%i6) jacobi_am(1.5b0, 1.5b0+%i);
(%o6)    9.340542168700782b-1 - 3.723960452146071b-1 %i
@end group
@end example

@c ===beg===
@c plot2d([jacobi_am(x,.4),jacobi_am(x,.7),jacobi_am(x,.99),jacobi_am(x,.999999)],[x,0,10*%pi]);
@c ===end===
@example maxima
@group
(%i1) plot2d([jacobi_am(x,.4),jacobi_am(x,.7),jacobi_am(x,.99),jacobi_am(x,.999999)],[x,0,10*%pi]);
(%o1)                         false
@end group
@end example

Compare this plot with the plot from @urldlmf{22.16.iv}:

@altfigure{jacobi_am,Plot of the jacobi_am function for 4 different parameters}

@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_dn}
@deffn {Function} inverse_jacobi_dn (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
dn}(u,m).\)
@end html
@ifinfo
@math{dn(u,m).}
@end ifinfo
@iftex
@math{{\rm
dn}(u,m).}
@end iftex 
For 
@html
\(\sqrt{1-m}\le u \le 1,\)
@end html
@ifinfo
@math{sqrt(1-m) <= u <= 1,}
@end ifinfo
@iftex
@math{\sqrt{1-m}\le u \le 1,}
@end iftex 
it can also be written (@urldlmf{22.15.E14}):
@html
$$
{\rm inverse\_jacobi\_dn}(u, m) = \int_u^1 {dt\over \sqrt{(1-t^2)(t^2-(1-m))}}
$$
@end html
@ifinfo
@example
                                1
                               /
                               [               1
     inverse_jacobi_dn(u, m) = I  --------------------------- dt
                               ]             2    2
                               /  sqrt((1 - t ) (t  + m - 1))
                                u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_dn}(u, m) = \int_u^1 {dt\over \sqrt{(1-t^2)(t^2-(1-m))}}$$
@end tex



@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_ns}
@deffn {Function} inverse_jacobi_ns (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
ns}(u,m).\)
@end html
@ifinfo
@math{ns(u,m).}
@end ifinfo
@iftex
@math{{\rm
ns}(u,m).}
@end iftex 
For 
@html
\(1 \le u,\)
@end html
@ifinfo
@math{1 <= u,}
@end ifinfo
@iftex
@math{1 \le u,}
@end iftex 
it can also be written (@urldlmf{22.15.E121}):
@html
$$
{\rm inverse\_jacobi\_ns}(u, m) = \int_u^{\infty} {dt\over \sqrt{(1-t^2)(t^2-m)}}
$$
@end html
@ifinfo
@example
                                 inf
                                /
                                [               1
      inverse_jacobi_ns(u, m) = I    ----------------------- dt
                                ]               2    2
                                /    sqrt((1 - t ) (t  - m))
                                 u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_ns}(u, m) = \int_u^{\infty} {dt\over \sqrt{(1-t^2)(t^2-m)}}$$
@end tex


@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_sc}
@deffn {Function} inverse_jacobi_sc (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
sc}(u,m).\)
@end html
@ifinfo
@math{sc(u,m).}
@end ifinfo
@iftex
@math{{\rm
sc}(u,m).}
@end iftex 
For all @math{u} it can also be written (@urldlmf{22.15.E20}):
@html
$$
{\rm inverse\_jacobi\_sc}(u, m) = \int_0^u {dt\over \sqrt{(1+t^2)(1+(1-m)t^2)}}
$$
@end html
@ifinfo
@example
                              u
                             /
                             [                 1
   inverse_jacobi_sc(u, m) = I  ------------------------------- dt
                             ]             2                2
                             /  sqrt((1 - t ) (1 - (1 - m) t ))
                              0
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_sc}(u, m) = \int_0^u {dt\over \sqrt{(1+t^2)(1+(1-m)t^2)}}$$
@end tex


@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_sd}
@deffn {Function} inverse_jacobi_sd (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
sd}(u,m).\)
@end html
@ifinfo
@math{sd(u,m).}
@end ifinfo
@iftex
@math{{\rm
sd}(u,m).}
@end iftex 
For 
@html
\(-1/\sqrt{1-m}\le u \le
1/\sqrt{1-m},\)
@end html
@ifinfo
@math{-1/sqrt(1-m) <= 1/sqrt(1-m),}
@end ifinfo
@iftex
@math{-1/\sqrt{1-m}\le u \le
1/\sqrt{1-m},}
@end iftex 
it can also be written (@urldlmf{22.15.E16}):
@html
$$
{\rm inverse\_jacobi\_sd}(u, m) = \int_0^u {dt\over \sqrt{(1-(1-m)t^2)(1+mt^2)}}
$$
@end html
@ifinfo
@example
                            u
                           /
                           [                  1
 inverse_jacobi_sd(u, m) = I  --------------------------------- dt
                           ]                     2      2
                           /  sqrt((1 - (1 - m) t ) (m t  + 1))
                            0
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_sd}(u, m) = \int_0^u {dt\over \sqrt{(1-(1-m)t^2)(1+mt^2)}}$$
@end tex


@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_nc}
@deffn {Function} inverse_jacobi_nc (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
nc}(u,m).\)
@end html
@ifinfo
@math{nc(u,m).}
@end ifinfo
@iftex
@math{{\rm
nc}(u,m).}
@end iftex 
For 
@html
\(1\le u,\)
@end html
@ifinfo
@math{1 <= u,}
@end ifinfo
@iftex
@math{1\le u,}
@end iftex 
it can also be written (@urldlmf{22.15.E19}):
@html
$$
{\rm inverse\_jacobi\_nc}(u, m) = \int_1^u {dt\over \sqrt{(t^2-1)(m+(1-m)t^2)}}
$$
@end html
@ifinfo
@example
                              1
                             /
                             [                 1
 inverse_jacobi_nc(u, m) = - I  ------------------------------- dt
                             ]         2                2
                             /  sqrt((t  - 1) ((1 - m) t  + m))
                              u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_nc}(u, m) = \int_1^u {dt\over \sqrt{(t^2-1)(m+(1-m)t^2)}}$$
@end tex


@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_cs}
@deffn {Function} inverse_jacobi_cs (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
cs}(u,m).\)
@end html
@ifinfo
@math{cs(u,m).}
@end ifinfo
@iftex
@math{{\rm
cs}(u,m).}
@end iftex 
For all @math{u} it can also be written (@urldlmf{22.15.E23}):
@html
$$
{\rm inverse\_jacobi\_cs}(u, m) = \int_u^{\infty} {dt\over \sqrt{(1+t^2)(t^2+(1-m))}}
$$
@end html
@ifinfo
@example
                             inf
                            /
                            [                  1
  inverse_jacobi_cs(u, m) = I    ----------------------------- dt
                            ]          2            2
                            /    sqrt(t  + 1) sqrt(t  - m + 1)
                             u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_cs}(u, m) = \int_u^{\infty} {dt\over \sqrt{(1+t^2)(t^2+(1-m))}}$$
@end tex



@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_cd}
@deffn {Function} inverse_jacobi_cd (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
cd}(u,m).\)
@end html
@ifinfo
@math{cd(u,m).}
@end ifinfo
@iftex
@math{{\rm
cd}(u,m).}
@end iftex 
For 
@html
\(-1\le u \le 1,\)
@end html
@ifinfo
@math{-1 <= u <=
1,}
@end ifinfo
@iftex
@math{-1\le u \le 1,}
@end iftex 
it can also be written (@urldlmf{22.15.E15}):
@html
$$
{\rm inverse\_jacobi\_cd}(u, m) = \int_u^1 {dt\over \sqrt{(1-t^2)(1-mt^2)}}
$$
@end html
@ifinfo
@example
                                1
                               /
                               [              1
     inverse_jacobi_cd(u, m) = I  ------------------------- dt
                               ]             2          2
                               /  sqrt((1 - t ) (1 - m t ))
                                u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_cd}(u, m) = \int_u^1 {dt\over \sqrt{(1-t^2)(1-mt^2)}}$$
@end tex



@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_nd}
@deffn {Function} inverse_jacobi_nd (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
nd}(u,m).\)
@end html
@ifinfo
@math{nd(u,m).}
@end ifinfo
@iftex
@math{{\rm
nd}(u,m).}
@end iftex 
For 
@html
\(1\le u \le 1/\sqrt{1-m},\)
@end html
@ifinfo
@math{1 <= u <= 1/sqrt(1-m),}
@end ifinfo
@iftex
@math{1\le u \le 1/\sqrt{1-m},}
@end iftex 
it can also be written (@urldlmf{22.15.E17}):
@html
$$
{\rm inverse\_jacobi\_nd}(u, m) = \int_1^u {dt\over \sqrt{(t^2-1)(1-(1-m)t^2)}}
$$
@end html
@ifinfo
@example
                              1
                             /
                             [                 1
 inverse_jacobi_nd(u, m) = - I  ------------------------------- dt
                             ]         2                    2
                             /  sqrt((t  - 1) (1 - (1 - m) t ))
                              u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_nd}(u, m) = \int_1^u {dt\over \sqrt{(t^2-1)(1-(1-m)t^2)}}$$
@end tex



@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_ds}
@deffn {Function} inverse_jacobi_ds (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
ds}(u,m).\)
@end html
@ifinfo
@math{ds(u,m).}
@end ifinfo
@iftex
@math{{\rm
ds}(u,m).}
@end iftex 
For 
@html
\(\sqrt{1-m}\le u,\)
@end html
@ifinfo
@math{sqrt(1-m) <= u,}
@end ifinfo
@iftex
@math{\sqrt{1-m}\le u,}
@end iftex 
it can also be written (@urldlmf{22.15.E22}):
@html
$$
{\rm inverse\_jacobi\_ds}(u, m) = \int_u^{\infty} {dt\over \sqrt{(t^2+m)(t^2-(1-m))}}
$$
@end html
@ifinfo
@example
                              inf
                             /
                             [                 1
   inverse_jacobi_ds(u, m) = I    --------------------------- dt
                             ]           2            2
                             /    sqrt((t  + m - 1) (t  + m))
                              u
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_ds}(u, m) = \int_u^{\infty} {dt\over \sqrt{(t^2+m)(t^2-(1-m))}}$$
@end tex



@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn

@anchor{inverse_jacobi_dc}
@deffn {Function} inverse_jacobi_dc (@var{u}, @var{m})
The inverse of the Jacobian elliptic function 
@html
\({\rm
dc}(u,m).\)
@end html
@ifinfo
@math{dc(u,m).}
@end ifinfo
@iftex
@math{{\rm
dc}(u,m).}
@end iftex 
For 
@html
\(1 \le u,\)
@end html
@ifinfo
@math{1 <= u,}
@end ifinfo
@iftex
@math{1 \le u,}
@end iftex 
it can also be written (@urldlmf{22.15.E18}):
@html
$$
{\rm inverse\_jacobi\_dc}(u, m) = \int_1^u {dt\over \sqrt{(t^2-1)(t^2-m)}}
$$
@end html
@ifinfo
@example
                                  u
                                 /
                                 [             1
     inverse_jacobi_dc(u, m) =   I  ----------------------- dt
                                 ]         2        2
                                 /  sqrt((t  - 1) (t  - m))
                                  1
@end example

@end ifinfo
@tex
$${\rm inverse\_jacobi\_dc}(u, m) = \int_1^u {dt\over \sqrt{(t^2-1)(t^2-m)}}$$
@end tex



@opencatbox{Categories:}
@category{Elliptic functions}
@closecatbox
@end deffn


@node Functions and Variables for Elliptic Integrals,  , Functions and Variables for Elliptic Functions, Elliptic Functions
@comment  node-name,  next,  previous,  up
@section Functions and Variables for Elliptic Integrals

@anchor{elliptic_f}
@deffn {Function} elliptic_f (@var{phi}, @var{m})
The incomplete elliptic integral of the first kind, defined as

@html
$$
\int_0^{\phi} {\frac{d\theta}{\sqrt{1-m\sin^2\theta}}}

$$
@end html
@ifinfo
@math{integrate(1/sqrt(1 - m*sin(x)^2), x, 0, phi)}

@end ifinfo
@tex
$$\int_0^{\phi} {\frac{d\theta}{\sqrt{1-m\sin^2\theta}}}
$$
@end tex


See also @ref{elliptic_e} and @ref{elliptic_kc}.

@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{elliptic_e}
@deffn {Function} elliptic_e (@var{phi}, @var{m})
The incomplete elliptic integral of the second kind, defined as

@html
$$
\int_0^\phi {\sqrt{1 - m\sin^2\theta}}\, d\theta

$$
@end html
@ifinfo
@math{elliptic_e(phi, m) = integrate(sqrt(1 - m*sin(x)^2), x, 0, phi)}

@end ifinfo
@tex
$$\int_0^\phi {\sqrt{1 - m\sin^2\theta}}\, d\theta
$$
@end tex


See also @ref{elliptic_f} and @ref{elliptic_ec}.

@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{elliptic_eu}
@deffn {Function} elliptic_eu (@var{u}, @var{m})
The incomplete elliptic integral of the second kind, defined as

@html
$$
E(u, m) = \int_0^u {\rm dn}(v, m)\, dv  = \int_0^\tau \sqrt{\frac{1-m t^2}{1-t^2}}\, dt

$$
@end html
@ifinfo
@math{elliptic_eu(u, m) = integrate(dn(v,m)^2,v,0,u) = integrate(sqrt(1-m*t^2)/sqrt(1-t^2), t, 0, tau)}

@end ifinfo
@tex
$$E(u, m) = \int_0^u {\rm dn}(v, m)\, dv  = \int_0^\tau \sqrt{\frac{1-m t^2}{1-t^2}}\, dt
$$
@end tex


where 
@html
\(\tau = {\rm sn}(u,m)
.\)
@end html
@ifinfo
@math{tau = sn(u,m)
.}
@end ifinfo
@iftex
@math{\tau = {\rm sn}(u,m)
.}
@end iftex


This is related to @code{elliptic_e} by

@html
$$
E(u,m) = E(\sin^{-1} {\rm sn}(u, m), m)

$$
@end html
@ifinfo
@math{elliptic_eu(u, m) = elliptic_e(asin(sn(u,m)),m)}

@end ifinfo
@tex
$$E(u,m) = E(\sin^{-1} {\rm sn}(u, m), m)
$$
@end tex


See also @ref{elliptic_e}.
@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{elliptic_pi}
@deffn {Function} elliptic_pi (@var{n}, @var{phi}, @var{m})
The incomplete elliptic integral of the third kind, defined as

@html
$$
\int_0^\phi {{d\theta}\over{(1-n\sin^2 \theta)\sqrt{1 - m\sin^2\theta}}}

$$
@end html
@ifinfo
@math{integrate(1/(1-n*sin(x)^2)/sqrt(1 - m*sin(x)^2), x, 0, phi)}

@end ifinfo
@tex
$$\int_0^\phi {{d\theta}\over{(1-n\sin^2 \theta)\sqrt{1 - m\sin^2\theta}}}
$$
@end tex


@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{elliptic_kc}
@deffn {Function} elliptic_kc (@var{m})
The complete elliptic integral of the first kind, defined as

@html
$$
\int_0^{\frac{\pi}{2}} {{d\theta}\over{\sqrt{1 - m\sin^2\theta}}}

$$
@end html
@ifinfo
@math{integrate(1/sqrt(1 - m*sin(x)^2), x, 0, pi/2)}

@end ifinfo
@tex
$$\int_0^{\frac{\pi}{2}} {{d\theta}\over{\sqrt{1 - m\sin^2\theta}}}
$$
@end tex


For certain values of @math{m}, the value of the integral is known in
terms of @math{Gamma} functions.  Use @mref{makegamma} to evaluate them.

@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{elliptic_ec}
@deffn {Function} elliptic_ec (@var{m})
The complete elliptic integral of the second kind, defined as

@html
$$
\int_0^{\frac{\pi}{2}} \sqrt{1 - m\sin^2\theta}\, d\theta

$$
@end html
@ifinfo
@math{integrate(sqrt(1 - m*sin(x)^2), x, 0, pi/2)}

@end ifinfo
@tex
$$\int_0^{\frac{\pi}{2}} \sqrt{1 - m\sin^2\theta}\, d\theta
$$
@end tex


For certain values of @math{m}, the value of the integral is known in
terms of @math{Gamma} functions.  Use @mref{makegamma} to evaluate them.

@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{carlson_rc}
@deffn {Function} carlson_rc (@var{x}, @var{y})
Carlson's RC integral is defined by

@html
$$
R_C(x, y) = \frac{1}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}(t+y)}\, dt

$$
@end html
@ifinfo
@math{integrate(1/2*(t+x)^(-1/2)/(t+y), t, 0, inf)}

@end ifinfo
@tex
$$R_C(x, y) = \frac{1}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}(t+y)}\, dt
$$
@end tex


See
@url{https://arxiv.org/pdf/math/9409227, Numerical Computation of Real
or Complex Elliptic Integrals}
for more information.

This integral is related to many elementary functions in the following
way:

@html
$$
\eqalign{
\log x &= (x-1) R_C\left(\left({\frac{1+x}{2}}\right)^2, x\right), \quad x > 0 \cr
\sin^{-1} x &= x R_C(1-x^2, 1), \quad |x| \le 1 \cr
\cos^{-1} x &= \sqrt{1-x^2} R_C(x^2,1), \quad 0 \le x \le 1  \cr
\tan^{-1} x &= x  R_C(1,1+x^2)  \cr
\sinh^{-1} x &= x  R_C(1+x^2,1)  \cr
\cosh^{-1} x &= \sqrt{x^2-1}  R_C(x^2,1), \quad x \ge 1  \cr
\tanh^{-1}(x) &= x  R_C(1,1-x^2), \quad |x| \le 1
}

$$
@end html
@ifinfo
@math{log(x)  = (x-1)*rc(((1+x)/2)^2, x), x > 0}

@math{asin(x) = x * rc(1-x^2, 1), |x|<= 1}

@math{acos(x) = sqrt(1-x^2)*rc(x^2,1), 0 <= x <=1}

@math{atan(x) = x * rc(1,1+x^2)}

@math{asinh(x) = x * rc(1+x^2,1)}

@math{acosh(x) = sqrt(x^2-1) * rc(x^2,1), x >= 1}

@math{atanh(x) = x * rc(1,1-x^2), |x|<=1}

@end ifinfo
@tex
$$\eqalign{
\log x &= (x-1) R_C\left(\left({\frac{1+x}{2}}\right)^2, x\right), \quad x > 0 \cr
\sin^{-1} x &= x R_C(1-x^2, 1), \quad |x| \le 1 \cr
\cos^{-1} x &= \sqrt{1-x^2} R_C(x^2,1), \quad 0 \le x \le 1  \cr
\tan^{-1} x &= x  R_C(1,1+x^2)  \cr
\sinh^{-1} x &= x  R_C(1+x^2,1)  \cr
\cosh^{-1} x &= \sqrt{x^2-1}  R_C(x^2,1), \quad x \ge 1  \cr
\tanh^{-1}(x) &= x  R_C(1,1-x^2), \quad |x| \le 1
}
$$
@end tex


Also, we have the relationship

@html
$$
R_C(x,y) = R_F(x,y,y)

$$
@end html
@ifinfo
@math{R_C(x,y) = R_F(x,y,y)}

@end ifinfo
@tex
$$R_C(x,y) = R_F(x,y,y)
$$
@end tex


Some special values:
@html
$$
\eqalign{R_C(0, 1) &= \frac{\pi}{2} \cr
R_C(0, 1/4) &= \pi \cr
R_C(2,1) &= \log(\sqrt{2} + 1) \cr
R_C(i,i+1) &= \frac{\pi}{4} + \frac{i}{2} \log(\sqrt{2}-1) \cr
R_C(0,i) &= (1-i)\frac{\pi}{2\sqrt{2}} \cr
}

$$
@end html
@ifinfo
@math{R_C(0,1) = pi/2}

@math{R_C(0,1/4) = pi}

@math{R_C(2,1) = log(sqrt(2)+1)}

@math{R_C(i, i+1) = pi/4 + i/2*log(sqrt(2)+1)}

@math{R_C(0, i) = (1-i)*pi/(2*sqrt(2))}

@end ifinfo
@tex
$$\eqalign{R_C(0, 1) &= \frac{\pi}{2} \cr
R_C(0, 1/4) &= \pi \cr
R_C(2,1) &= \log(\sqrt{2} + 1) \cr
R_C(i,i+1) &= \frac{\pi}{4} + \frac{i}{2} \log(\sqrt{2}-1) \cr
R_C(0,i) &= (1-i)\frac{\pi}{2\sqrt{2}} \cr
}
$$
@end tex



@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{carlson_rd}
@deffn {Function} carlson_rd (@var{x}, @var{y}, @var{z})
Carlson's RD integral is defined by

@html
$$
R_D(x,y,z) = \frac{3}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}\sqrt{t+y}\sqrt{t+z}\,(t+z)}\, dt

$$
@end html
@ifinfo
@math{R_D(x,y,z) = 3/2*integrate(1/(sqrt(t+x)*sqrt(t+y)*sqrt(t+z)*(t+z)), t, 0, inf)}

@end ifinfo
@tex
$$R_D(x,y,z) = \frac{3}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}\sqrt{t+y}\sqrt{t+z}\,(t+z)}\, dt
$$
@end tex


See
@url{https://arxiv.org/pdf/math/9409227, Numerical Computation of Real
or Complex Elliptic Integrals}
for more information.

We also have the special values

@html
$$
\eqalign{
R_D(x,x,x) &= x^{-\frac{3}{2}} \cr
R_D(0,y,y) &= \frac{3}{4} \pi y^{-\frac{3}{2}} \cr
R_D(0,2,1) &= 3 \sqrt{\pi} \frac{\Gamma(\frac{3}{4})}{\Gamma(\frac{1}{4})}
}

$$
@end html
@ifinfo
@math{R_D(x,x,x) = x^(-3/2)}

@math{R_D(0,y,y) = 3/4*pi*y^(-3/2)}

@math{R_D(0,2,1) = 3 sqrt(pi) gamma(3/4)/gamma(1/4)}

@end ifinfo
@tex
$$\eqalign{
R_D(x,x,x) &= x^{-\frac{3}{2}} \cr
R_D(0,y,y) &= \frac{3}{4} \pi y^{-\frac{3}{2}} \cr
R_D(0,2,1) &= 3 \sqrt{\pi} \frac{\Gamma(\frac{3}{4})}{\Gamma(\frac{1}{4})}
}
$$
@end tex



It is also related to the complete elliptic integral of the second
kind, @math{E},
(@mref{elliptic_ec}) as follows 

@html
$$
E(m) = R_F(0, 1 - m, 1) - \frac{m}{3} R_D(0, 1 - m, 1)

$$
@end html
@ifinfo
@math{E(m) = R_F(0, 1 - m, 1) - (m/3)* R_D(0, 1 - m, 1)}

@end ifinfo
@tex
$$E(m) = R_F(0, 1 - m, 1) - \frac{m}{3} R_D(0, 1 - m, 1)
$$
@end tex


@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{carlson_rf}
@deffn {Function} carlson_rf (@var{x}, @var{y}, @var{z})
Carlson's RF integral is defined by

@html
$$
R_F(x,y,z) = \frac{1}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}\sqrt{t+y}\sqrt{t+z}}\, dt

$$
@end html
@ifinfo
@math{R_F(x,y,z) = 1/2*integrate(1/(sqrt(t+x)*sqrt(t+y)*sqrt(t+z)), t, 0, inf)}

@end ifinfo
@tex
$$R_F(x,y,z) = \frac{1}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}\sqrt{t+y}\sqrt{t+z}}\, dt
$$
@end tex


See
@url{https://arxiv.org/pdf/math/9409227, Numerical Computation of Real
or Complex Elliptic Integrals}
for more information.

We also have the special values

@html
$$
\eqalign{
R_F(0,1,2)  &= \frac{\Gamma({\frac{1}{4}})^2}{4\sqrt{2\pi}} \cr
R_F(i,-i,0) &= \frac{\Gamma({\frac{1}{4}})^2}{4\sqrt{\pi}}
}

$$
@end html
@ifinfo

@math{R_F(0,1,2) = gamma(1/4)^2/(4*sqrt(2*pi))}

@math{R_F(i,-i,0) = gamma(1/4)^2/(4*sqrt(pi))}


@end ifinfo
@tex
$$\eqalign{
R_F(0,1,2)  &= \frac{\Gamma({\frac{1}{4}})^2}{4\sqrt{2\pi}} \cr
R_F(i,-i,0) &= \frac{\Gamma({\frac{1}{4}})^2}{4\sqrt{\pi}}
}
$$
@end tex


It is also related to the complete elliptic integral of the second
kind, @math{E},
(@mref{elliptic_ec}) as follows 

@html
$$
E(m) = R_F(0, 1 - m, 1) - \frac{m}{3} R_D(0, 1 - m, 1)

$$
@end html
@ifinfo
@math{E(m) = R_F(0, 1 - m, 1) - (m/3)* R_D(0, 1 - m, 1)}

@end ifinfo
@tex
$$E(m) = R_F(0, 1 - m, 1) - \frac{m}{3} R_D(0, 1 - m, 1)
$$
@end tex


@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

@anchor{carlson_rj}
@deffn {Function} carlson_rj (@var{x}, @var{y}, @var{z}, @var{p})
Carlson's RJ integral is defined by

@html
$$
R_J(x,y,z) = \frac{1}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}\sqrt{t+y}\sqrt{t+z}\,(t+p)}\, dt

$$
@end html
@ifinfo

@math{R_J(x,y,z) = 1/2*integrate(1/(sqrt(t+x)*sqrt(t+y)*sqrt(t+z)*(t+p)), t, 0, inf)}

@end ifinfo
@tex
$$R_J(x,y,z) = \frac{1}{2} \int_0^{\infty} \frac{1}{\sqrt{t+x}\sqrt{t+y}\sqrt{t+z}\,(t+p)}\, dt
$$
@end tex


See
@url{https://arxiv.org/pdf/math/9409227, Numerical Computation of Real
or Complex Elliptic Integrals}
for more information.

It is related to the elliptic integral of the third kind (@mref{elliptic_pi})
by

@html
$$
\int_0^\phi {1\over \left(1+n\sin^2\theta\right) \sqrt{1-m\sin^2\theta}}
\, d\theta = R_F(c-1,c-m,c) - {n\over 3}R_j(c-1,c-m,c,c+n)
$$
@end html
@ifinfo

@example
  phi
 ⌠
 ⎮                         1
 ⎮    ─────────────────────────────────────────── dtheta = 
 ⎮                  2               2
 ⌡    sqrt(1 - m sin (theta)) (n sin (theta) + 1)
  0
                                      carlson_rj(c - 1, c - m, c, n + c) n
        carlson_rf(c - 1, c - m, c) - ────────────────────────────────────
                                                       3
@end example


@end ifinfo
@tex
$$\int_0^\phi {1\over \left(1+n\sin^2\theta\right) \sqrt{1-m\sin^2\theta}}
\, d\theta = R_F(c-1,c-m,c) - {n\over 3}R_j(c-1,c-m,c,c+n)$$
@end tex


where
@html
\(c = \csc\phi.\)
@end html
@ifinfo
@math{c = csc phi
.}
@end ifinfo
@iftex
@math{c = \csc\phi.}
@end iftex
Note that this differs in our definition of @mref{elliptic_pi} by the
sign of the parameter @math{n}.

@opencatbox{Categories:}
@category{Elliptic integrals}
@closecatbox
@end deffn

