1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
|
.. _acb-elliptic:
**acb_elliptic.h** -- elliptic integrals and functions of complex variables
===============================================================================
This module supports computation of elliptic (doubly periodic) functions,
and their inverses, elliptic integrals.
See :ref:`acb_modular.h <acb-modular>` for the closely related modular forms
and Jacobi theta functions.
Warning: incomplete elliptic integrals have very complicated
branch structure when extended to complex variables.
For some functions in this module, branch cuts may be
artifacts of the evaluation algorithm rather than having
a natural mathematical justification.
The user should, accordingly, watch out for edge cases where the functions
implemented here may differ from other systems or literature.
There may also exist points where a function should be well-defined
but the implemented algorithm
fails to produce a finite result due to artificial internal singularities.
Complete elliptic integrals
-------------------------------------------------------------------------------
.. function:: void acb_elliptic_k(acb_t res, const acb_t m, slong prec)
Computes the complete elliptic integral of the first kind
.. math::
K(m) = \int_0^{\pi/2} \frac{dt}{\sqrt{1-m \sin^2 t}}
= \int_0^1
\frac{dt}{\left(\sqrt{1-t^2}\right)\left(\sqrt{1-mt^2}\right)}
using the arithmetic-geometric mean: `K(m) = \pi / (2 M(\sqrt{1-m}))`.
.. function:: void acb_elliptic_k_jet(acb_ptr res, const acb_t m, slong len, slong prec)
Sets the coefficients in the array *res* to the power series expansion of the
complete elliptic integral of the first kind at the point *m* truncated to
length *len*, i.e. `K(m+x) \in \mathbb{C}[[x]]`.
.. function:: void _acb_elliptic_k_series(acb_ptr res, acb_srcptr m, slong mlen, slong len, slong prec)
.. function:: void acb_elliptic_k_series(acb_poly_t res, const acb_poly_t m, slong len, slong prec)
Sets *res* to the complete elliptic integral of the first kind of the
power series *m*, truncated to length *len*.
.. function:: void acb_elliptic_e(acb_t res, const acb_t m, slong prec)
Computes the complete elliptic integral of the second kind
.. math::
E(m) = \int_0^{\pi/2} \sqrt{1-m \sin^2 t} \, dt =
\int_0^1
\frac{\sqrt{1-mt^2}}{\sqrt{1-t^2}} \, dt
using `E(m) = (1-m)(2m K'(m) + K(m))` (where the prime
denotes a derivative, not a complementary integral).
.. function:: void acb_elliptic_pi(acb_t res, const acb_t n, const acb_t m, slong prec)
Evaluates the complete elliptic integral of the third kind
.. math::
\Pi(n, m) = \int_0^{\pi/2}
\frac{dt}{(1-n \sin^2 t) \sqrt{1-m \sin^2 t}} =
\int_0^1
\frac{dt}{(1-nt^2) \sqrt{1-t^2} \sqrt{1-mt^2}}.
This implementation currently uses the same algorithm as the corresponding
incomplete integral. It is therefore less efficient than the implementations
of the first two complete elliptic integrals which use the AGM.
Legendre incomplete elliptic integrals
-------------------------------------------------------------------------------
.. function:: void acb_elliptic_f(acb_t res, const acb_t phi, const acb_t m, int pi, slong prec)
Evaluates the Legendre incomplete elliptic integral of the first kind,
given by
.. math::
F(\phi,m) = \int_0^{\phi} \frac{dt}{\sqrt{1-m \sin^2 t}}
= \int_0^{\sin \phi}
\frac{dt}{\left(\sqrt{1-t^2}\right)\left(\sqrt{1-mt^2}\right)}
on the standard strip `-\pi/2 \le \operatorname{Re}(\phi) \le \pi/2`.
Outside this strip, the function extends quasiperiodically as
.. math::
F(\phi + n \pi, m) = 2 n K(m) + F(\phi,m), n \in \mathbb{Z}.
Inside the standard strip, the function is computed via
the symmetric integral `R_F`.
If the flag *pi* is set to 1, the variable `\phi` is replaced by
`\pi \phi`, changing the quasiperiod to 1.
The function reduces to a complete elliptic integral of the first kind
when `\phi = \frac{\pi}{2}`; that is,
`F\left(\frac{\pi}{2}, m\right) = K(m)`.
.. function:: void acb_elliptic_e_inc(acb_t res, const acb_t phi, const acb_t m, int pi, slong prec)
Evaluates the Legendre incomplete elliptic integral of the second kind,
given by
.. math::
E(\phi,m) = \int_0^{\phi} \sqrt{1-m \sin^2 t} \, dt =
\int_0^{\sin \phi}
\frac{\sqrt{1-mt^2}}{\sqrt{1-t^2}} \, dt
on the standard strip `-\pi/2 \le \operatorname{Re}(\phi) \le \pi/2`.
Outside this strip, the function extends quasiperiodically as
.. math::
E(\phi + n \pi, m) = 2 n E(m) + E(\phi,m), n \in \mathbb{Z}.
Inside the standard strip, the function is computed via
the symmetric integrals `R_F` and `R_D`.
If the flag *pi* is set to 1, the variable `\phi` is replaced by
`\pi \phi`, changing the quasiperiod to 1.
The function reduces to a complete elliptic integral of the second kind
when `\phi = \frac{\pi}{2}`; that is,
`E\left(\frac{\pi}{2}, m\right) = E(m)`.
.. function:: void acb_elliptic_pi_inc(acb_t res, const acb_t n, const acb_t phi, const acb_t m, int pi, slong prec)
Evaluates the Legendre incomplete elliptic integral of the third kind,
given by
.. math::
\Pi(n, \phi, m) = \int_0^{\phi}
\frac{dt}{(1-n \sin^2 t) \sqrt{1-m \sin^2 t}} =
\int_0^{\sin \phi}
\frac{dt}{(1-nt^2) \sqrt{1-t^2} \sqrt{1-mt^2}}
on the standard strip `-\pi/2 \le \operatorname{Re}(\phi) \le \pi/2`.
Outside this strip, the function extends quasiperiodically as
.. math::
\Pi(n, \phi + k \pi, m) = 2 k \Pi(n,m) + \Pi(n,\phi,m), k \in \mathbb{Z}.
Inside the standard strip, the function is computed via
the symmetric integrals `R_F` and `R_J`.
If the flag *pi* is set to 1, the variable `\phi` is replaced by
`\pi \phi`, changing the quasiperiod to 1.
The function reduces to a complete elliptic integral of the third kind
when `\phi = \frac{\pi}{2}`; that is,
`\Pi\left(n, \frac{\pi}{2}, m\right) = \Pi(n, m)`.
Carlson symmetric elliptic integrals
-------------------------------------------------------------------------------
Carlson symmetric forms are the preferred form of incomplete elliptic
integrals, due to their neat properties and relatively
simple computation based on duplication theorems.
There are five named functions: `R_F, R_G, R_J`, and `R_C`, `R_D` which
are special cases of `R_F` and `R_J` respectively.
We largely follow the definitions and algorithms
in [Car1995]_ and chapter 19 in [NIST2012]_.
.. function:: void acb_elliptic_rf(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, slong prec)
Evaluates the Carlson symmetric elliptic integral of the first kind
.. math::
R_F(x,y,z) = \frac{1}{2}
\int_0^{\infty} \frac{dt}{\sqrt{(t+x)(t+y)(t+z)}}
where the square root extends continuously from positive infinity.
The integral is well-defined for `x,y,z \notin (-\infty,0)`, and with
at most one of `x,y,z` being zero.
When some parameters are negative real numbers, the function is
still defined by analytic continuation.
In general, one or more duplication steps are applied until
`x,y,z` are close enough to use a multivariate Taylor series.
The special case `R_C(x, y) = R_F(x, y, y) = \frac{1}{2} \int_0^{\infty} (t+x)^{-1/2} (t+y)^{-1} dt`
may be computed by
setting *y* and *z* to the same variable.
(This case is not yet handled specially, but might be optimized in
the future.)
The *flags* parameter is reserved for future use and currently
does nothing. Passing 0 results in default behavior.
.. function:: void acb_elliptic_rg(acb_t res, const acb_t x, const acb_t y, const acb_t z, int flags, slong prec)
Evaluates the Carlson symmetric elliptic integral of the second kind
.. math::
R_G(x,y,z) = \frac{1}{4} \int_0^{\infty}
\frac{t}{\sqrt{(t+x)(t+y)(t+z)}}
\left( \frac{x}{t+x} + \frac{y}{t+y} + \frac{z}{t+z}\right) dt
where the square root is taken continuously as in `R_F`.
The evaluation is done by expressing `R_G` in terms of `R_F` and `R_D`.
There are no restrictions on the variables.
.. function:: void acb_elliptic_rj(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, slong prec)
.. function:: void acb_elliptic_rj_carlson(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, slong prec)
.. function:: void acb_elliptic_rj_integration(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, slong prec)
Evaluates the Carlson symmetric elliptic integral of the third kind
.. math::
R_J(x,y,z,p) = \frac{3}{2}
\int_0^{\infty} \frac{dt}{(t+p)\sqrt{(t+x)(t+y)(t+z)}}
where the square root is taken continuously as in `R_F`.
Three versions of this function are available: the *carlson* version
applies one or more duplication steps until `x,y,z,p` are close enough
to use a multivariate Taylor series.
The duplication algorithm is not correct for all possible
combinations of complex variables, since the square roots taken
during the computation can introduce spurious branch cuts.
According to [Car1995]_, a sufficient (but not necessary) condition
for correctness is that *x*, *y*, *z* have nonnegative
real part and that *p* has positive real part.
In other cases, the algorithm *might* still be correct, but no attempt
is made to check this; it is up to the user to verify that
the duplication algorithm is appropriate for the given parameters
before calling this function.
The *integration* algorithm uses explicit numerical integration to
translate the parameters to the right half-plane. This is reliable
but can be slow.
The default method uses the *carlson* algorithm when it is certain
to be correct, and otherwise falls back to the slow *integration*
algorithm.
The special case `R_D(x, y, z) = R_J(x, y, z, z)`
may be computed by setting *z* and *p* to the same variable.
This case is handled specially to avoid redundant arithmetic operations.
In this case, the *carlson* algorithm is correct for all *x*, *y* and *z*.
The *flags* parameter is reserved for future use and currently
does nothing. Passing 0 results in default behavior.
.. function:: void acb_elliptic_rc1(acb_t res, const acb_t x, slong prec)
This helper function computes the special case
`R_C(1, 1+x) = \operatorname{atan}(\sqrt{x})/\sqrt{x} = {}_2F_1(1,1/2,3/2,-x)`,
which is needed in the evaluation of `R_J`.
Weierstrass elliptic functions
-------------------------------------------------------------------------------
Elliptic functions may be defined on a general lattice
`\Lambda = \{m 2\omega_1 + n 2\omega_2\ : m, n \in \mathbb{Z}\}`
with half-periods `\omega_1, \omega_2`.
We simplify by setting
`2\omega_1 = 1, 2\omega_2 = \tau` with `\operatorname{im}(\tau) > 0`.
To evaluate the functions on a general lattice, it is enough to make a
linear change of variables.
The main reference is chapter 23 in [NIST2012]_.
.. function:: void acb_elliptic_p(acb_t res, const acb_t z, const acb_t tau, slong prec)
Computes Weierstrass's elliptic function
.. math::
\wp(z, \tau) = \frac{1}{z^2} + \sum_{n^2+m^2 \ne 0}
\left[ \frac{1}{(z+m+n\tau)^2} - \frac{1}{(m+n\tau)^2} \right]
which satisfies `\wp(z, \tau) = \wp(z + 1, \tau) = \wp(z + \tau, \tau)`.
To evaluate the function efficiently, we use the formula
.. math::
\wp(z, \tau) = \pi^2 \theta_2^2(0,\tau) \theta_3^2(0,\tau)
\frac{\theta_4^2(z,\tau)}{\theta_1^2(z,\tau)} -
\frac{\pi^2}{3} \left[ \theta_2^4(0,\tau) + \theta_3^4(0,\tau)\right].
.. function:: void acb_elliptic_p_prime(acb_t res, const acb_t z, const acb_t tau, slong prec)
Computes the derivative `\wp'(z, \tau)` of Weierstrass's elliptic function `\wp(z, \tau)`.
.. function:: void acb_elliptic_p_jet(acb_ptr res, const acb_t z, const acb_t tau, slong len, slong prec)
Computes the formal power series `\wp(z + x, \tau) \in \mathbb{C}[[x]]`,
truncated to length *len*. In particular, with *len* = 2, simultaneously
computes `\wp(z, \tau), \wp'(z, \tau)` which together generate
the field of elliptic functions with periods 1 and `\tau`.
.. function:: void _acb_elliptic_p_series(acb_ptr res, acb_srcptr z, slong zlen, const acb_t tau, slong len, slong prec)
.. function:: void acb_elliptic_p_series(acb_poly_t res, const acb_poly_t z, const acb_t tau, slong len, slong prec)
Sets *res* to the Weierstrass elliptic function of the power series *z*,
with periods 1 and *tau*, truncated to length *len*.
.. function:: void acb_elliptic_invariants(acb_t g2, acb_t g3, const acb_t tau, slong prec)
Computes the lattice invariants `g_2, g_3`. The Weierstrass elliptic
function satisfies the differential equation
`[\wp'(z, \tau)]^2 = 4 [\wp(z,\tau)]^3 - g_2 \wp(z,\tau) - g_3`.
Up to constant factors, the lattice invariants are the first two
Eisenstein series (see :func:`acb_modular_eisenstein`).
.. function:: void acb_elliptic_roots(acb_t e1, acb_t e2, acb_t e3, const acb_t tau, slong prec)
Computes the lattice roots `e_1, e_2, e_3`, which are the roots of
the polynomial `4z^3 - g_2 z - g_3`.
.. function:: void acb_elliptic_inv_p(acb_t res, const acb_t z, const acb_t tau, slong prec)
Computes the inverse of the Weierstrass elliptic function, which
satisfies `\wp(\wp^{-1}(z, \tau), \tau) = z`. This function is given
by the elliptic integral
.. math::
\wp^{-1}(z, \tau) = \frac{1}{2} \int_z^{\infty} \frac{dt}{\sqrt{(t-e_1)(t-e_2)(t-e_3)}}
= R_F(z-e_1,z-e_2,z-e_3).
.. function:: void acb_elliptic_zeta(acb_t res, const acb_t z, const acb_t tau, slong prec)
Computes the Weierstrass zeta function
.. math::
\zeta(z, \tau) = \frac{1}{z} + \sum_{n^2+m^2 \ne 0}
\left[ \frac{1}{z-m-n\tau} + \frac{1}{m+n\tau} + \frac{z}{(m+n\tau)^2} \right]
which is quasiperiodic with `\zeta(z + 1, \tau) = \zeta(z, \tau) + \zeta(1/2, \tau)`
and `\zeta(z + \tau, \tau) = \zeta(z, \tau) + \zeta(\tau/2, \tau)`.
.. function:: void acb_elliptic_sigma(acb_t res, const acb_t z, const acb_t tau, slong prec)
Computes the Weierstrass sigma function
.. math::
\sigma(z, \tau) = z \prod_{n^2+m^2 \ne 0}
\left[ \left(1-\frac{z}{m+n\tau}\right)
\exp\left(\frac{z}{m+n\tau} + \frac{z^2}{2(m+n\tau)^2} \right) \right]
which is quasiperiodic with `\sigma(z + 1, \tau) = -e^{2 \zeta(1/2, \tau) (z+1/2)} \sigma(z, \tau)`
and `\sigma(z + \tau, \tau) = -e^{2 \zeta(\tau/2, \tau) (z+\tau/2)} \sigma(z, \tau)`.
|