
@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, , Top
@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, Chapter 16--17.  As much as possible,
we use the definitions and relationships given there.

In particular, all elliptic functions and integrals use the parameter
@math{m} instead of the modulus @math{k} or the modular angle
@math{\alpha}.  This is one area where we differ from Abramowitz and
Stegun who use the modular angle for the elliptic functions.  The
following relationships are true:
@ifinfo
@math{m = k^2} and @math{k = \sin(\alpha)}
@end ifinfo
@tex
$$m = k^2$$ and $$k = \sin\alpha $$
@end tex

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
(%i1) jacobi_sn (u, m);
(%o1)                    jacobi_sn(u, m)
(%i2) jacobi_sn (u, 1);
(%o2)                        tanh(u)
(%i3) jacobi_sn (u, 0);
(%o3)                        sin(u)
(%i4) diff (jacobi_sn (u, m), u);
(%o4)            jacobi_cn(u, m) jacobi_dn(u, m)
(%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 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
(%i1) elliptic_f (phi, m);
(%o1)                  elliptic_f(phi, m)
(%i2) elliptic_f (phi, 0);
(%o2)                          phi
(%i3) elliptic_f (phi, 1);
                               phi   %pi
(%o3)                  log(tan(--- + ---))
                                2     4
(%i4) elliptic_e (phi, 1);
(%o4)                       sin(phi)
(%i5) elliptic_e (phi, 0);
(%o5)                          phi
(%i6) elliptic_kc (1/2);
                                     1
(%o6)                    elliptic_kc(-)
                                     2
(%i7) makegamma (%);
                                 2 1
                            gamma (-)
                                   4
(%o7)                      -----------
                           4 sqrt(%pi)
(%i8) diff (elliptic_f (phi, m), phi);
                                1
(%o8)                 ---------------------
                                    2
                      sqrt(1 - m sin (phi))
(%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 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
@category{Elliptic functions}
@closecatbox

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

@section Functions and Variables for Elliptic Functions

@anchor{jacobi_sn}
@deffn {Function} jacobi_sn (@var{u}, @var{m})
The Jacobian elliptic function @math{sn(u,m)}.

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

@anchor{jacobi_cn}
@deffn {Function} jacobi_cn (@var{u}, @var{m})
The Jacobian elliptic function @math{cn(u,m)}.

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

@anchor{jacobi_dn}
@deffn {Function} jacobi_dn (@var{u}, @var{m})
The Jacobian elliptic function @math{dn(u,m)}.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@anchor{inverse_jacobi_sn}
@deffn {Function} inverse_jacobi_sn (@var{u}, @var{m})
The inverse of the Jacobian elliptic function @math{sn(u,m)}.

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

@anchor{inverse_jacobi_cn}
@deffn {Function} inverse_jacobi_cn (@var{u}, @var{m})
The inverse of the Jacobian elliptic function @math{cn(u,m)}.

@opencatbox
@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 @math{dn(u,m)}.

@opencatbox
@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 @math{ns(u,m)}.

@opencatbox
@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 @math{sc(u,m)}.

@opencatbox
@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 @math{sd(u,m)}.

@opencatbox
@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 @math{nc(u,m)}.

@opencatbox
@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 @math{cs(u,m)}.

@opencatbox
@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 @math{cd(u,m)}.

@opencatbox
@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 @math{nd(u,m)}.

@opencatbox
@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 @math{ds(u,m)}.

@opencatbox
@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 @math{dc(u,m)}.

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


@node Functions and Variables for Elliptic Integrals, , Functions and Variables for Elliptic Functions, Top
@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

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

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

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

@opencatbox
@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

@ifhtml
@math{elliptic_e(phi, m) = integrate(sqrt(1 - m*sin(x)^2), x, 0, phi)}
@end ifhtml
@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
@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

@ifhtml
@math{integrate(dn(v,m)^2,v,0,u) = integrate(sqrt(1-m*t^2)/sqrt(1-t^2), t, 0, tau)}

where @math{tau = sn(u,m)}.
@end ifhtml
@ifinfo
@math{integrate(dn(v,m)^2,v,0,u) = integrate(sqrt(1-m*t^2)/sqrt(1-t^2), t, 0, tau)}

where @math{tau = sn(u,m)}.
@end ifinfo
@tex
$$\int_0^u {\rm dn}(v, m) dv  = \int_0^\tau \sqrt{{1-m t^2}\over{1-t^2}} dt$$

where $\tau = {\rm sn}(u, m)$.
@end tex

This is related to @math{elliptic_e} by

@ifhtml
@math{elliptic_eu(u, m) = elliptic_e(asin(sn(u,m)),m)}
@end ifhtml
@ifinfo
@math{elliptic_eu(u, m) = elliptic_e(asin(sn(u,m)),m)}
@end ifinfo
@tex
$$E(u,m) = E(\phi, m)$$

where $\phi = \sin^{-1} {\rm sn}(u, m)$.
@end tex

See also @ref{elliptic_e}.
@opencatbox
@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

@ifhtml
@math{integrate(1/(1-n*sin(x)^2)/sqrt(1 - m*sin(x)^2), x, 0, phi)}
@end ifhtml
@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
@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

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

@tex
$$\int_0^{{\pi}\over{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 @code{makegamma} to evaluate them.

@opencatbox
@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

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

@tex
$$\int_0^{{\pi}\over{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 @code{makegamma} to evaluate them.

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

