Jacobi elliptic function

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Jacobi elliptic function (/thread-9424.html)



Jacobi elliptic function - salvomic - 11-02-2017 12:26 PM

hi,
here is a first version of a program to return Jacobi elliptic function and its parameters (see here for theory).
This function is related to the Elliptic Integrals: see my version here in the Library.

INPUT: Jacobi_fn(φ, m)
where φ is the amplitude (φ=ASIN(x), where x is upper bound of Elliptic integral 1st kind expressed in other canonical form; the complete form has 0<=x<=1 or 0<=φ<=π/2); m=k^2 is the square of the eccentricity (0<=k<=1).

RETURN a matrix where the first row present u (elliptic integral 1st kind in the sine integral –with φ– form), φ, m and the second row sn (amplitude sine), cn (amplitude cosine) and dn (delta amplitude)

The Code:
Code:

// Jacobi elliptic functions
EXPORT jacobi_fn(φ, m)
// Elliptic integral of 1st kind
// φ = amplitude, m = k^2 where k is eccentricity
BEGIN
local θ, u, sn, cn, dn;
u := int(1/(SQRT(1-m*SIN(θ)*SIN(θ))),θ,0,φ);
sn :=  SIN(φ);
cn := COS(φ);
dn := SQRT(1-m*SIN(φ)*SIN(φ));
// RETURN a matrix with
// u (Elliptic integral 1st kind), φ, m
// sn (Amplitude Sine), cn (Amplitude Cosine), dn (Delta Amplitude)
RETURN [[u,φ,m], [sn, cn, dn]];
END;

For now there is no control for over boundary values.

Enjoy!
Salvo Micciché