This namespace contains function to compute various elliptic integrals in Carlson symmetric form, as well as the Jacobi elliptic functions.
This namespace contains function to compute various [elliptic integrals](https://en.wikipedia.org/wiki/Elliptic_integral) in [Carlson symmetric form](https://en.wikipedia.org/wiki/Carlson_symmetric_form), as well as the [Jacobi elliptic functions](https://en.wikipedia.org/wiki/Jacobi_elliptic_functions).
(carlson-rc x y)
Computes Carlson’s degenerate elliptic integral, $R_C(x, y)$. x
must be
nonnegative and y
must be nonzero. If y < 0
, the Cauchy principal value is
returned.
Internal details:
tiny
must be at least 5 times the machine underflow limitbig
at most one fifth the machine maximum overflow limit.Computes Carlson’s degenerate elliptic integral, $R_C(x, y)$. `x` must be nonnegative and `y` must be nonzero. If `y < 0`, the Cauchy principal value is returned. Internal details: - `tiny` must be at least 5 times the machine underflow limit - `big` at most one fifth the machine maximum overflow limit.
(carlson-rd x y z)
Comment from Press, section 6.11, page 257:
'Computes Carlson’s elliptic integral of the second kind, RD(x, y, z). x and y must be nonnegative, and at most one can be zero. z must be positive. TINY must be at least twice the negative 2/3 power of the machine overflow limit. BIG must be at most 0.1 × ERRTOL times the negative 2/3 power of the machine underflow limit.'
This is called Carlson-elliptic-2
in scmutils.
Comment from Press, section 6.11, page 257: 'Computes Carlson’s elliptic integral of the second kind, RD(x, y, z). x and y must be nonnegative, and at most one can be zero. z must be positive. TINY must be at least twice the negative 2/3 power of the machine overflow limit. BIG must be at most 0.1 × ERRTOL times the negative 2/3 power of the machine underflow limit.' This is called `Carlson-elliptic-2` in scmutils.
(carlson-rf x y z)
From W.H. Press, Numerical Recipes in C++, 2ed. NR::rf from section 6.11
Here's the reference for what's going on here: http://phys.uri.edu/nigh/NumRec/bookfpdf/f6-11.pdf
Comment from Press, page 257:
'Computes Carlson’s elliptic integral of the first kind, RF (x, y, z). x, y, and z must be nonnegative, and at most one can be zero. TINY must be at least 5 times the machine underflow limit, BIG at most one fifth the machine overflow limit.'
A value of 0.08 for the error tolerance parameter is adequate for single precision (7 significant digits). Since the error scales as 6 n, we see that 0.0025 will yield double precision (16 significant digits) and require at most two or three more iterations.'
This is called Carlson-elliptic-1
in scmutils.
From W.H. Press, Numerical Recipes in C++, 2ed. NR::rf from section 6.11 Here's the reference for what's going on here: http://phys.uri.edu/nigh/NumRec/bookfpdf/f6-11.pdf Comment from Press, page 257: 'Computes Carlson’s elliptic integral of the first kind, RF (x, y, z). x, y, and z must be nonnegative, and at most one can be zero. TINY must be at least 5 times the machine underflow limit, BIG at most one fifth the machine overflow limit.' A value of 0.08 for the error tolerance parameter is adequate for single precision (7 significant digits). Since the error scales as 6 n, we see that 0.0025 will yield double precision (16 significant digits) and require at most two or three more iterations.' This is called `Carlson-elliptic-1` in scmutils.
(carlson-rj x y z p)
Computes
Carlson’s elliptic
integral of the third
kind, RJ(x, y, z, p)
.
x
, y
, and z
must be nonnegative, and at most one can be zero. p
must
be nonzero.
If p < 0
, the Cauchy principal value is returned. tiny
internally must be
at least twice the cube root of the machine underflow limit, big
at most one
fifth the cube root of the machine overflow limit.
Computes [Carlson’s elliptic integral](https://en.wikipedia.org/wiki/Carlson_symmetric_form) of the third kind, `RJ(x, y, z, p)`. `x`, `y`, and `z` must be nonnegative, and at most one can be zero. `p` must be nonzero. If `p < 0`, the Cauchy principal value is returned. `tiny` internally must be at least twice the cube root of the machine underflow limit, `big` at most one fifth the cube root of the machine overflow limit.
(elliptic-e k)
(elliptic-e phi k)
Passing k
returns the complete elliptic integral of the second kind - see
Press, 6.11.20.
The two-arity version returns the Legendre elliptic integral of the second kind E(φ, k). See W.H. Press, Numerical Recipes in C++, 2ed. eq. 6.11.20.
See page 260.
Passing `k` returns the complete elliptic integral of the second kind - see Press, 6.11.20. The two-arity version returns the Legendre elliptic integral of the second kind E(φ, k). See W.H. Press, Numerical Recipes in C++, 2ed. eq. 6.11.20. See [page 260](http://phys.uri.edu/nigh/NumRec/bookfpdf/f6-11.pdf).
(elliptic-f phi k)
Legendre elliptic integral of the first kind F(φ, k). See W.H. Press, Numerical Recipes in C++, 2ed. eq. 6.11.19
See page 260.
Legendre elliptic integral of the first kind F(φ, k). See W.H. Press, Numerical Recipes in C++, 2ed. eq. 6.11.19 See [page 260](http://phys.uri.edu/nigh/NumRec/bookfpdf/f6-11.pdf).
(elliptic-integrals k continue)
Computes the first and second complete elliptic integrals at once, and passes
them to the supplied continuation as args K
and E
.
Computes the first and second complete elliptic integrals at once, and passes them to the supplied continuation as args `K` and `E`.
(elliptic-k k)
Complete elliptic integral of the first kind - see Press, 6.11.18.
Complete elliptic integral of the first kind - see Press, 6.11.18.
(elliptic-pi n k)
(elliptic-pi phi n k)
The two-arity call returns the complete elliptic integral of the third kind - see https://en.wikipedia.org/wiki/Carlson_symmetric_form#Complete_elliptic_integrals for reference.
The three-arity call returns the Legendre elliptic integral of the third kind
Π(φ, k). See W.H. Press, Numerical Recipes in C++, 2ed. eq. 6.11.21; Note that
our sign convention for n
is opposite theirs.
See page 260.
The two-arity call returns the complete elliptic integral of the third kind - see https://en.wikipedia.org/wiki/Carlson_symmetric_form#Complete_elliptic_integrals for reference. The three-arity call returns the Legendre elliptic integral of the third kind Π(φ, k). See W.H. Press, Numerical Recipes in C++, 2ed. eq. 6.11.21; Note that our sign convention for `n` is opposite theirs. See [page 260](http://phys.uri.edu/nigh/NumRec/bookfpdf/f6-11.pdf).
(jacobi-elliptic-functions u k)
(jacobi-elliptic-functions u k cont)
Direct Clojure translation (via the Scheme translation in scmutils) of W.H.
Press, Numerical Recipes, subroutine sncndn
.
Calls the supplied continuation cont
with sn
, cn
and dn
as defined
below.
If no cont
is supplied, returns a three-vector of sn
, cn
and dn
.
Comments from Press, page 261:
The Jacobian elliptic function sn is defined as follows: instead of considering the elliptic integral
$$u(y, k) \equiv u=F(\phi, k)$$
Consider the inverse function:
$$y = \sin \phi = \mathrm{sn}(u, k)$$
Equivalently,
$$u=\int_{0}^{\mathrm{sn}} \frac{d y}{\sqrt{\left(1-y^{2}\right)\left(1-k^{2} y^{2}\right)}}$$
When $k = 0$, $sn$ is just $\sin$. The functions $cn$ and $dn$ are defined by the relations
$$\mathrm{sn}^{2}+\mathrm{cn}^{2}=1, \quad k^{2} \mathrm{sn}^{2}+\mathrm{dn}^{2}=1$$
The function calls the continuation with all three functions $sn$, $cn$, and $dn$ since computing all three is no harder than computing any one of them.
Direct Clojure translation (via the Scheme translation in scmutils) of W.H. Press, Numerical Recipes, subroutine `sncndn`. Calls the supplied continuation `cont` with `sn`, `cn` and `dn` as defined below. If no `cont` is supplied, returns a three-vector of `sn`, `cn` and `dn`. Comments from Press, page 261: The Jacobian elliptic function sn is defined as follows: instead of considering the elliptic integral $$u(y, k) \equiv u=F(\phi, k)$$ Consider the _inverse_ function: ``` $$y = \sin \phi = \mathrm{sn}(u, k)$$ ``` Equivalently, ``` $$u=\int_{0}^{\mathrm{sn}} \frac{d y}{\sqrt{\left(1-y^{2}\right)\left(1-k^{2} y^{2}\right)}}$$ ``` When $k = 0$, $sn$ is just $\sin$. The functions $cn$ and $dn$ are defined by the relations ``` $$\mathrm{sn}^{2}+\mathrm{cn}^{2}=1, \quad k^{2} \mathrm{sn}^{2}+\mathrm{dn}^{2}=1$$ ``` The function calls the continuation with all three functions $sn$, $cn$, and $dn$ since computing all three is no harder than computing any one of them.
(k-and-deriv k)
Returns a pair of:
K
dK/dk
evaluated at k
.
Returns a pair of: - the elliptic integral of the first kind, `K` - the derivative `dK/dk` evaluated at `k`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close