ELLIPJ
Jacobi elliptic functions generalize circular and hyperbolic functions and are parameterized by an argument u and parameter m. This function returns the tuple \operatorname{sn}(u|m), \operatorname{cn}(u|m), \operatorname{dn}(u|m), and amplitude \phi.
The amplitude satisfies:
u = F(\phi,m),\qquad \operatorname{sn}(u|m)=\sin(\phi),\qquad \operatorname{cn}(u|m)=\cos(\phi)
This wrapper returns all four outputs in a single 2D row suitable for Excel spill output.
Excel Usage
=ELLIPJ(u, m)
u(float, required): Real argument of the Jacobi elliptic functions.m(float, required): Elliptic parameter, typically in the range from zero to one.
Returns (list[list]): One-row array with sn, cn, dn, and amplitude ph in that order.
Example 1: Jacobi outputs at zero argument
Inputs:
| u | m |
|---|---|
| 0 | 0.5 |
Excel formula:
=ELLIPJ(0, 0.5)
Expected output:
| Result | |||
|---|---|---|---|
| 0 | 1 | 1 | 0 |
Example 2: Jacobi outputs with zero parameter
Inputs:
| u | m |
|---|---|
| 1 | 0 |
Excel formula:
=ELLIPJ(1, 0)
Expected output:
| Result | |||
|---|---|---|---|
| 0.841471 | 0.540302 | 1 | 1 |
Example 3: Jacobi outputs at moderate argument and parameter
Inputs:
| u | m |
|---|---|
| 1 | 0.5 |
Excel formula:
=ELLIPJ(1, 0.5)
Expected output:
| Result | |||
|---|---|---|---|
| 0.803002 | 0.595977 | 0.823161 | 0.932315 |
Example 4: Jacobi outputs with parameter close to one
Inputs:
| u | m |
|---|---|
| 1 | 0.99 |
Excel formula:
=ELLIPJ(1, 0.99)
Expected output:
| Result | |||
|---|---|---|---|
| 0.762448 | 0.64705 | 0.651526 | 0.867088 |
Python Code
from scipy.special import ellipj as scipy_ellipj
def ellipj(u, m):
"""
Compute Jacobi elliptic functions sn, cn, dn and amplitude for scalar input.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.ellipj.html
This example function is provided as-is without any representation of accuracy.
Args:
u (float): Real argument of the Jacobi elliptic functions.
m (float): Elliptic parameter, typically in the range from zero to one.
Returns:
list[list]: One-row array with sn, cn, dn, and amplitude ph in that order.
"""
try:
sn, cn, dn, ph = scipy_ellipj(u, m)
return [[float(sn), float(cn), float(dn), float(ph)]]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Real argument of the Jacobi elliptic functions.
Elliptic parameter, typically in the range from zero to one.