Elliptic integrals and functions arise in many areas of mathematics. For instance, the following ellipse:
has a circumferential length given by:
which is an incomplete elliptical integral of the second kind (see later definition).
Another example is provided by the pendulum equation, which
for large osciallation angles
The solution to this equation can be written in terms of one of Jacobi's elliptic functions (for details of the mathematics see Mathematics of the Pendulum). The period of oscillation can be expressed in terms of the complete elliptic integral of the first kind.
Finally, elliptic integrals of both the first and second kind are used in the determination of the large-deflection lateral force/deflection profile of the free end of a cantilever beam (for details see Bisshopp & Drucker: "Large Deflection of Cantilever Beams", Quarterly of Applied Mathematics, 3 272-275 (1945)).
This article is intended as a quick reference to those who wish to incorporate elliptic integrals and functions into a Python script.
A cycle of the elliptical function
The incomplete elliptic integral of the first kind is defined:
The complete elliptic integral of the first kind is defined:
The incomplete elliptic integral of the second kind is defined:
The complete elliptic integral of the second kind is defined:
The elliptic integrals of both the first kind and second kind can be incorporated into a Python script with the help of the scipy
library.
For a descripton of the scipy
functionality for the elliptic integral of the first kind see
scipy/special/ellipk.
For details of the elliptic integral of the second kind see
scipy/special/ellipe.
Note that the m
parameter used by
the ellipk
and ellipe
functions is equal to the square of the
Here is an example:- given an angle
and
# Assume that k and theta are defined previously.
from scipy.special import ellipk as F # complete elliptical integral of the first kind
from scipy.special import ellipkinc as Finc # incomplete elliptical integral of the first kind
from scipy.special import ellipe as E # complete elliptical integral of the second kind
from scipy.special import ellipeinc as Einc # incomplete elliptical integral of the second kind
m = k**2 # Calculate the m parameter
alpha = F(m) - Finc(theta, m)
dell = E(m) - Einc(theta, m)
delta = 1.0 - 2.0 * dell / alpha
Jacobi's elliptic functions are defined (for a parameter
- Amplitude
- Sinus Amplitudinis
- Cosinus Amplitudinis
- Delta Amplitudinis
Note that the amplitude function is equivalent to the inverse of the incomplete elliptic integral of the first kind.
The elliptic functions are easily incorporated into a Python script with the help of the scipy
library - for details see
scipy/special/ellipj. The ellipj
function returns a
list of four values, each corresponding to one of the elliptic functions introduced above. As was the case with the elliptic integrals,
it should be noted that the m
parameter used by
the ellipj
function is equal to the square of the
from scipy.special import ellipj as elliptic_fns
k = 0.5
x = 0.35
m = k**2
sncndn = elliptic_fns(x, m)
snxk = sncndn[0] # sn(x, k)
cnxk = sncndn[1] # cn(x, k)
dnxk = sncndn[2] # dn(x, k)
amxk = sncndn[3] # am(x, k)
Let's test the return value corresponding to the amxk
. It should satisfy:
where
from scipy.special import ellipkinc as Finc
y = Finc(amxk, m)
print(y) # y should be 0.35