# ellipj

Jacobi elliptic functions

## Syntax

``[SN,CN,DN] = ellipj(u,m)``

## Description

example

````[SN,CN,DN] = ellipj(u,m)` returns the Jacobi sn, cn, and dn elliptic functions evaluated for the corresponding elements of `u` and `m`. Inputs `u` and `m` must be the same size, or either `u` or `m` must be scalar.```

## Examples

collapse all

Compute the Jacobi elliptic functions for `u = 0.75` and `m = 0.5`. Because these numbers are not symbolic objects, you get floating-point results.

`[SN,CN,DN] = ellipj(0.75,0.5)`
```SN = 0.6585 ```
```CN = 0.7526 ```
```DN = 0.8850 ```

Compute the Jacobi elliptic functions for the same numbers converted to symbolic objects. For most symbolic (exact) numbers, `ellipj` returns results using the `jacobiSN`, `jacobiCN`, and `jacobiDN` functions.

`[SN,CN,DN] = ellipj(sym(3/4),sym(1/2))`
```SN =  $\mathrm{sn}\text{jacobiSN}\left(\frac{3}{4}|\frac{1}{2}\right)$```
```CN =  $\mathrm{cn}\text{jacobiCN}\left(\frac{3}{4}|\frac{1}{2}\right)$```
```DN =  $\mathrm{dn}\text{jacobiDN}\left(\frac{3}{4}|\frac{1}{2}\right)$```

Use `vpa` to approximate the symbolic results with floating-point numbers.

`vpa([SN,CN,DN],10)`
`ans = $\left(\begin{array}{ccc}0.6585147441& 0.7525678254& 0.8849741046\end{array}\right)$`

If the argument `m` is not in [0 1], then convert that argument to a symbolic object before using `ellipj`.

`[SN,CN,DN] = ellipj(1,sym(pi/2))`
```SN =  $\mathrm{sn}\text{jacobiSN}\left(1|\frac{\pi }{2}\right)$```
```CN =  $\mathrm{cn}\text{jacobiCN}\left(1|\frac{\pi }{2}\right)$```
```DN =  $\mathrm{dn}\text{jacobiDN}\left(1|\frac{\pi }{2}\right)$```

Alternatively, use `jacobiSN`, `jacobiCN`, and `jacobiDN` to compute the Jacobi elliptic functions separately.

`SN = jacobiSN(1,sym(pi/2))`
```SN =  $\mathrm{sn}\text{jacobiSN}\left(1|\frac{\pi }{2}\right)$```
`CN = jacobiCN(1,sym(pi/2))`
```CN =  $\mathrm{cn}\text{jacobiCN}\left(1|\frac{\pi }{2}\right)$```
`DN = jacobiDN(1,sym(pi/2))`
```DN =  $\mathrm{dn}\text{jacobiDN}\left(1|\frac{\pi }{2}\right)$```

Call `ellipj` for symbolic matrix input. When the input arguments are matrices with the same size, `ellipj` computes the Jacobi elliptic functions for each element.

`[SN,CN,DN] = ellipj(sym([-1 0; 1 1/2]),sym([1 pi/2; -1 0]))`
```SN =  $\left(\begin{array}{cc}-\mathrm{tanh}\left(1\right)& 0\\ \mathrm{sn}\text{jacobiSN}\left(1|-1\right)& \mathrm{sin}\left(\frac{1}{2}\right)\end{array}\right)$```
```CN =  $\left(\begin{array}{cc}\frac{1}{\mathrm{cosh}\left(1\right)}& 1\\ \mathrm{cn}\text{jacobiCN}\left(1|-1\right)& \mathrm{cos}\left(\frac{1}{2}\right)\end{array}\right)$```
```DN =  $\left(\begin{array}{cc}\frac{1}{\mathrm{cosh}\left(1\right)}& 1\\ \mathrm{dn}\text{jacobiDN}\left(1|-1\right)& 1\end{array}\right)$```

## Input Arguments

collapse all

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

## Output Arguments

collapse all

Jacobi sn elliptic function, returned as a symbolic expression.

Jacobi cn elliptic function, returned as a symbolic expression.

Jacobi dn elliptic function, returned as a symbolic expression.

collapse all

### Jacobi Elliptic Functions

The Jacobi elliptic functions are defined as

`$\begin{array}{l}\text{sn}\left(u,m\right)=\mathrm{sin}\varphi \\ \text{cn}\left(u,m\right)=\mathrm{cos}\varphi \\ \text{dn}\left(u,m\right)=\sqrt{1-m{\mathrm{sin}}^{2}\varphi }\end{array}$`

where ϕ satisfies the incomplete elliptic integral of the first kind

`$u={\int }_{0}^{\varphi }\frac{d\theta }{\sqrt{1-m{\mathrm{sin}}^{2}\theta }}\text{\hspace{0.17em}}.$`

## Tips

• Calling `ellipj` for numbers that are not symbolic objects invokes the MATLAB® `ellipj` function. This function accepts only ```0 <= m <= 1```. To compute the Jacobi elliptic functions for values out of this range, use `sym` or `vpa` to convert the numbers to symbolic objects, and then call `ellipj` for those symbolic objects. Alternatively, use the `jacobiSN`, `jacobiCN`, and `jacobiDN` functions to compute the elliptic functions separately.

• For most symbolic (exact) numbers, `ellipj` returns results using the `jacobiSN`, `jacobiCN`, and `jacobiDN` functions. You can approximate such results with floating-point numbers using `vpa`.

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