Documentation

ellipj

Jacobi elliptic functions

Description

example

[SN,CN,DN] = ellipj(U,M)returns the Jacobi elliptic functionsSN,CN, andDNevaluated for corresponding elements of argumentUand parameterM. InputsUandMmust be the same size, or eitherUorMmust be scalar.

example

[SN,CN,DN] = ellipj(U,M,tol)computes the Jacobi elliptic functions to accuracytol. The default value oftoliseps. Increasetolfor a less accurate but more quickly computed answer.

Examples

collapse all

Find the Jacobi elliptic functions forU = 0.5andM = 0.25.

[s,c,d] = ellipj(0.5,0.25)
s = 0.4751
c = 0.8799
d = 0.9714

Plot the Jacobi elliptic functions for-5≤U≤5andM = 0.7.

M = 0.7; U = -5:0.01:5; [S,C,D] = ellipj(U,M); plot(U,S,U,C,U,D); legend('SN','CN','DN','Location','best') gridontitle('Jacobi Elliptic Functions sn,cn,dn')

Generate a surface plot of the Jacobi elliptic sn function for the allowed range ofMand-5≤U≤5.

[M,U] = meshgrid(0:0.1:1,-5:0.1:5); S = ellipj(U,M); surf(U,M,S) xlabel('U') ylabel('M') zlabel('sn') title('Surface Plot of Jacobi Elliptic Function sn')

The default value oftoliseps. Find the run time with the default value for arbitraryMusingticandtoc. Increasetolby a factor of 1000 and find the run time. Compare the run times.

tic ellipj(0.253,0.937)
ans = 0.2479
toc
Elapsed time is 0.051588 seconds.
tic ellipj(0.253,0.937,eps*1000)
ans = 0.2479
toc
Elapsed time is 0.043346 seconds.

ellipjruns significantly faster when tolerance is significantly increased.

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.Uis limited to real values. IfUis nonscalar,Mmust be a scalar or a nonscalar of the same size asU.

Data Types:single|double

Input array, specified as a scalar, vector, matrix, or multidimensional array.Mcan take values0≤m≤1. IfMis a nonscalar,Umust be a scalar or a nonscalar of the same size asM. Map other values ofMinto this range using the transformations described in[1], equations 16.10 and 16.11.

Data Types:single|double

Accuracy of result, specified as a nonnegative real number. The default value iseps.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Output Arguments

collapse all

Jacobi elliptic function sn, returned as a scalar, vector, matrix, or multidimensional array.

Jacobi elliptic function cn, returned as a scalar, vector, matrix, or multidimensional array.

Jacobi elliptic function dn, returned as a scalar, vector, matrix, or multidimensional array.

More About

collapse all

Jacobi Elliptic Functions

The Jacobi elliptic functions are defined in terms of the integral

u = 0 ϕ d θ 1 m sin 2 θ .

Then

s n ( u ) = sin ϕ , c n ( u ) = cos ϕ , d n ( u ) = 1 m sin 2 ϕ .

Some definitions of the elliptic functions use the elliptical moduluskor modular angleαinstead of the parameterm. They are related by

k 2 = m = sin 2 a .

The Jacobi elliptic functions obey many mathematical identities. For a good sample, see[1].

Algorithms

ellipjcomputes the Jacobi elliptic functions using the method of the arithmetic-geometric mean of[1]. It starts with the triplet of numbers

a 0 = 1 , b 0 = 1 m , c 0 = m .

ellipjcomputes successive iterations using

a i = 1 2 ( a i 1 + b i 1 ) b i = ( a i 1 b i 1 ) 1 2 c i = 1 2 ( a i 1 b i 1 ) .

Next, it calculates the amplitudes in radians using

sin ( 2 ϕ n 1 ϕ n ) = c n a n sin ( ϕ n ) ,

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

s n ( u ) = sin ϕ 0 c n ( u ) = cos ϕ 0 d n ( u ) = 1 m s n ( u ) 2 .

References

[1] Abramowitz, M. and I. A. Stegun,Handbook of Mathematical Functions,多佛酒吧lications, 1965, 17.6.

See Also

Introduced before R2006a