# ellipj

## Purpose

Jacobian elliptic functions.

## Synopsis

    [sn,cn,dn] = ellipj(u,m)

## Description

`[sn,cn,dn] = ellipj(u,m)` returns the Jacobian elliptic functions `sn`, `cn`, and `dn` for the values in `u` evaluated at the corresponding parameters in `m`. Inputs `u` and `m` can contain scalars or matrices, but if they are both matrices, they must be the same size.

The Jacobian elliptic functions are defined in terms of the integral:

Then

Sometimes the elliptic functions are defined differently, which can lead to some confusion. The alternate definitions are usually in terms of the modulus ``k, which is related to `m` by:

The Jacobian elliptic functions obey many mathematical identities; for a good sample, see [1].

The accuracy of the result is `eps`; the value of `eps` can be changed for a less accurate, but more quickly computed answer.

## Algorithm

Compute the Jacobian elliptic functions using the method of the arithmetic-geometric mean [1]. Start with the triplet of numbers:

Compute successive iterates with

Next, calculate the amplitudes in radians using

being careful to unwrap the phases correctly. The Jacobian elliptic functions are then simply

## Limitations

`ellipj` is limited to the input domain 0 <= `m` <= 1. Other values of `m` can be mapped into this range using the transformations described in [1], equations 16.10 and 16.11. `u` is limited to real values.

## See Also

    ellipke

## References

[1] M. Abramowitz and I.A. Stegun, Handbook of Mathematical Functions, Dover Publications, 1965, 17.6.

(c) Copyright 1994 by The MathWorks, Inc.