Liking cljdoc? Tell your friends :D
Clojure only.

fastmath.special

Special functions for real arguments and value.

  • Bessel J, Y, jinc
  • Modified Bessel I, K
  • Spherical Bessel j, y
  • Modified spherical Bessel i1, i2, k
  • Elliptic K, E, Pi, Rf, Rd, Rj, Rg, Rc
  • Jacobi am, sn, cn, dn, sc, sd, cs, cd, ds, dc, ns, nc, nd
  • Gamma, log, digamma, trigamma, polygamma, regularized, lower/upper incomplete
  • Beta, log, regularized, incomplete
  • Erf, inverse
  • Airy A, B with derivatives
  • Zeta (Riemann, Hurwitz), Eta (Dirichlet), Xi (Landau), Beta (Dirichlet)
  • Integrals: Si, Ci, li/Li, Ei, En, Ein
  • Hypergeometric 0F0, 0F1, 1F0, 1F1, 2F1, 2F0, 0F2, pFq, Kummers M, Tricomis U, Whittaker M and W
  • Lambert W (0 and -1)
  • Minkowski
  • Harmonic H
  • Owen's T
  • Complex: (log)Gamma, Hypergeometric pFq, Tricomis U, (scaled) Bessel K of half-odd order.

Conventions at the edges of the domain (the docstring of each function lists its own special values):

  • a function returns the limit when it exists and is the same from both sides: (gamma ##Inf), (log-gamma 0.0), (lambert-W ##Inf), (bessel-I0 ##-Inf), (elliptic-Rc 1.0 0.0) are ##Inf;
  • at a pole where the one-sided limits differ the result is ##NaN ((gamma 0.0), (digamma -1.0), (polygamma 2 -1.0)), except the signed zeros ((digamma 0.0) is ##-Inf, (digamma -0.0) is ##Inf) and the even-order poles with the same sign ((trigamma -1.0) is ##Inf);
  • arguments outside the real domain (a complex result) give ##NaN, for example (bessel-Y 0.5 -1.0) or (elliptic-E 2.0);
  • a result that does not fit in a double is ##Inf or ##-Inf, and that is too small is 0.0;
  • functions do not throw for arguments inside their documented domain; a caller error (an even order of bessel-K-half-odd) throws IllegalArgumentException.

The accuracy given in a docstring is the relative error measured against mpmath on a grid; the relative error close to a zero of an oscillating function is larger (the absolute error stays small).

Special functions for real arguments and value.

* Bessel J, Y, jinc
* Modified Bessel I, K 
* Spherical Bessel j, y
* Modified spherical Bessel i1, i2, k
* Elliptic K, E, Pi, Rf, Rd, Rj, Rg, Rc
* Jacobi am, sn, cn, dn, sc, sd, cs, cd, ds, dc, ns, nc, nd
* Gamma, log, digamma, trigamma, polygamma, regularized, lower/upper incomplete
* Beta, log, regularized, incomplete
* Erf, inverse
* Airy A, B with derivatives
* Zeta (Riemann, Hurwitz), Eta (Dirichlet), Xi (Landau), Beta (Dirichlet)
* Integrals: Si, Ci, li/Li, Ei, En, Ein
* Hypergeometric 0F0, 0F1, 1F0, 1F1, 2F1, 2F0, 0F2, pFq, Kummers M, Tricomis U, Whittaker M and W
* Lambert W (0 and -1)
* Minkowski
* Harmonic H
* Owen's T
* Complex: (log)Gamma, Hypergeometric pFq, Tricomis U, (scaled) Bessel K of half-odd order.

Conventions at the edges of the domain (the docstring of each function lists its own special values):

* a function returns the limit when it exists and is the same from both sides: `(gamma ##Inf)`, `(log-gamma 0.0)`, `(lambert-W ##Inf)`, `(bessel-I0 ##-Inf)`, `(elliptic-Rc 1.0 0.0)` are `##Inf`;
* at a pole where the one-sided limits differ the result is `##NaN` (`(gamma 0.0)`, `(digamma -1.0)`, `(polygamma 2 -1.0)`), except the signed zeros (`(digamma 0.0)` is `##-Inf`, `(digamma -0.0)` is `##Inf`) and the even-order poles with the same sign (`(trigamma -1.0)` is `##Inf`);
* arguments outside the real domain (a complex result) give `##NaN`, for example `(bessel-Y 0.5 -1.0)` or `(elliptic-E 2.0)`;
* a result that does not fit in a double is `##Inf` or `##-Inf`, and that is too small is `0.0`;
* functions do not throw for arguments inside their documented domain; a caller error (an even order of `bessel-K-half-odd`) throws `IllegalArgumentException`.

The accuracy given in a docstring is the relative error measured against `mpmath` on a grid; the relative error close to a zero of an oscillating function is larger (the absolute error stays small).
raw docstring

airy-Aiclj

(airy-Ai x)

Airy function of the first kind, $\mathrm{Ai}(x)$, the solution of $y''=xy$ decaying for $x\to+\infty$.

Parameters:

  • x (double): the argument.

Returns Ai(0)=0.355028…, Ai(Inf)=0, ##NaN for x<=-1e8 (the phase is lost) and for -Inf. Underflows to 0.0 above x≈108. Oscillates for negative x.

Accuracy: relative error about 1e-15 for x>-10; for negative x the absolute error is about the phase $\tfrac23|x|^{3/2}$ times the machine epsilon times the amplitude (1.6e-12 relative at -1000, 4e-8 at -1e6).

See also airy-Ai', airy-Bi.

Airy function of the first kind, $\\mathrm{Ai}(x)$, the solution of $y''=xy$ decaying for $x\\to+\\infty$.

Parameters:

- `x` (double): the argument.

Returns `Ai(0)=0.355028…`, `Ai(Inf)=0`, `##NaN` for `x<=-1e8` (the phase is lost) and for `-Inf`. Underflows to `0.0` above `x≈108`. Oscillates for negative `x`.

Accuracy: relative error about 1e-15 for `x>-10`; for negative `x` the absolute error is about the phase $\\tfrac23|x|^{3/2}$ times the machine epsilon times the amplitude (1.6e-12 relative at -1000, 4e-8 at -1e6).

See also [[airy-Ai']], [[airy-Bi]].
raw docstring

airy-Ai'clj

(airy-Ai' x)

Derivative of the Airy function of the first kind, $\mathrm{Ai}'(x)$.

Parameters:

  • x (double): the argument.

Returns Ai'(0)=-0.258819…, Ai'(Inf)=0, ##NaN for x<=-1e8 and for -Inf.

Accuracy: as airy-Ai.

See also airy-Ai, airy-Bi'.

Derivative of the Airy function of the first kind, $\\mathrm{Ai}'(x)$.

Parameters:

- `x` (double): the argument.

Returns `Ai'(0)=-0.258819…`, `Ai'(Inf)=0`, `##NaN` for `x<=-1e8` and for `-Inf`.

Accuracy: as [[airy-Ai]].

See also [[airy-Ai]], [[airy-Bi']].
raw docstring

airy-Biclj

(airy-Bi x)

Airy function of the second kind, $\mathrm{Bi}(x)$, the solution of $y''=xy$ growing for $x\to+\infty$.

Parameters:

  • x (double): the argument.

Returns Bi(0)=0.614926…, ##Inf at Inf and on overflow (x above about 104), ##NaN for x<=-1e8 and for -Inf.

Accuracy: as airy-Ai.

See also airy-Bi', airy-Ai.

Airy function of the second kind, $\\mathrm{Bi}(x)$, the solution of $y''=xy$ growing for $x\\to+\\infty$.

Parameters:

- `x` (double): the argument.

Returns `Bi(0)=0.614926…`, `##Inf` at `Inf` and on overflow (`x` above about 104), `##NaN` for `x<=-1e8` and for `-Inf`.

Accuracy: as [[airy-Ai]].

See also [[airy-Bi']], [[airy-Ai]].
raw docstring

airy-Bi'clj

(airy-Bi' x)

Derivative of the Airy function of the second kind, $\mathrm{Bi}'(x)$.

Parameters:

  • x (double): the argument.

Returns Bi'(0)=0.448288…, ##Inf at Inf and on overflow, ##NaN for x<=-1e8 and for -Inf.

Accuracy: as airy-Ai.

See also airy-Bi, airy-Ai'.

Derivative of the Airy function of the second kind, $\\mathrm{Bi}'(x)$.

Parameters:

- `x` (double): the argument.

Returns `Bi'(0)=0.448288…`, `##Inf` at `Inf` and on overflow, `##NaN` for `x<=-1e8` and for `-Inf`.

Accuracy: as [[airy-Ai]].

See also [[airy-Bi]], [[airy-Ai']].
raw docstring

bessel-Iclj

(bessel-I order x)

Modified Bessel function of the first kind of real order $\nu$, $I_\nu(x)$.

Parameters:

  • order (double): the order $\nu$; any real.
  • x (double): the argument; for x<0 only integer orders are defined, $I_n(-x)=(-1)^nI_n(x)$, other orders give ##NaN.

Returns 0.0 for order>0 at x=0, ##Inf at Inf; 0.0 for the order ##Inf or one beyond 2^53 in magnitude, ##NaN for ##-Inf (no limit); overflows to ##Inf and underflows to 0.0 where the true value does.

Accuracy: relative error below 1e-13 for orders up to 100 and x up to 700. At negative orders next to an integer the value is ill-conditioned in the order (relative condition number about |order|/d, d the distance to the integer): the error is up to that times the machine epsilon (1.6e-12 at the order -6+1.3e-4, x=0.0126).

See also bessel-K, bessel-J.

Modified Bessel function of the first kind of real order $\\nu$, $I_\\nu(x)$.

Parameters:

- `order` (double): the order $\\nu$; any real.
- `x` (double): the argument; for `x<0` only integer orders are defined, $I_n(-x)=(-1)^nI_n(x)$, other orders give `##NaN`.

Returns `0.0` for `order>0` at `x=0`, `##Inf` at `Inf`; `0.0` for the order `##Inf` or one beyond `2^53` in magnitude, `##NaN` for `##-Inf` (no limit); overflows to `##Inf` and underflows to `0.0` where the true value does.

Accuracy: relative error below 1e-13 for orders up to 100 and `x` up to 700. At negative orders next to an integer the value is ill-conditioned in the order (relative condition number about `|order|/d`, `d` the distance to the integer): the error is up to that times the machine epsilon (1.6e-12 at the order `-6+1.3e-4`, `x=0.0126`).

See also [[bessel-K]], [[bessel-J]].
raw docstring

bessel-I0clj

(bessel-I0 x)

Modified Bessel function of the first kind of order 0, $I_0(x)$.

Parameters:

  • x (double): the argument.

Returns 1.0 at 0 and ##Inf at ±Inf (and on overflow, |x| above about 713). Even function.

Accuracy: relative error about 1e-15.

See also bessel-I1, bessel-I, bessel-K0.

Modified Bessel function of the first kind of order 0, $I_0(x)$.

Parameters:

- `x` (double): the argument.

Returns `1.0` at 0 and `##Inf` at `±Inf` (and on overflow, `|x|` above about 713). Even function.

Accuracy: relative error about 1e-15.

See also [[bessel-I1]], [[bessel-I]], [[bessel-K0]].
raw docstring

bessel-I1clj

(bessel-I1 x)

Modified Bessel function of the first kind of order 1, $I_1(x)$.

Parameters:

  • x (double): the argument.

Returns 0.0 at 0 and ±Inf at ±Inf (and on overflow). Odd function.

Accuracy: relative error about 1e-15.

See also bessel-I0, bessel-I, bessel-K1.

Modified Bessel function of the first kind of order 1, $I_1(x)$.

Parameters:

- `x` (double): the argument.

Returns `0.0` at 0 and `±Inf` at `±Inf` (and on overflow). Odd function.

Accuracy: relative error about 1e-15.

See also [[bessel-I0]], [[bessel-I]], [[bessel-K1]].
raw docstring

bessel-Jclj

(bessel-J order x)

Bessel function of the first kind of real order $\nu$, $J_\nu(x)$.

Parameters:

  • order (double): the order $\nu$; any real. Orders 0 and 1 are delegated to bessel-J0 and bessel-J1.
  • x (double): the argument; for x<0 only integer orders are defined, $J_n(-x)=(-1)^nJ_n(x)$, other orders give ##NaN.

Returns 0.0 for order>0 at x=0, ±Inf for order<0 (non-integer) at x=0, and 0.0 at Inf; 0.0 for the order ##Inf or one beyond 2^53 in magnitude, ##NaN for ##-Inf (no limit); ##NaN for a ##NaN argument. Underflows to 0.0 and overflows to ±Inf where the true value does. Negative non-integer orders use the reflection $J_{-\nu}=\cos(\nu\pi)J_\nu-\sin(\nu\pi)Y_\nu$ with the trigonometric factors evaluated exactly.

Accuracy: relative error below 3e-12 for orders up to 100 and x up to 700 (absolute error about 1e-16 close to the zeros). At negative orders next to an integer the value is ill-conditioned in the order (relative condition number about |order|/d, d the distance to the integer): the error is up to that times the machine epsilon (1.4e-4 at the order -14+1e-12, x=0.0012).

See also bessel-Y, bessel-I, bessel-K.

Bessel function of the first kind of real order $\\nu$, $J_\\nu(x)$.

Parameters:

- `order` (double): the order $\\nu$; any real. Orders 0 and 1 are delegated to [[bessel-J0]] and [[bessel-J1]].
- `x` (double): the argument; for `x<0` only integer orders are defined, $J_n(-x)=(-1)^nJ_n(x)$, other orders give `##NaN`.

Returns `0.0` for `order>0` at `x=0`, `±Inf` for `order<0` (non-integer) at `x=0`, and `0.0` at `Inf`; `0.0` for the order `##Inf` or one beyond `2^53` in magnitude, `##NaN` for `##-Inf` (no limit); `##NaN` for a `##NaN` argument. Underflows to `0.0` and overflows to `±Inf` where the true value does. Negative non-integer orders use the reflection $J_{-\\nu}=\\cos(\\nu\\pi)J_\\nu-\\sin(\\nu\\pi)Y_\\nu$ with the trigonometric factors evaluated exactly.

Accuracy: relative error below 3e-12 for orders up to 100 and `x` up to 700 (absolute error about 1e-16 close to the zeros). At negative orders next to an integer the value is ill-conditioned in the order (relative condition number about `|order|/d`, `d` the distance to the integer): the error is up to that times the machine epsilon (1.4e-4 at the order `-14+1e-12`, `x=0.0012`).

See also [[bessel-Y]], [[bessel-I]], [[bessel-K]].
raw docstring

bessel-J0clj

(bessel-J0 x)

Bessel function of the first kind of order 0, $J_0(x)$.

Parameters:

  • x (double): the argument.

Returns 1.0 at 0 and 0.0 at ±Inf. Even function.

Accuracy: absolute error about 1e-16; relative error up to 3e-13 close to the zeros at large |x|. For large |x| the error relative to the amplitude grows like |x| times the machine epsilon (the phase x - pi/4 is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also bessel-J1, bessel-J, bessel-Y0.

Bessel function of the first kind of order 0, $J_0(x)$.

Parameters:

- `x` (double): the argument.

Returns `1.0` at 0 and `0.0` at `±Inf`. Even function.

Accuracy: absolute error about 1e-16; relative error up to 3e-13 close to the zeros at large `|x|`. For large `|x|` the error relative to the amplitude grows like `|x|` times the machine epsilon (the phase `x - pi/4` is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also [[bessel-J1]], [[bessel-J]], [[bessel-Y0]].
raw docstring

bessel-J1clj

(bessel-J1 x)

Bessel function of the first kind of order 1, $J_1(x)$.

Parameters:

  • x (double): the argument.

Returns 0.0 at 0 and ±Inf. Odd function.

Accuracy: relative error about 1e-14. For large |x| the error relative to the amplitude grows like |x| times the machine epsilon (the phase x - pi/4 is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also bessel-J0, bessel-J, bessel-Y1.

Bessel function of the first kind of order 1, $J_1(x)$.

Parameters:

- `x` (double): the argument.

Returns `0.0` at 0 and `±Inf`. Odd function.

Accuracy: relative error about 1e-14. For large `|x|` the error relative to the amplitude grows like `|x|` times the machine epsilon (the phase `x - pi/4` is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also [[bessel-J0]], [[bessel-J]], [[bessel-Y1]].
raw docstring

bessel-Kclj

(bessel-K order x)

Modified Bessel function of the second kind of real order $\nu$, $K_\nu(x)$.

Parameters:

  • order (double): the order $\nu$; any real, $K_{-\nu}=K_\nu$.
  • x (double): the argument, x>=0.

Returns ##Inf at x=0 and on overflow, 0.0 at Inf and on underflow, ##NaN for x<0; ##Inf for an infinite order or one beyond 2^53 in magnitude.

Accuracy: relative error below 1e-13 for orders up to 100 and x up to 700; next to an integer order for x<=1.5 (the Temme series within 1.5e-4 of it, the power series beyond) up to 1e-11.

See also bessel-I, bessel-J, bessel-K-half-odd.

Modified Bessel function of the second kind of real order $\\nu$, $K_\\nu(x)$.

Parameters:

- `order` (double): the order $\\nu$; any real, $K_{-\\nu}=K_\\nu$.
- `x` (double): the argument, `x>=0`.

Returns `##Inf` at `x=0` and on overflow, `0.0` at `Inf` and on underflow, `##NaN` for `x<0`; `##Inf` for an infinite order or one beyond `2^53` in magnitude.

Accuracy: relative error below 1e-13 for orders up to 100 and `x` up to 700; next to an integer order for `x<=1.5` (the Temme series within `1.5e-4` of it, the power series beyond) up to 1e-11.

See also [[bessel-I]], [[bessel-J]], [[bessel-K-half-odd]].
raw docstring

bessel-K-half-oddclj

(bessel-K-half-odd order x)

Bessel K_a function for a = order/2

Function accepts only odd integers for order, K is even in the order so a negative order gives the value for -order; an even order throws IllegalArgumentException.

Bessel K_a function for a = order/2

Function accepts only odd integers for order, `K` is even in the order so a negative `order` gives the value for `-order`; an even `order` throws `IllegalArgumentException`.
raw docstring

bessel-K-half-odd-complexclj

(bessel-K-half-odd-complex order x)

Bessel K_a function for a = order/2 for complex numbers

Function accepts only odd integers for order, K is even in the order so a negative order gives the value for -order; an even order throws IllegalArgumentException.

Bessel K_a function for a = order/2 for complex numbers

Function accepts only odd integers for order, `K` is even in the order so a negative `order` gives the value for `-order`; an even `order` throws `IllegalArgumentException`.
raw docstring

bessel-K-half-odd-scaledclj

(bessel-K-half-odd-scaled order x)

Bessel K_a function scaled by e^x for a = order/2

Function accepts only odd integers for order, K is even in the order so a negative order gives the value for -order; an even order throws IllegalArgumentException.

Bessel K_a function scaled by e^x for a = order/2

Function accepts only odd integers for order, `K` is even in the order so a negative `order` gives the value for `-order`; an even `order` throws `IllegalArgumentException`.
raw docstring

bessel-K-half-odd-scaled-complexclj

(bessel-K-half-odd-scaled-complex order x)

Bessel K_a function scaled by e^x for a = order/2 for complex numbers

Function accepts only odd integers for order, K is even in the order so a negative order gives the value for -order; an even order throws IllegalArgumentException.

Bessel K_a function scaled by e^x for a = order/2 for complex numbers

Function accepts only odd integers for order, `K` is even in the order so a negative `order` gives the value for `-order`; an even `order` throws `IllegalArgumentException`.
raw docstring

bessel-K0clj

(bessel-K0 x)

Modified Bessel function of the second kind of order 0, $K_0(x)$.

Parameters:

  • x (double): the argument, x>=0.

Returns ##Inf at 0, 0.0 at Inf (and on underflow, x above about 745) and ##NaN for x<0.

Accuracy: relative error about 1e-15.

See also bessel-K1, bessel-K, bessel-I0.

Modified Bessel function of the second kind of order 0, $K_0(x)$.

Parameters:

- `x` (double): the argument, `x>=0`.

Returns `##Inf` at 0, `0.0` at `Inf` (and on underflow, `x` above about 745) and `##NaN` for `x<0`.

Accuracy: relative error about 1e-15.

See also [[bessel-K1]], [[bessel-K]], [[bessel-I0]].
raw docstring

bessel-K1clj

(bessel-K1 x)

Modified Bessel function of the second kind of order 1, $K_1(x)$.

Parameters:

  • x (double): the argument, x>=0.

Returns ##Inf at 0, 0.0 at Inf and ##NaN for x<0.

Accuracy: relative error about 1e-15.

See also bessel-K0, bessel-K, bessel-I1.

Modified Bessel function of the second kind of order 1, $K_1(x)$.

Parameters:

- `x` (double): the argument, `x>=0`.

Returns `##Inf` at 0, `0.0` at `Inf` and `##NaN` for `x<0`.

Accuracy: relative error about 1e-15.

See also [[bessel-K0]], [[bessel-K]], [[bessel-I1]].
raw docstring

bessel-Yclj

(bessel-Y order x)

Bessel function of the second kind of real order $\nu$, $Y_\nu(x)$.

Parameters:

  • order (double): the order $\nu$; any real. Orders 0 and 1 are delegated to bessel-Y0 and bessel-Y1.
  • x (double): the argument, x>=0.

Returns ##-Inf at x=0, ##NaN for x<0 (the value is complex) and 0.0 at Inf; ##-Inf for the order ##Inf or one beyond 2^53 in magnitude, ##NaN for ##-Inf (no limit). Overflows to ##-Inf where the true value does (large order, small x). Negative non-integer orders use the reflection $Y_{-\nu}=\cos(\nu\pi)Y_\nu+\sin(\nu\pi)J_\nu$ with the trigonometric factors evaluated exactly (the naive factors lose all digits at half-integer orders).

Accuracy: relative error below 3e-12 for orders up to 100 and x up to 700, except next to an integer order where the power series is used (x<7, and also orders above 1.35x-4.5, e.g. order 11 at x=9.37): it cancels, the relative error is up to about 400 eps/d (d the distance of the order to the integer; 8e-8 at d=1e-6, 2.5e-6 at 1e-9, 5e-3 at 1e-12).

See also bessel-J, bessel-I, bessel-K.

Bessel function of the second kind of real order $\\nu$, $Y_\\nu(x)$.

Parameters:

- `order` (double): the order $\\nu$; any real. Orders 0 and 1 are delegated to [[bessel-Y0]] and [[bessel-Y1]].
- `x` (double): the argument, `x>=0`.

Returns `##-Inf` at `x=0`, `##NaN` for `x<0` (the value is complex) and `0.0` at `Inf`; `##-Inf` for the order `##Inf` or one beyond `2^53` in magnitude, `##NaN` for `##-Inf` (no limit). Overflows to `##-Inf` where the true value does (large order, small `x`). Negative non-integer orders use the reflection $Y_{-\\nu}=\\cos(\\nu\\pi)Y_\\nu+\\sin(\\nu\\pi)J_\\nu$ with the trigonometric factors evaluated exactly (the naive factors lose all digits at half-integer orders).

Accuracy: relative error below 3e-12 for orders up to 100 and `x` up to 700, except next to an integer order where the power series is used (`x<7`, and also orders above `1.35x-4.5`, e.g. order `11` at `x=9.37`): it cancels, the relative error is up to about `400 eps/d` (`d` the distance of the order to the integer; 8e-8 at `d=1e-6`, 2.5e-6 at `1e-9`, 5e-3 at `1e-12`).

See also [[bessel-J]], [[bessel-I]], [[bessel-K]].
raw docstring

bessel-Y0clj

(bessel-Y0 x)

Bessel function of the second kind of order 0, $Y_0(x)$.

Parameters:

  • x (double): the argument, x>=0.

Returns ##-Inf at 0, 0.0 at Inf and ##NaN for x<0 (the value is complex).

Accuracy: relative error about 1e-14. For large |x| the error relative to the amplitude grows like |x| times the machine epsilon (the phase x - pi/4 is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also bessel-Y1, bessel-Y, bessel-J0.

Bessel function of the second kind of order 0, $Y_0(x)$.

Parameters:

- `x` (double): the argument, `x>=0`.

Returns `##-Inf` at 0, `0.0` at `Inf` and `##NaN` for `x<0` (the value is complex).

Accuracy: relative error about 1e-14. For large `|x|` the error relative to the amplitude grows like `|x|` times the machine epsilon (the phase `x - pi/4` is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also [[bessel-Y1]], [[bessel-Y]], [[bessel-J0]].
raw docstring

bessel-Y1clj

(bessel-Y1 x)

Bessel function of the second kind of order 1, $Y_1(x)$.

Parameters:

  • x (double): the argument, x>=0.

Returns ##-Inf at 0, 0.0 at Inf and ##NaN for x<0 (the value is complex).

Accuracy: relative error about 2e-12 at large x (close to the zeros). For large |x| the error relative to the amplitude grows like |x| times the machine epsilon (the phase x - pi/4 is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also bessel-Y0, bessel-Y, bessel-J1.

Bessel function of the second kind of order 1, $Y_1(x)$.

Parameters:

- `x` (double): the argument, `x>=0`.

Returns `##-Inf` at 0, `0.0` at `Inf` and `##NaN` for `x<0` (the value is complex).

Accuracy: relative error about 2e-12 at large `x` (close to the zeros). For large `|x|` the error relative to the amplitude grows like `|x|` times the machine epsilon (the phase `x - pi/4` is rounded): 1e-11 at 1e5, 1e-10 at 1e6.

See also [[bessel-Y0]], [[bessel-Y]], [[bessel-J1]].
raw docstring

betaclj

(beta p q)

Computes the Beta function of p and q.

The Beta function is defined as Gamma(p)*Gamma(q)/Gamma(p+q), and is closely related to the Gamma function and to binomial coefficients.

Parameters:

  • p, q (double): real arguments.

Returns a double. Defined via analytic continuation for negative p and/or q as well. Returns ##NaN where p or q is a nonpositive integer (a true pole), except that if p+q is also a nonpositive integer while neither p nor q individually is, the two singularities cancel and 0.0 is returned instead. For a positive integer p with q and p+q non-positive integers, the poles of Gamma(q) and Gamma(p+q) cancel: the result is (-1)^p B(p, 1-p-q) (accurate for any magnitude), and symmetrically in p and q.

See also log-beta, regularized-beta, incomplete-beta, gamma.

Computes the Beta function of `p` and `q`.

The Beta function is defined as `Gamma(p)*Gamma(q)/Gamma(p+q)`, and is
closely related to the Gamma function and to binomial coefficients.

Parameters:

- `p`, `q` (double): real arguments.

Returns a double. Defined via analytic continuation for negative `p`
and/or `q` as well. Returns `##NaN` where `p` or `q` is a nonpositive
integer (a true pole), except that if `p+q` is also a nonpositive integer
while neither `p` nor `q` individually is, the two singularities cancel
and `0.0` is returned instead. For a positive integer `p` with `q` and
`p+q` non-positive integers, the poles of `Gamma(q)` and `Gamma(p+q)`
cancel: the result is `(-1)^p B(p, 1-p-q)` (accurate for any magnitude),
and symmetrically in `p` and `q`.

See also [[log-beta]], [[regularized-beta]], [[incomplete-beta]],
[[gamma]].
raw docstring

Ciclj

(Ci x)

Cosine integral, Ci(x) = -integral_x^Inf cos(t)/t dt, for x >= 0.

Equivalently, Ci(x) = gamma + ln(x) + integral_0^x (cos(t)-1)/t dt, where gamma is the Euler-Mascheroni constant. Ci has a logarithmic singularity at 0 (Ci(x) -> -Inf as x -> 0+), oscillates with decreasing amplitude for increasing x, and converges to 0 as x grows without bound.

Ci is only defined here for non-negative x: for negative x the natural continuation is genuinely complex (real part Ci(|x|), imaginary part pi), which a real-valued double-returning function cannot represent, so a negative x throws rather than silently returning just the real part.

Parameters:

  • x (double): evaluation point, must be non-negative.

Returns Ci(x) as a double. Throws an assertion error if x is negative. Returns ##-Inf at x = 0.0, 0.0 at x = ##Inf, and ##NaN for a ##NaN input.

Accuracy: absolute error about 1e-16; relative error up to 1.3e-13 close to the zeros.

See also Cin (the closely related entire cosine integral, defined for all real x), Si, si (the sine integral).

Cosine integral, `Ci(x) = -integral_x^Inf cos(t)/t dt`, for `x >= 0`.

Equivalently, `Ci(x) = gamma + ln(x) + integral_0^x (cos(t)-1)/t dt`, where
`gamma` is the Euler-Mascheroni constant. `Ci` has a logarithmic
singularity at `0` (`Ci(x) -> -Inf` as `x -> 0+`), oscillates with
decreasing amplitude for increasing `x`, and converges to `0` as `x` grows
without bound.

`Ci` is only defined here for non-negative `x`: for negative `x` the
natural continuation is genuinely complex (real part `Ci(|x|)`, imaginary
part `pi`), which a real-valued double-returning function cannot represent,
so a negative `x` throws rather than silently returning just the real
part.

Parameters:

- `x` (double): evaluation point, must be non-negative.

Returns `Ci(x)` as a double. Throws an assertion error if `x` is negative.
Returns `##-Inf` at `x = 0.0`, `0.0` at `x = ##Inf`, and `##NaN` for a
`##NaN` input.

Accuracy: absolute error about 1e-16; relative error up to 1.3e-13 close to the zeros.

See also [[Cin]] (the closely related entire cosine integral, defined for
all real `x`), [[Si]], [[si]] (the sine integral).
raw docstring

Cinclj

(Cin x)

Entire cosine integral, Cin(x) = integral_0^x (1-cos(t))/t dt.

Related to Ci by Cin(x) = gamma + ln(|x|) - Ci(|x|) for x != 0 (where gamma is the Euler-Mascheroni constant), but unlike Ci, Cin has no singularity at 0 (the integrand's 0/0 there is removable) and is defined for all real x, including negative values. Cin is an even function (Cin(-x) = Cin(x)), non-negative, and grows without bound (like ln(|x|)) as |x| grows without bound.

Parameters:

  • x (double): evaluation point, any real number.

Returns Cin(x) as a double. Cin(0.0) is 0.0, and Cin(x) diverges to ##Inf as x approaches either ##Inf or ##-Inf. Returns ##NaN for a ##NaN input.

Accuracy: relative error below 1e-15 (a Taylor series is used for |x| < 2, where gamma + ln|x| - Ci(|x|) loses all digits: the relative error was 1e-2 at x = 1e-6 before).

See also Ci, Si, si.

Entire cosine integral, `Cin(x) = integral_0^x (1-cos(t))/t dt`.

Related to [[Ci]] by `Cin(x) = gamma + ln(|x|) - Ci(|x|)` for `x != 0`
(where `gamma` is the Euler-Mascheroni constant), but unlike `Ci`, `Cin`
has no singularity at `0` (the integrand's `0/0` there is removable) and
is defined for all real `x`, including negative values. `Cin` is an even
function (`Cin(-x) = Cin(x)`), non-negative, and grows without bound
(like `ln(|x|)`) as `|x|` grows without bound.

Parameters:

- `x` (double): evaluation point, any real number.

Returns `Cin(x)` as a double. `Cin(0.0)` is `0.0`, and `Cin(x)` diverges to
`##Inf` as `x` approaches either `##Inf` or `##-Inf`. Returns `##NaN` for a
`##NaN` input.

Accuracy: relative error below 1e-15 (a Taylor series is used for `|x| < 2`, where `gamma + ln|x| - Ci(|x|)` loses all digits: the relative error was 1e-2 at `x = 1e-6` before).

See also [[Ci]], [[Si]], [[si]].
raw docstring

digammaclj

(digamma x)

First derivative of log of Gamma function.

Returns ##NaN at the negative integers, ##-Inf at 0.0 and ##Inf at -0.0 (the one-sided limits).

First derivative of log of Gamma function.

Returns `##NaN` at the negative integers, `##-Inf` at `0.0` and `##Inf` at `-0.0` (the one-sided limits).
raw docstring

dirichlet-betaclj

(dirichlet-beta x)

Dirichlet beta function $\beta(s)=\sum_{k\ge0}(-1)^k(2k+1)^{-s}$ (the Dirichlet L-function of the non-principal character modulo 4).

Parameters:

  • x (double): the argument $s$.

Returns beta(0)=1/2, beta(1)=π/4, beta(Inf)=1. Entire function; zero at the negative odd integers (returned as a value of order 1e-15).

Accuracy: relative error about 4e-14.

See also zeta, eta.

Dirichlet beta function $\\beta(s)=\\sum_{k\\ge0}(-1)^k(2k+1)^{-s}$ (the Dirichlet L-function of the non-principal character modulo 4).

Parameters:

- `x` (double): the argument $s$.

Returns `beta(0)=1/2`, `beta(1)=π/4`, `beta(Inf)=1`. Entire function; zero at the negative odd integers (returned as a value of order 1e-15).

Accuracy: relative error about 4e-14.

See also [[zeta]], [[eta]].
raw docstring

E0clj

(E0 x)

Exponential integral E0, E0(x) = exp(-x)/x, the n=0 case of En.

The simplest member of the generalized exponential integral family En(x) = integral_1^Inf exp(-x*t)/t^n dt; for n=0 this integral has a closed elementary form. E0 has a pole at 0 and decays to 0 for large positive x; for large negative x it diverges to -Inf.

Parameters:

  • x (double): evaluation point, any real number.

Returns E0(x) as a double. E0(0.0) is ##Inf and E0(-0.0) is ##-Inf (the one-sided limits), E0(##-Inf) is ##-Inf, E0(##Inf) is 0.0. Returns ##NaN for a ##NaN input.

Accuracy: relative error below 5e-16.

See also E1, En (generalizations to other orders), Ei.

Exponential integral E0, `E0(x) = exp(-x)/x`, the `n=0` case of [[En]].

The simplest member of the generalized exponential integral family
`En(x) = integral_1^Inf exp(-x*t)/t^n dt`; for `n=0` this integral has a
closed elementary form. `E0` has a pole at `0` and decays to `0` for large
positive `x`; for large negative `x` it diverges to `-Inf`.

Parameters:

- `x` (double): evaluation point, any real number.

Returns `E0(x)` as a double. `E0(0.0)` is `##Inf` and `E0(-0.0)` is `##-Inf` (the one-sided limits), `E0(##-Inf)`
is `##-Inf`, `E0(##Inf)` is `0.0`. Returns `##NaN` for a `##NaN` input.

Accuracy: relative error below 5e-16.

See also [[E1]], [[En]] (generalizations to other orders), [[Ei]].
raw docstring

E1clj

(E1 x)

Exponential integral E1, E1(x) = integral_1^Inf exp(-x*t)/t dt, for x >= 0 (the n=1 case of En).

E1 has a logarithmic singularity at 0 (E1(x) -> Inf as x -> 0+) and decreases monotonically to 0 as x grows without bound. It is only defined here for non-negative x: for negative x the natural continuation is complex, which a real-valued double-returning function cannot represent, so a negative x returns ##NaN rather than silently returning only part of the true (complex) result.

Parameters:

  • x (double): evaluation point, must be non-negative.

Returns E1(x) as a double. E1(0.0) is ##Inf, E1(##Inf) is 0.0; the value underflows to 0.0 above 745. Returns ##NaN for a ##NaN input or a negative x.

Accuracy: relative error below 6e-15.

See also Ein (the closely related entire exponential integral), E0, En (generalizations to other orders), Ei.

Exponential integral E1, `E1(x) = integral_1^Inf exp(-x*t)/t dt`, for
`x >= 0` (the `n=1` case of [[En]]).

`E1` has a logarithmic singularity at `0` (`E1(x) -> Inf` as `x -> 0+`)
and decreases monotonically to `0` as `x` grows without bound. It is only
defined here for non-negative `x`: for negative `x` the natural
continuation is complex, which a real-valued double-returning function
cannot represent, so a negative `x` returns `##NaN` rather than silently
returning only part of the true (complex) result.

Parameters:

- `x` (double): evaluation point, must be non-negative.

Returns `E1(x)` as a double. `E1(0.0)` is `##Inf`, `E1(##Inf)` is `0.0`; the value underflows to `0.0` above `745`.
Returns `##NaN` for a `##NaN` input or a negative `x`.

Accuracy: relative error below 6e-15.

See also [[Ein]] (the closely related entire exponential integral),
[[E0]], [[En]] (generalizations to other orders), [[Ei]].
raw docstring

Eiclj

(Ei x)

Exponential integral, Ei(x) = -integral_(-x)^Inf exp(-t)/t dt (Cauchy principal value), for x != 0.

Related to E1 by Ei(x) = -E1(-x) for x < 0. Ei has a logarithmic singularity at 0 (-Inf from the left, +Inf from the right), a single real zero near x = 0.3725, and grows without bound (like exp(x)/x) as x grows without bound; as x decreases without bound, Ei(x) approaches 0 from below.

Parameters:

  • x (double): evaluation point, any real number except 0.

Returns Ei(x) as a double. Ei(0.0) is ##-Inf, Ei(##Inf) is ##Inf, Ei(##-Inf) is -0.0. Returns ##NaN for a ##NaN input.

Accuracy: relative error below 2e-14 (2e-14 close to its zero at 0.3725).

See also E1, E0, En, li (related by li(x) = Ei(ln x)).

Exponential integral, `Ei(x) = -integral_(-x)^Inf exp(-t)/t dt` (Cauchy
principal value), for `x != 0`.

Related to [[E1]] by `Ei(x) = -E1(-x)` for `x < 0`. `Ei` has a logarithmic
singularity at `0` (`-Inf` from the left, `+Inf` from the right), a single
real zero near `x = 0.3725`, and grows without bound (like `exp(x)/x`) as
`x` grows without bound; as `x` decreases without bound, `Ei(x)`
approaches `0` from below.

Parameters:

- `x` (double): evaluation point, any real number except `0`.

Returns `Ei(x)` as a double. `Ei(0.0)` is `##-Inf`, `Ei(##Inf)` is `##Inf`,
`Ei(##-Inf)` is `-0.0`. Returns `##NaN` for a `##NaN` input.

Accuracy: relative error below 2e-14 (2e-14 close to its zero at 0.3725).

See also [[E1]], [[E0]], [[En]], [[li]] (related by `li(x) = Ei(ln x)`).
raw docstring

Einclj

(Ein x)

Entire exponential integral, Ein(x) = integral_0^x (1-exp(-t))/t dt.

Related to E1 by Ein(x) = E1(x) + ln(x) + gamma for x > 0 (where gamma is the Euler-Mascheroni constant), but unlike E1, Ein has no singularity at 0 (the integrand's 0/0 there is removable) and is, in principle, defined for every real (and complex) x. Ein grows without bound as x grows without bound, and approaches -##Inf as x decreases without bound (mirroring the corresponding limits of E1 + ln(x)).

Parameters:

  • x (double): evaluation point, any real number.

Returns Ein(x) as a double. Ein(0.0) is 0.0 and Ein(-0.0) is -0.0, Ein(##Inf) is ##Inf, Ein(##-Inf) is ##-Inf; the value overflows to ##-Inf below about -716.4. Returns ##NaN for a ##NaN input.

Computed by the entire power series for |x| <= 2.15 (both signs), as E1(x) + ln(x) + gamma above and as -Ei(-x) + ln(-x) + gamma below.

Accuracy: relative error below 2e-16 for |x| <= 2.15 (also for a tiny x, where Ein(x) is close to x), below 2e-14 elsewhere (1.6e-14 near -200, the error of Ei).

See also E1, Cin (the analogous entire form of the cosine integral), Ei.

Entire exponential integral, `Ein(x) = integral_0^x (1-exp(-t))/t dt`.

Related to [[E1]] by `Ein(x) = E1(x) + ln(x) + gamma` for `x > 0` (where
`gamma` is the Euler-Mascheroni constant), but unlike `E1`, `Ein` has no
singularity at `0` (the integrand's `0/0` there is removable) and is, in
principle, defined for every real (and complex) `x`. `Ein` grows without
bound as `x` grows without bound, and approaches `-##Inf` as `x` decreases
without bound (mirroring the corresponding limits of `E1 + ln(x)`).

Parameters:

- `x` (double): evaluation point, any real number.

Returns `Ein(x)` as a double. `Ein(0.0)` is `0.0` and `Ein(-0.0)` is `-0.0`, `Ein(##Inf)` is `##Inf`, `Ein(##-Inf)` is `##-Inf`; the value
overflows to `##-Inf` below about `-716.4`. Returns `##NaN` for a `##NaN` input.

Computed by the entire power series for `|x| <= 2.15` (both signs), as `E1(x) + ln(x) + gamma` above and as
`-Ei(-x) + ln(-x) + gamma` below.

Accuracy: relative error below 2e-16 for `|x| <= 2.15` (also for a tiny `x`, where `Ein(x)` is close to `x`), below
2e-14 elsewhere (1.6e-14 near `-200`, the error of [[Ei]]).

See also [[E1]], [[Cin]] (the analogous entire form of the cosine
integral), [[Ei]].
raw docstring

elliptic-Dclj

(elliptic-D m)
(elliptic-D phi m)

Legendre's elliptic integral $D(\phi,m)=\int_0^\phi \frac{\sin^2\theta}{\sqrt{1-m\sin^2\theta}}d\theta=\frac{F(\phi,m)-E(\phi,m)}{m}$.

Parameters:

  • phi (double, optional): the amplitude; omitted for the complete integral (phi=π/2). Any real, quasi-periodic as elliptic-F and elliptic-E.
  • m (double): the parameter, m<=1.

Returns π/4 at m=0 for the complete integral (the removable singularity of the quotient); Inf at m=1 for the complete integral; 0.0 for m=-Inf; ±Inf for phi=±Inf (m<=1); NaN for m>1. A power series in m is used for |m|<0.5, where the quotient cancels.

Accuracy: relative error about 1e-14.

See also elliptic-F, elliptic-E, elliptic-K.

Legendre's elliptic integral $D(\phi,m)=\int_0^\phi \frac{\sin^2\theta}{\sqrt{1-m\sin^2\theta}}d\theta=\frac{F(\phi,m)-E(\phi,m)}{m}$.

Parameters:

- `phi` (double, optional): the amplitude; omitted for the complete integral (`phi=π/2`). Any real, quasi-periodic as [[elliptic-F]] and [[elliptic-E]].
- `m` (double): the parameter, `m<=1`.

Returns `π/4` at `m=0` for the complete integral (the removable singularity of the quotient); `Inf` at `m=1` for the complete integral; `0.0` for `m=-Inf`; `±Inf` for `phi=±Inf` (`m<=1`); `NaN` for `m>1`. A power series in `m` is used for `|m|<0.5`, where the quotient cancels.

Accuracy: relative error about 1e-14.

See also [[elliptic-F]], [[elliptic-E]], [[elliptic-K]].
raw docstring

elliptic-Eclj

(elliptic-E m)
(elliptic-E phi m)

Complete and incomplete elliptic integral of the second kind, $E(\phi|m)=\int_0^\phi\sqrt{1-m\sin^2\theta},d\theta$.

Parameters:

  • phi (double, optional): the amplitude; omitted for the complete integral $E(m)=E(\pi/2|m)$. Any real: the incomplete integral is quasi-periodic, $E(\phi+k\pi|m)=E(\phi|m)+2kE(m)$.
  • m (double): the parameter, m<=1 (NaN for m>1, where the value is complex).

Returns E(1)=1 and E(±π/2|1)=±1; ±Inf for phi=±Inf (m<=1) and for m=-Inf (phi not zero); accurate for large negative m (the complement 1/(1-m) is carried exactly).

Accuracy: relative error about 2e-15, up to 6e-15 next to m=1.

See also elliptic-K, elliptic-F, elliptic-D.

Complete and incomplete elliptic integral of the second kind, $E(\phi|m)=\int_0^\phi\sqrt{1-m\sin^2\theta}\,d\theta$.

Parameters:

- `phi` (double, optional): the amplitude; omitted for the complete integral $E(m)=E(\pi/2|m)$. Any real: the incomplete integral is quasi-periodic, $E(\phi+k\pi|m)=E(\phi|m)+2kE(m)$.
- `m` (double): the parameter, `m<=1` (`NaN` for `m>1`, where the value is complex).

Returns `E(1)=1` and `E(±π/2|1)=±1`; `±Inf` for `phi=±Inf` (`m<=1`) and for `m=-Inf` (`phi` not zero); accurate for large negative `m` (the complement `1/(1-m)` is carried exactly).

Accuracy: relative error about 2e-15, up to 6e-15 next to `m=1`.

See also [[elliptic-K]], [[elliptic-F]], [[elliptic-D]].
raw docstring

elliptic-Fclj

(elliptic-F phi m)

Incomplete elliptic integral of the first kind, $F(\phi|m)=\int_0^\phi\frac{d\theta}{\sqrt{1-m\sin^2\theta}}$.

Parameters:

  • phi (double): the amplitude; any real, quasi-periodic: $F(\phi+k\pi|m)=F(\phi|m)+2kK(m)$.
  • m (double): the parameter, m<=1.

Returns Inf for phi=π/2 and m=1; ±Inf for phi=±Inf (m<=1); 0.0 for m=-Inf (finite phi). The inverse in phi is jacobi-am.

Accuracy: relative error about 1e-15, up to 2e-14 next to m=1.

See also elliptic-K, elliptic-E, jacobi-am.

Incomplete elliptic integral of the first kind, $F(\phi|m)=\int_0^\phi\frac{d\theta}{\sqrt{1-m\sin^2\theta}}$.

Parameters:

- `phi` (double): the amplitude; any real, quasi-periodic: $F(\phi+k\pi|m)=F(\phi|m)+2kK(m)$.
- `m` (double): the parameter, `m<=1`.

Returns `Inf` for `phi=π/2` and `m=1`; `±Inf` for `phi=±Inf` (`m<=1`); `0.0` for `m=-Inf` (finite `phi`). The inverse in `phi` is [[jacobi-am]].

Accuracy: relative error about 1e-15, up to 2e-14 next to `m=1`.

See also [[elliptic-K]], [[elliptic-E]], [[jacobi-am]].
raw docstring

elliptic-Kclj

(elliptic-K m)
(elliptic-K phi m)

Elliptic K - complete (K) and incomplete (F) elliptic integral of the first kind.

Elliptic K - complete (K) and incomplete (F) elliptic integral of the first kind.
raw docstring

elliptic-PIclj

(elliptic-PI n m)
(elliptic-PI n phi m)

Complete and incomplete elliptic integral of the third kind, $\Pi(n;\phi|m)=\int_0^\phi\frac{d\theta}{(1-n\sin^2\theta)\sqrt{1-m\sin^2\theta}}$.

Parameters:

  • n (double): the characteristic, n<=1.
  • phi (double, optional): the amplitude; omitted for the complete integral $\Pi(n|m)=\Pi(n;\pi/2|m)$. Any real, quasi-periodic: $\Pi(n;\phi+k\pi|m)=\Pi(n;\phi|m)+2k\Pi(n|m)$.
  • m (double): the parameter, m<=1.

Returns Inf for the complete integral at m=1; 0.0 for n=-Inf; ±Inf for phi=±Inf (n<1, m<=1); ##NaN for n=1 (a pole, the one-sided limits differ), for n>1 (a principal value, not supported) and for m>1. For large negative n the result cancels: relative error about sqrt(-n) times 1e-16 (1e-11 at n=-1e10), more next to m=1 (3e-12 at n=-1.8e5, m=1-1.5e-11).

Accuracy: relative error about 1e-15.

See also elliptic-K, elliptic-E.

Complete and incomplete elliptic integral of the third kind, $\Pi(n;\phi|m)=\int_0^\phi\frac{d\theta}{(1-n\sin^2\theta)\sqrt{1-m\sin^2\theta}}$.

Parameters:

- `n` (double): the characteristic, `n<=1`.
- `phi` (double, optional): the amplitude; omitted for the complete integral $\Pi(n|m)=\Pi(n;\pi/2|m)$. Any real, quasi-periodic: $\Pi(n;\phi+k\pi|m)=\Pi(n;\phi|m)+2k\Pi(n|m)$.
- `m` (double): the parameter, `m<=1`.

Returns `Inf` for the complete integral at `m=1`; `0.0` for `n=-Inf`; `±Inf` for `phi=±Inf` (`n<1`, `m<=1`); `##NaN` for `n=1` (a pole, the one-sided limits differ), for `n>1` (a principal value, not supported) and for `m>1`. For large negative `n` the result cancels: relative error about `sqrt(-n)` times 1e-16 (1e-11 at `n=-1e10`), more next to `m=1` (3e-12 at `n=-1.8e5`, `m=1-1.5e-11`).

Accuracy: relative error about 1e-15.

See also [[elliptic-K]], [[elliptic-E]].
raw docstring

elliptic-Rcclj

(elliptic-Rc x y)

Carlson's degenerate symmetric elliptic integral $R_C(x,y)=\frac12\int_0^\infty\frac{dt}{(t+y)\sqrt{t+x}}$.

Parameters:

  • x (double): x>=0.
  • y (double): y!=0; for y<0 the Cauchy principal value.

Returns Inf for y=0 (the integral diverges) and for x=y=0; 0.0 for an infinite argument and for x=0, y<0; ##NaN for x<0 or a NaN argument. Elementary: $R_C(x,x)=1/\sqrt x$.

Accuracy: relative error about 2e-16.

See also elliptic-Rf, elliptic-Rj.

Carlson's degenerate symmetric elliptic integral $R_C(x,y)=\frac12\int_0^\infty\frac{dt}{(t+y)\sqrt{t+x}}$.

Parameters:

- `x` (double): `x>=0`.
- `y` (double): `y!=0`; for `y<0` the Cauchy principal value.

Returns `Inf` for `y=0` (the integral diverges) and for `x=y=0`; `0.0` for an infinite argument and for `x=0`, `y<0`; `##NaN` for `x<0` or a `NaN` argument. Elementary: $R_C(x,x)=1/\sqrt x$.

Accuracy: relative error about 2e-16.

See also [[elliptic-Rf]], [[elliptic-Rj]].
raw docstring

elliptic-Rdclj

(elliptic-Rd x y z)

Carlson's symmetric elliptic integral of the second kind $R_D(x,y,z)=\frac32\int_0^\infty\frac{dt}{\sqrt{(t+x)(t+y)}(t+z)^{3/2}}$ (symmetric in x and y).

Parameters:

  • x, y, z (double): non-negative, x and y not both zero, z>0.

Returns Inf for z=0 and for x=y=0; 0.0 for an infinite argument (otherwise); ##NaN for negative or NaN arguments.

Accuracy: relative error about 2e-16.

See also elliptic-Rf, elliptic-Rj, elliptic-E.

Carlson's symmetric elliptic integral of the second kind $R_D(x,y,z)=\frac32\int_0^\infty\frac{dt}{\sqrt{(t+x)(t+y)}(t+z)^{3/2}}$ (symmetric in `x` and `y`).

Parameters:

- `x`, `y`, `z` (double): non-negative, `x` and `y` not both zero, `z>0`.

Returns `Inf` for `z=0` and for `x=y=0`; `0.0` for an infinite argument (otherwise); `##NaN` for negative or `NaN` arguments.

Accuracy: relative error about 2e-16.

See also [[elliptic-Rf]], [[elliptic-Rj]], [[elliptic-E]].
raw docstring

elliptic-Rfclj

(elliptic-Rf x y z)

Carlson's symmetric elliptic integral of the first kind $R_F(x,y,z)=\frac12\int_0^\infty\frac{dt}{\sqrt{(t+x)(t+y)(t+z)}}$.

Parameters:

  • x, y, z (double): non-negative, at most one of them zero.

Returns Inf when two of the arguments are zero; 0.0 for an infinite argument (otherwise); ##NaN for negative or NaN arguments. Symmetric in all arguments, $R_F(x,x,x)=1/\sqrt x$.

Accuracy: relative error about 3e-16.

See also elliptic-K, elliptic-F, elliptic-Rd.

Carlson's symmetric elliptic integral of the first kind $R_F(x,y,z)=\frac12\int_0^\infty\frac{dt}{\sqrt{(t+x)(t+y)(t+z)}}$.

Parameters:

- `x`, `y`, `z` (double): non-negative, at most one of them zero.

Returns `Inf` when two of the arguments are zero; `0.0` for an infinite argument (otherwise); `##NaN` for negative or `NaN` arguments. Symmetric in all arguments, $R_F(x,x,x)=1/\sqrt x$.

Accuracy: relative error about 3e-16.

See also [[elliptic-K]], [[elliptic-F]], [[elliptic-Rd]].
raw docstring

elliptic-Rgclj

(elliptic-Rg x y z)

Carlson's symmetric elliptic integral of the second kind $R_G(x,y,z)=\frac14\int_0^\infty\frac{1}{\sqrt{(t+x)(t+y)(t+z)}}\left(\frac{x}{t+x}+\frac{y}{t+y}+\frac{z}{t+z}\right)t,dt$.

Parameters:

  • x, y, z (double): non-negative.

Returns 0.0 for x=y=z=0, Inf for an infinite argument; ##NaN for negative or NaN arguments. Symmetric in all arguments.

Accuracy: relative error about 6e-16.

See also elliptic-Rf, elliptic-Rd, elliptic-E.

Carlson's symmetric elliptic integral of the second kind $R_G(x,y,z)=\frac14\int_0^\infty\frac{1}{\sqrt{(t+x)(t+y)(t+z)}}\left(\frac{x}{t+x}+\frac{y}{t+y}+\frac{z}{t+z}\right)t\,dt$.

Parameters:

- `x`, `y`, `z` (double): non-negative.

Returns `0.0` for `x=y=z=0`, `Inf` for an infinite argument; `##NaN` for negative or `NaN` arguments. Symmetric in all arguments.

Accuracy: relative error about 6e-16.

See also [[elliptic-Rf]], [[elliptic-Rd]], [[elliptic-E]].
raw docstring

elliptic-Rjclj

(elliptic-Rj x y z p)

Carlson's symmetric elliptic integral of the third kind $R_J(x,y,z,p)=\frac32\int_0^\infty\frac{dt}{\sqrt{(t+x)(t+y)(t+z)}(t+p)}$.

Parameters:

  • x, y, z (double): non-negative, at most one of them zero.
  • p (double): p!=0; for p<0 the Cauchy principal value.

Returns Inf for p=0; 0.0 for an infinite argument; ##NaN for negative x, y, z or a NaN argument. Symmetric in x, y, z. Huge arguments are rescaled by homogeneity. For p<0 the principal value can be ill-conditioned when a zero argument meets widely spread ones (the leading terms cancel).

Accuracy: relative error about 4e-16.

See also elliptic-Rf, elliptic-Rd, elliptic-PI.

Carlson's symmetric elliptic integral of the third kind $R_J(x,y,z,p)=\frac32\int_0^\infty\frac{dt}{\sqrt{(t+x)(t+y)(t+z)}(t+p)}$.

Parameters:

- `x`, `y`, `z` (double): non-negative, at most one of them zero.
- `p` (double): `p!=0`; for `p<0` the Cauchy principal value.

Returns `Inf` for `p=0`; `0.0` for an infinite argument; `##NaN` for negative `x`, `y`, `z` or a `NaN` argument. Symmetric in `x`, `y`, `z`. Huge arguments are rescaled by homogeneity. For `p<0` the principal value can be ill-conditioned when a zero argument meets widely spread ones (the leading terms cancel).

Accuracy: relative error about 4e-16.

See also [[elliptic-Rf]], [[elliptic-Rd]], [[elliptic-PI]].
raw docstring

Enclj

(En n x)

Generalized exponential integral, En(x) = integral_1^Inf exp(-x*t)/t^n dt, for any real order n.

Includes E0 and E1 as the n=0 and n=1 special cases. For positive x, En decreases monotonically to 0 as x grows without bound. As x -> 0+, En diverges to ##Inf when n <= 1 (the defining integral itself diverges there), but converges to the finite value 1/(n-1) when n > 1.

Negative x is supported only when n is a non-positive integer (n <= 0): in that case En reduces to an elementary function of x and exp(-x) with no branch cut, so it stays real. For any other order (fractional, or a positive integer) with negative x, the natural continuation is complex, which a real-valued double-returning function cannot represent, so the result is ##NaN.

Parameters:

  • n (double): the order, any real number (integer or fractional).
  • x (double): evaluation point.

Returns En(x) as a double. At x = 0.0: ##Inf if n <= 1, 1/(n-1) otherwise. For a negative integer order the value overflows to ##-Inf as x -> -Inf (and at ##-Inf). Returns ##NaN for a ##NaN n or x, or for a negative x outside the non-positive-integer-order case described above.

See also E0, E1, Ei.

Generalized exponential integral, `En(x) = integral_1^Inf exp(-x*t)/t^n
dt`, for any real order `n`.

Includes [[E0]] and [[E1]] as the `n=0` and `n=1` special cases. For
positive `x`, `En` decreases monotonically to `0` as `x` grows without
bound. As `x -> 0+`, `En` diverges to `##Inf` when `n <= 1` (the defining
integral itself diverges there), but converges to the finite value
`1/(n-1)` when `n > 1`.

Negative `x` is supported only when `n` is a non-positive integer (`n <=
0`): in that case `En` reduces to an elementary function of `x` and
`exp(-x)` with no branch cut, so it stays real. For any other order
(fractional, or a positive integer) with negative `x`, the natural
continuation is complex, which a real-valued double-returning function
cannot represent, so the result is `##NaN`.

Parameters:

- `n` (double): the order, any real number (integer or fractional).
- `x` (double): evaluation point.

Returns `En(x)` as a double. At `x = 0.0`: `##Inf` if `n <= 1`, `1/(n-1)`
otherwise. For a negative integer order the value overflows to `##-Inf` as `x -> -Inf` (and at `##-Inf`). Returns
`##NaN` for a `##NaN` `n` or `x`, or for a negative `x` outside the non-positive-integer-order case described above.

See also [[E0]], [[E1]], [[Ei]].
raw docstring

erfclj

(erf x)
(erf x1 x2)

Error function $\operatorname{erf}(x)=\frac{2}{\sqrt\pi}\int_0^x e^{-t^2}dt$.

Parameters:

  • x (double): the argument; or
  • x1, x2 (double): two arguments, the result is erf(x2) - erf(x1).

Returns a value in $[-1,1]$; erf(±Inf)=±1, NaN for NaN. The two-argument form is accurate for x1 and x2 close to each other.

Accuracy: relative error about 1e-15 (Apache Commons Math).

See also erfc, inv-erf.

Error function $\operatorname{erf}(x)=\frac{2}{\sqrt\pi}\int_0^x e^{-t^2}dt$.

Parameters:

- `x` (double): the argument; or
- `x1`, `x2` (double): two arguments, the result is `erf(x2) - erf(x1)`.

Returns a value in $[-1,1]$; `erf(±Inf)=±1`, `NaN` for `NaN`. The two-argument form is accurate for `x1` and `x2` close to each other.

Accuracy: relative error about 1e-15 (Apache Commons Math).

See also [[erfc]], [[inv-erf]].
raw docstring

erfcclj

(erfc x)

Complementary error function $\operatorname{erfc}(x)=1-\operatorname{erf}(x)$.

Parameters:

  • x (double): the argument.

Returns a value in $[0,2]$; erfc(Inf)=0, erfc(-Inf)=2. The result is computed without cancellation for large x and underflows to 0.0 above x ≈ 27.2.

Accuracy: relative error below 1e-13 up to x = 26 (Apache Commons Math).

See also erf, inv-erfc.

Complementary error function $\operatorname{erfc}(x)=1-\operatorname{erf}(x)$.

Parameters:

- `x` (double): the argument.

Returns a value in $[0,2]$; `erfc(Inf)=0`, `erfc(-Inf)=2`. The result is computed without cancellation for large `x` and underflows to `0.0` above `x ≈ 27.2`.

Accuracy: relative error below 1e-13 up to `x = 26` (Apache Commons Math).

See also [[erf]], [[inv-erfc]].
raw docstring

etaclj

(eta x)

Dirichlet eta function $\eta(s)=\sum_{k\ge1}(-1)^{k-1}k^{-s}=(1-2^{1-s})\zeta(s)$ (the alternating zeta function).

Parameters:

  • x (double): the argument $s$.

Returns eta(0)=1/2, eta(1)=ln 2, eta(Inf)=1. The removable singularity at 1 is handled. Entire function.

Accuracy: relative error about 1e-13.

See also zeta, dirichlet-beta.

Dirichlet eta function $\\eta(s)=\\sum_{k\\ge1}(-1)^{k-1}k^{-s}=(1-2^{1-s})\\zeta(s)$ (the alternating zeta function).

Parameters:

- `x` (double): the argument $s$.

Returns `eta(0)=1/2`, `eta(1)=ln 2`, `eta(Inf)=1`. The removable singularity at 1 is handled. Entire function.

Accuracy: relative error about 1e-13.

See also [[zeta]], [[dirichlet-beta]].
raw docstring

gammaclj

(gamma x)

Gamma function $\Gamma(x)$, the extension of the factorial: $\Gamma(n)=(n-1)!$.

Parameters:

  • x (double): the argument.

Returns ##NaN at the poles (zero and the negative integers, where the two one-sided limits differ) and at -Inf; ##Inf at ##Inf and when the result overflows (x above 171.62); a (sub)normal value down to x = -184 for negative non-integers, which then underflows to a signed zero.

Accuracy: relative error about 1e-14 over the whole range (Apache Commons Math Lanczos approximation, with the power split in two halves above x = 140, where Commons Math itself overflows).

See also log-gamma, digamma, beta.

Gamma function $\Gamma(x)$, the extension of the factorial: $\Gamma(n)=(n-1)!$.

Parameters:

- `x` (double): the argument.

Returns `##NaN` at the poles (zero and the negative integers, where the two one-sided limits differ) and at `-Inf`; `##Inf` at `##Inf` and when the result overflows (`x` above 171.62); a (sub)normal value down to `x = -184` for negative non-integers, which then underflows to a signed zero.

Accuracy: relative error about 1e-14 over the whole range (Apache Commons Math Lanczos approximation, with the power split in two halves above `x = 140`, where Commons Math itself overflows).

See also [[log-gamma]], [[digamma]], [[beta]].
raw docstring

gamma-complexclj

(gamma-complex z)

Complex version of the gamma function (principal branch), exp(log-gamma-complex z).

Parameters:

  • z ([[Vec2]]): the argument.

Returns Gamma(z). At most poles of Gamma (z a negative real integer), returns ##NaN, matching the real-valued gamma's own convention at its poles (unlike log-gamma-complex, which encodes those same poles as an infinite log value with an equally infinite imaginary part; exponentiating that back does not recover any single well-defined complex infinity, since Gamma has no direction-independent limit there). At z = 0.0+0.0i specifically, log-gamma-complex instead encodes the pole with a finite imaginary part (approaching along the positive real axis), so this returns a genuine signed infinity there (##Inf real part) instead of ##NaN, unlike gamma's own x = 0.0 convention.

See also log-gamma-complex, gamma.

Complex version of the gamma function (principal branch), `exp(log-gamma-complex z)`.

Parameters:

- `z` ([[Vec2]]): the argument.

Returns `Gamma(z)`. At most poles of Gamma (`z` a negative real integer), returns `##NaN`, matching the real-valued [[gamma]]'s own convention at its poles (unlike [[log-gamma-complex]], which encodes those same poles as an infinite log value with an equally infinite imaginary part; exponentiating that back does not recover any single well-defined complex infinity, since Gamma has no direction-independent limit there). At `z = 0.0+0.0i` specifically, [[log-gamma-complex]] instead encodes the pole with a finite imaginary part (approaching along the positive real axis), so this returns a genuine signed infinity there (`##Inf` real part) instead of `##NaN`, unlike [[gamma]]'s own `x = 0.0` convention.

See also [[log-gamma-complex]], [[gamma]].
raw docstring

hankel-1clj

(hankel-1 order x)

Hankel function of the first kind, $H^{(1)}\nu(x)=J\nu(x)+iY_\nu(x)$, as a complex number [[Vec2]].

Parameters:

  • order (double): the order $\nu$.
  • x (double): the argument. For x<0 the principal branch is used (the cut lies on the negative real axis, arg x = π): $H^{(1)}\nu(-x) = (\sin(\nu\pi)Y\nu(x)-\cos(\nu\pi)J_\nu(x)) + i(\sin(\nu\pi)J_\nu(x)+\cos(\nu\pi)Y_\nu(x))$.

Returns [Inf -Inf]-like values at x=0 where Y diverges.

See also hankel-2, bessel-J, bessel-Y.

Hankel function of the first kind, $H^{(1)}_\nu(x)=J_\nu(x)+iY_\nu(x)$, as a complex number [[Vec2]].

Parameters:

- `order` (double): the order $\nu$.
- `x` (double): the argument. For `x<0` the principal branch is used (the cut lies on the negative real axis, `arg x = π`):
  $H^{(1)}_\nu(-x) = (\sin(\nu\pi)Y_\nu(x)-\cos(\nu\pi)J_\nu(x)) + i(\sin(\nu\pi)J_\nu(x)+\cos(\nu\pi)Y_\nu(x))$.

Returns `[Inf -Inf]`-like values at `x=0` where `Y` diverges.

See also [[hankel-2]], [[bessel-J]], [[bessel-Y]].
raw docstring

hankel-2clj

(hankel-2 order x)

Hankel function of the second kind, $H^{(2)}\nu(x)=J\nu(x)-iY_\nu(x)$, as a complex number [[Vec2]].

Parameters:

  • order (double): the order $\nu$.
  • x (double): the argument. For x<0 the principal branch is used (arg x = π): $H^{(2)}\nu(-x) = (3\cos(\nu\pi)J\nu(x)-\sin(\nu\pi)Y_\nu(x)) + i(\sin(\nu\pi)J_\nu(x)-\cos(\nu\pi)Y_\nu(x))$.

See also hankel-1, bessel-J, bessel-Y.

Hankel function of the second kind, $H^{(2)}_\nu(x)=J_\nu(x)-iY_\nu(x)$, as a complex number [[Vec2]].

Parameters:

- `order` (double): the order $\nu$.
- `x` (double): the argument. For `x<0` the principal branch is used (`arg x = π`):
  $H^{(2)}_\nu(-x) = (3\cos(\nu\pi)J_\nu(x)-\sin(\nu\pi)Y_\nu(x)) + i(\sin(\nu\pi)J_\nu(x)-\cos(\nu\pi)Y_\nu(x))$.

See also [[hankel-1]], [[bessel-J]], [[bessel-Y]].
raw docstring

harmonic-numberclj

(harmonic-number n)
(harmonic-number n m)

Harmonic number $H_n=\psi(n+1)+\gamma$, or the generalized harmonic number $H_{n,m}=\zeta(m)-\zeta(m,n+1)=\sum_{k=1}^n k^{-m}$.

Parameters:

  • n (double): the number of terms; any real is allowed by the analytic continuation.
  • m (double, optional): the power; m=1 (default) gives $H_n$, m=0 gives n.

Returns 0.0 at n=0. ##NaN at the negative integers n (poles of the digamma function).

Accuracy: relative error about 1e-14.

See also digamma, zeta.

Harmonic number $H_n=\psi(n+1)+\gamma$, or the generalized harmonic number $H_{n,m}=\zeta(m)-\zeta(m,n+1)=\sum_{k=1}^n k^{-m}$.

Parameters:

- `n` (double): the number of terms; any real is allowed by the analytic continuation.
- `m` (double, optional): the power; `m=1` (default) gives $H_n$, `m=0` gives `n`.

Returns `0.0` at `n=0`. `##NaN` at the negative integers `n` (poles of the digamma function).

Accuracy: relative error about 1e-14.

See also [[digamma]], [[zeta]].
raw docstring

hypergeometric-0F0clj

(hypergeometric-0F0 x)

Hypergeometric ₀F₀ function.

The degenerate generalized hypergeometric series with no numerator and no denominator parameters, sum_n x^n / n!, identically equal to exp(x) for every real x.

Parameters:

  • x (double): the argument.

Returns exp(x). Well-defined and finite for every finite x; returns ##Inf for x = ##Inf, 0.0 for x = ##-Inf, and ##NaN for ##NaN.

See also hypergeometric-1F0, hypergeometric-0F1, hypergeometric-pFq.

Hypergeometric ₀F₀ function.

The degenerate generalized hypergeometric series with no numerator and no denominator parameters, `sum_n x^n / n!`, identically equal to `exp(x)` for every real `x`.

Parameters:

- `x` (double): the argument.

Returns `exp(x)`. Well-defined and finite for every finite `x`; returns `##Inf` for `x = ##Inf`, `0.0` for `x = ##-Inf`, and `##NaN` for `##NaN`.

See also [[hypergeometric-1F0]], [[hypergeometric-0F1]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-0F1clj

(hypergeometric-0F1 a x)

Confluent hypergeometric ₀F₁ limit function.

The generalized hypergeometric series with no numerator parameters and one denominator parameter, sum_n x^n / ((a)_n n!) (using the Pochhammer symbol (a)_n), closely related to the Bessel functions: 0F1(;a;x) = Gamma(a) x^((1-a)/2) I_(a-1)(2 sqrt(x)) for x > 0, with I replaced by the ordinary Bessel J for x < 0.

Parameters:

  • a (double): the denominator parameter.
  • x (double): the argument.

Returns 1.0 for x = 0.0, for every a. Has poles at a equal to a non-positive integer (0, -1, -2, and so on) for any x != 0.0, where ##NaN is returned; elsewhere the result is real and finite.

See also hypergeometric-0F0, hypergeometric-1F0, hypergeometric-1F1, bessel-I, bessel-J, hypergeometric-pFq.

Confluent hypergeometric ₀F₁ limit function.

The generalized hypergeometric series with no numerator parameters and one denominator parameter, `sum_n x^n / ((a)_n n!)` (using the Pochhammer symbol `(a)_n`), closely related to the Bessel functions: `0F1(;a;x) = Gamma(a) x^((1-a)/2) I_(a-1)(2 sqrt(x))` for `x > 0`, with `I` replaced by the ordinary Bessel `J` for `x < 0`.

Parameters:

- `a` (double): the denominator parameter.
- `x` (double): the argument.

Returns `1.0` for `x = 0.0`, for every `a`. Has poles at `a` equal to a non-positive integer (0, -1, -2, and so on) for any `x != 0.0`, where `##NaN` is returned; elsewhere the result is real and finite.

See also [[hypergeometric-0F0]], [[hypergeometric-1F0]], [[hypergeometric-1F1]], [[bessel-I]], [[bessel-J]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-0F2clj

(hypergeometric-0F2 a b x)

Generalized hypergeometric ₀F₂ function.

The generalized hypergeometric series with no numerator parameters and two denominator parameters, sum_n x^n / ((a)_n (b)_n n!) (using the Pochhammer symbol (a)_n).

Parameters:

  • a, b (double): the two denominator parameters.
  • x (double): the argument.

Returns 1.0 for x = 0.0, for every a and b. Has a genuine pole (returns ##NaN) whenever a or b is a non-positive integer and x != 0.0, since both parameters appear only in the denominator and so cannot terminate the series the way a non-positive-integer numerator parameter would; elsewhere the result is real and finite.

See also hypergeometric-0F1, hypergeometric-1F1, hypergeometric-2F0, hypergeometric-pFq.

Generalized hypergeometric ₀F₂ function.

The generalized hypergeometric series with no numerator parameters and two denominator parameters, `sum_n x^n / ((a)_n (b)_n n!)` (using the Pochhammer symbol `(a)_n`).

Parameters:

- `a`, `b` (double): the two denominator parameters.
- `x` (double): the argument.

Returns `1.0` for `x = 0.0`, for every `a` and `b`. Has a genuine pole (returns `##NaN`) whenever `a` or `b` is a non-positive integer and `x != 0.0`, since both parameters appear only in the denominator and so cannot terminate the series the way a non-positive-integer numerator parameter would; elsewhere the result is real and finite.

See also [[hypergeometric-0F1]], [[hypergeometric-1F1]], [[hypergeometric-2F0]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-1F0clj

(hypergeometric-1F0 a x)

Hypergeometric ₁F₀ function.

The generalized hypergeometric series with one numerator parameter and no denominator parameters, equal on the real line to the binomial series (1-x)^(-a). For a a non-positive integer the series terminates, giving a polynomial in x that is real and finite for every x.

Parameters:

  • a (double): the numerator parameter.
  • x (double): the argument.

Returns (1-x)^(-a). Diverges to ##Inf (or ##-Inf, depending on sign) as x approaches 1.0 from below when a is positive and not a non-positive integer. For x >= 1.0 the result stays on the real line only when a is an integer (of any sign); otherwise the true value is complex and ##NaN is returned. Returns 1.0 for a = 0.0 regardless of x.

See also hypergeometric-0F0, hypergeometric-0F1, hypergeometric-2F1, hypergeometric-pFq.

Hypergeometric ₁F₀ function.

The generalized hypergeometric series with one numerator parameter and no denominator parameters, equal on the real line to the binomial series `(1-x)^(-a)`. For `a` a non-positive integer the series terminates, giving a polynomial in `x` that is real and finite for every `x`.

Parameters:

- `a` (double): the numerator parameter.
- `x` (double): the argument.

Returns `(1-x)^(-a)`. Diverges to `##Inf` (or `##-Inf`, depending on sign) as `x` approaches `1.0` from below when `a` is positive and not a non-positive integer. For `x >= 1.0` the result stays on the real line only when `a` is an integer (of any sign); otherwise the true value is complex and `##NaN` is returned. Returns `1.0` for `a = 0.0` regardless of `x`.

See also [[hypergeometric-0F0]], [[hypergeometric-0F1]], [[hypergeometric-2F1]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-1F1clj

(hypergeometric-1F1 a b x)

Confluent hypergeometric ₁F₁ function of the first kind, also known as Kummer's function M.

The generalized hypergeometric series with one numerator and one denominator parameter, sum_n (a)_n x^n / ((b)_n n!) (using the Pochhammer symbol (a)_n). Alias for kummers-M.

Parameters:

  • a (double): the numerator parameter.
  • b (double): the denominator parameter.
  • x (double): the argument.

Returns 1.0 for x = 0.0 regardless of a and b, and also 1.0 whenever a = 0.0 regardless of x and b (the series then has only its constant term).

Has a genuine pole (returns ##NaN) when b is a non-positive integer, unless a is also a non-positive integer no more negative than b, in which case the series terminates to a finite polynomial in x before ever reaching the pole. When a equals b on a negative integer, numerator and denominator vanish together at the same term, a removable coincidence whose value is the corresponding truncated exponential series, not exp(x); exp(x) remains the correct result for every other case of a = b (zero, positive, or non-integer). For b = 0.0 with a != 0.0, diverges to a signed ##Inf or ##-Inf depending on the sign of a * x. Returns a signed ##Inf (rather than ##NaN) whenever the true magnitude exceeds the double-precision range.

See also kummers-M, whittaker-M, tricomis-U, hypergeometric-0F1, hypergeometric-2F1, hypergeometric-pFq.

Confluent hypergeometric ₁F₁ function of the first kind, also known as Kummer's function M.

The generalized hypergeometric series with one numerator and one denominator parameter, `sum_n (a)_n x^n / ((b)_n n!)` (using the Pochhammer symbol `(a)_n`). Alias for [[kummers-M]].

Parameters:

- `a` (double): the numerator parameter.
- `b` (double): the denominator parameter.
- `x` (double): the argument.

Returns `1.0` for `x = 0.0` regardless of `a` and `b`, and also `1.0` whenever `a = 0.0` regardless of `x` and `b` (the series then has only its constant term).

Has a genuine pole (returns `##NaN`) when `b` is a non-positive integer, unless `a` is also a non-positive integer no more negative than `b`, in which case the series terminates to a finite polynomial in `x` before ever reaching the pole. When `a` equals `b` on a negative integer, numerator and denominator vanish together at the same term, a removable coincidence whose value is the corresponding truncated exponential series, not `exp(x)`; `exp(x)` remains the correct result for every other case of `a = b` (zero, positive, or non-integer). For `b = 0.0` with `a != 0.0`, diverges to a signed `##Inf` or `##-Inf` depending on the sign of `a * x`. Returns a signed `##Inf` (rather than `##NaN`) whenever the true magnitude exceeds the double-precision range.

See also [[kummers-M]], [[whittaker-M]], [[tricomis-U]], [[hypergeometric-0F1]], [[hypergeometric-2F1]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-2F0clj

(hypergeometric-2F0 a b x)

Generalized hypergeometric ₂F₀ function.

The generalized hypergeometric series with two numerator parameters and no denominator parameters, sum_n (a)_n (b)_n x^n / n! (using the Pochhammer symbol (a)_n). Unlike hypergeometric-0F1 or hypergeometric-0F2, this series diverges for every x != 0.0 (its radius of convergence is 0), except when a or b is a non-positive integer, in which case it terminates to a finite polynomial; otherwise it is understood here via resummation of the divergent series, the same technique underlying tricomis-U.

Parameters:

  • a, b (double): the two numerator parameters.
  • x (double): the argument.

Returns 1.0 for x = 0.0. When a or b is a non-positive integer, the result is a finite polynomial in x, real for every x. Otherwise, the resummed value matches the standard real result for x <= 0.0; for x > 0.0 the resummation of a divergent series is inherently branch-dependent (other conventions, such as Borel summation, can give a genuinely complex result there instead), so the real value returned should not be assumed to match every other convention.

See also hypergeometric-1F1, hypergeometric-2F1, tricomis-U, hypergeometric-pFq.

Generalized hypergeometric ₂F₀ function.

The generalized hypergeometric series with two numerator parameters and no denominator parameters, `sum_n (a)_n (b)_n x^n / n!` (using the Pochhammer symbol `(a)_n`). Unlike [[hypergeometric-0F1]] or [[hypergeometric-0F2]], this series diverges for every `x != 0.0` (its radius of convergence is `0`), except when `a` or `b` is a non-positive integer, in which case it terminates to a finite polynomial; otherwise it is understood here via resummation of the divergent series, the same technique underlying [[tricomis-U]].

Parameters:

- `a`, `b` (double): the two numerator parameters.
- `x` (double): the argument.

Returns `1.0` for `x = 0.0`. When `a` or `b` is a non-positive integer, the result is a finite polynomial in `x`, real for every `x`. Otherwise, the resummed value matches the standard real result for `x <= 0.0`; for `x > 0.0` the resummation of a divergent series is inherently branch-dependent (other conventions, such as Borel summation, can give a genuinely complex result there instead), so the real value returned should not be assumed to match every other convention.

See also [[hypergeometric-1F1]], [[hypergeometric-2F1]], [[tricomis-U]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-2F1clj

(hypergeometric-2F1 a b c x)

Gauss's hypergeometric ₂F₁ function.

The classical generalized hypergeometric series with two numerator and one denominator parameter, sum_n (a)_n (b)_n / (c)_n * x^n / n! (using the Pochhammer symbol (a)_n), convergent for |x| < 1 and analytically continued elsewhere on the real line.

Parameters:

  • a, b (double): the two numerator parameters.
  • c (double): the denominator parameter.
  • x (double): the argument.

Returns 1.0 for x = 0.0. When a or b is a non-positive integer, the series terminates to a finite polynomial in x, real for every x (subject to the usual pole in c, described below); a degree above 1e7 returns ##NaN (the polynomial sum is linear in the degree and loses about the degree times the machine epsilon: 5e-10 at 1e7). Otherwise: for x < 1.0, real and finite; at x = 1.0, follows Gauss's summation theorem, finite when c-a-b > 0 and diverging to ##Inf when c-a-b <= 0; for x > 1.0, the analytic continuation leaves the real line for generic a, b, so ##NaN is returned there (except in the terminating case above, which remains real for any x).

Has a genuine pole (returns a plain ##Inf, matching mpmath's own hyp2f1 convention there) whenever c is a non-positive integer, unless the series terminates (a or b a non-positive integer, reaching that same magnitude no later than c does) before reaching it.

Known limitation: a large parameter with x close to 1 can return ##NaN where the value is finite, e.g. (hypergeometric-2F1 1000 1 1001 0.999).

See also hypergeometric-1F1, hypergeometric-2F0, hypergeometric-pFq.

Gauss's hypergeometric ₂F₁ function.

The classical generalized hypergeometric series with two numerator and one denominator parameter, `sum_n (a)_n (b)_n / (c)_n * x^n / n!` (using the Pochhammer symbol `(a)_n`), convergent for `|x| < 1` and analytically continued elsewhere on the real line.

Parameters:

- `a`, `b` (double): the two numerator parameters.
- `c` (double): the denominator parameter.
- `x` (double): the argument.

Returns `1.0` for `x = 0.0`. When `a` or `b` is a non-positive integer, the series terminates to a finite polynomial in `x`, real for every `x` (subject to the usual pole in `c`, described below); a degree above `1e7` returns `##NaN` (the polynomial sum is linear in the degree and loses about the degree times the machine epsilon: 5e-10 at `1e7`). Otherwise: for `x < 1.0`, real and finite; at `x = 1.0`, follows Gauss's summation theorem, finite when `c-a-b > 0` and diverging to `##Inf` when `c-a-b <= 0`; for `x > 1.0`, the analytic continuation leaves the real line for generic `a`, `b`, so `##NaN` is returned there (except in the terminating case above, which remains real for any `x`).

Has a genuine pole (returns a plain `##Inf`, matching mpmath's own `hyp2f1` convention there) whenever `c` is a non-positive integer, unless the series terminates (`a` or `b` a non-positive integer, reaching that same magnitude no later than `c` does) before reaching it.

Known limitation: a large parameter with `x` close to `1` can return `##NaN` where the value is finite, e.g. `(hypergeometric-2F1 1000 1 1001 0.999)`.

See also [[hypergeometric-1F1]], [[hypergeometric-2F0]], [[hypergeometric-pFq]].
raw docstring

hypergeometric-pFqclj

(hypergeometric-pFq ps qs x)
(hypergeometric-pFq ps qs x max-iters)

Generalized hypergeometric function pFq with p numerator and q denominator parameters.

Parameters:

  • ps (sequence of double): the p numerator parameters.
  • qs (sequence of double): the q denominator parameters.
  • x (double): the argument.
  • max-iters (long, optional): maximum series/acceleration iterations, 1048576 by default.

Whenever a numerator parameter exactly equals a denominator parameter, that pair cancels identically, reducing to a lower (p-1)F(q-1); this is applied before anything else below. If that shared value is also a non-positive integer, the pair does not simply cancel (both Pochhammer symbols vanish together at the same term instead); the series is then evaluated as a truncated sum of the further-reduced coefficients.

Convergence and evaluation strategy depend on p compared to q: for p <= q the series converges for every x; for p = q + 1 it converges for x < 1 (and follows the usual boundary/continuation behavior at and beyond x = 1); for p > q + 1 the series formally diverges for any nonzero x unless it terminates (see below), in which case only an asymptotic resummation is used.

Whenever a numerator parameter is a non-positive integer, the series terminates to an exact finite polynomial in x, valid for any x, regardless of the general convergence class above.

Has a genuine pole (returns ##NaN) whenever a denominator parameter is a non-positive integer that is reached before the series would otherwise terminate.

Returns 1.0 for x = 0.0.

For the generic (non-terminating), formally divergent p > q + 1 case, the result relies on Weniger-acceleration resummation. A missing finite-value fallback at that acceleration's own loop exit (present in this project's other single-arity Weniger ports, and in the Julia HypergeometricFunctions.jl reference implementation this was ported from, but dropped from this general port) used to turn many cases of an already-converged intermediate value overflowing into ##NaN; fixed. A minority of p > q + 1 points remain genuinely unreliable regardless -- confirmed, by comparison against Julia's own raw Weniger kernel and its production pFq dispatcher (neither of which offers an alternative method for this regime either), to be an inherent limitation of the resummation itself, not specific to this port; not corrected here.

See also hypergeometric-0F0, hypergeometric-1F0, hypergeometric-0F1, hypergeometric-1F1, hypergeometric-0F2, hypergeometric-2F0, hypergeometric-2F1, kummers-M, tricomis-U.

Generalized hypergeometric function pFq with p numerator and q denominator parameters.

Parameters:

- `ps` (sequence of double): the `p` numerator parameters.
- `qs` (sequence of double): the `q` denominator parameters.
- `x` (double): the argument.
- `max-iters` (long, optional): maximum series/acceleration iterations, `1048576` by default.

Whenever a numerator parameter exactly equals a denominator parameter, that pair cancels identically, reducing to a lower `(p-1)F(q-1)`; this is applied before anything else below. If that shared value is also a non-positive integer, the pair does not simply cancel (both Pochhammer symbols vanish together at the same term instead); the series is then evaluated as a truncated sum of the further-reduced coefficients.

Convergence and evaluation strategy depend on `p` compared to `q`: for `p <= q` the series converges for every `x`; for `p = q + 1` it converges for `x < 1` (and follows the usual boundary/continuation behavior at and beyond `x = 1`); for `p > q + 1` the series formally diverges for any nonzero `x` unless it terminates (see below), in which case only an asymptotic resummation is used.

Whenever a numerator parameter is a non-positive integer, the series terminates to an exact finite polynomial in `x`, valid for any `x`, regardless of the general convergence class above.

Has a genuine pole (returns `##NaN`) whenever a denominator parameter is a non-positive integer that is reached before the series would otherwise terminate.

Returns `1.0` for `x = 0.0`.

For the generic (non-terminating), formally divergent `p > q + 1` case, the result relies on Weniger-acceleration resummation. A missing finite-value fallback at that acceleration's own loop exit (present in this project's other single-arity Weniger ports, and in the Julia `HypergeometricFunctions.jl` reference implementation this was ported from, but dropped from this general port) used to turn many cases of an already-converged intermediate value overflowing into `##NaN`; fixed. A minority of `p > q + 1` points remain genuinely unreliable regardless -- confirmed, by comparison against Julia's own raw Weniger kernel and its production `pFq` dispatcher (neither of which offers an alternative method for this regime either), to be an inherent limitation of the resummation itself, not specific to this port; not corrected here.

See also [[hypergeometric-0F0]], [[hypergeometric-1F0]], [[hypergeometric-0F1]], [[hypergeometric-1F1]], [[hypergeometric-0F2]], [[hypergeometric-2F0]], [[hypergeometric-2F1]], [[kummers-M]], [[tricomis-U]].
raw docstring

hypergeometric-pFq-complexclj

(hypergeometric-pFq-complex ps qs z)
(hypergeometric-pFq-complex ps qs z max-iters)

Generalized hypergeometric function pFq with p numerator and q denominator complex parameters.

Complex counterpart of hypergeometric-pFq; see that docstring for the general shape and dispatch logic (entire for p <= q, radius-1 for p = q+1, formally divergent unless terminating for p > q+1), which carries over here with x replaced by the complex argument z and the p <= q/p = q+1 MacLaurin-vs-Weniger split now made on the sign of z's real part / |z| respectively.

Parameters:

  • ps (sequence of double or [[Vec2]]): the p numerator parameters, real or complex (promoted via ensure-complex).
  • qs (sequence of double or [[Vec2]]): the q denominator parameters.
  • z (double or [[Vec2]]): the argument, real or complex.
  • max-iters (long, optional): maximum series/acceleration iterations, 1048576 by default.

Whenever a numerator parameter exactly equals a denominator parameter, that pair cancels identically, reducing to a lower (p-1)F(q-1); this is applied before anything else below. If that shared value is also a non-positive real integer (zero imaginary part), the pair does not simply cancel (both Pochhammer symbols vanish together at the same term instead); the series is then evaluated as a truncated sum of the further-reduced coefficients.

Whenever a numerator parameter is a non-positive real integer, the series terminates to an exact finite polynomial in z, valid for any z.

Has a genuine pole (returns (Vec2. ##NaN ##NaN)) whenever a denominator parameter is a non-positive real integer that is reached before the series would otherwise terminate.

Returns 1.0+0.0i for z = 0.0+0.0i.

For the generic (non-terminating), formally divergent p > q + 1 case, the result relies entirely on Weniger-acceleration resummation (no MacLaurin fallback exists there, since the underlying series is genuinely divergent). A missing finite-value fallback at that acceleration's own loop exit used to turn many cases of an already-converged intermediate value overflowing into ##NaN regardless of the sign of z; fixed (see fastmath.special.hypergeometric/hypergeometric-pFq-weniger-complex-with-reason for the underlying mechanism). A minority of p > q + 1 points remain genuinely unreliable regardless -- confirmed to be an inherent limitation of the resummation itself, not specific to this port (see hypergeometric-pFq's own docstring). For p = q + 1 beyond the MacLaurin radius (|z| >= 0.72), Weniger acceleration is markedly more reliable on both sides of the real axis, though (as for the real-valued hypergeometric-pFq) precision still degrades gradually as |z| grows very large; not corrected here.

See also hypergeometric-pFq.

Generalized hypergeometric function pFq with p numerator and q denominator complex parameters.

Complex counterpart of [[hypergeometric-pFq]]; see that docstring for the general shape and dispatch logic (entire for `p <= q`, radius-1 for `p = q+1`, formally divergent unless terminating for `p > q+1`), which carries over here with `x` replaced by the complex argument `z` and the `p <= q`/`p = q+1` MacLaurin-vs-Weniger split now made on the sign of `z`'s real part / `|z|` respectively.

Parameters:

- `ps` (sequence of double or [[Vec2]]): the `p` numerator parameters, real or complex (promoted via `ensure-complex`).
- `qs` (sequence of double or [[Vec2]]): the `q` denominator parameters.
- `z` (double or [[Vec2]]): the argument, real or complex.
- `max-iters` (long, optional): maximum series/acceleration iterations, `1048576` by default.

Whenever a numerator parameter exactly equals a denominator parameter, that pair cancels identically, reducing to a lower `(p-1)F(q-1)`; this is applied before anything else below. If that shared value is also a non-positive real integer (zero imaginary part), the pair does not simply cancel (both Pochhammer symbols vanish together at the same term instead); the series is then evaluated as a truncated sum of the further-reduced coefficients.

Whenever a numerator parameter is a non-positive real integer, the series terminates to an exact finite polynomial in `z`, valid for any `z`.

Has a genuine pole (returns `(Vec2. ##NaN ##NaN)`) whenever a denominator parameter is a non-positive real integer that is reached before the series would otherwise terminate.

Returns `1.0+0.0i` for `z = 0.0+0.0i`.

For the generic (non-terminating), formally divergent `p > q + 1` case, the result relies entirely on Weniger-acceleration resummation (no MacLaurin fallback exists there, since the underlying series is genuinely divergent). A missing finite-value fallback at that acceleration's own loop exit used to turn many cases of an already-converged intermediate value overflowing into `##NaN` regardless of the sign of `z`; fixed (see [[fastmath.special.hypergeometric/hypergeometric-pFq-weniger-complex-with-reason]] for the underlying mechanism). A minority of `p > q + 1` points remain genuinely unreliable regardless -- confirmed to be an inherent limitation of the resummation itself, not specific to this port (see [[hypergeometric-pFq]]'s own docstring). For `p = q + 1` beyond the MacLaurin radius (`|z| >= 0.72`), Weniger acceleration is markedly more reliable on both sides of the real axis, though (as for the real-valued [[hypergeometric-pFq]]) precision still degrades gradually as `|z|` grows very large; not corrected here.

See also [[hypergeometric-pFq]].
raw docstring

hypergeometric-pFq-ratioclj

(hypergeometric-pFq-ratio ps qs z)
(hypergeometric-pFq-ratio ps qs z max-iters)

Hypergeometric-pFq using MacLaurin series on ratios. Can be very slow.

max-iters is set to 10000 by default.

Hypergeometric-pFq using MacLaurin series on ratios. Can be very slow.

`max-iters` is set to 10000 by default.
raw docstring

incomplete-betaclj

(incomplete-beta x a b)

Incomplete beta function $B(x;a,b)=\int_0^xt^{a-1}(1-t)^{b-1}dt$.

Parameters:

  • x (double): the upper limit in $[0,1]$.
  • a, b (double): the shape parameters; a,b>0 uses the regularized function and log-beta (a shape below 1e-3 with the other below 1e4: the hypergeometric form directly), other values are defined by the analytic continuation through hypergeometric-2F1.

Returns 0 at x=0, B(a,b) at x=1 and ##NaN outside $[0,1]$ and for a ##NaN argument; 0 for an infinite shape (the limit); ##NaN where regularized-beta is ##NaN (two finite shapes at least 1e7).

Accuracy: relative error about 4e-14 for a,b>0.

See also regularized-beta, beta.

Incomplete beta function $B(x;a,b)=\\int_0^xt^{a-1}(1-t)^{b-1}dt$.

Parameters:

- `x` (double): the upper limit in $[0,1]$.
- `a`, `b` (double): the shape parameters; `a,b>0` uses the regularized function and [[log-beta]] (a shape below `1e-3` with the other below `1e4`: the hypergeometric form directly), other values are defined by the analytic continuation through [[hypergeometric-2F1]].

Returns `0` at `x=0`, `B(a,b)` at `x=1` and `##NaN` outside $[0,1]$ and for a `##NaN` argument; `0` for an infinite shape (the limit); `##NaN` where [[regularized-beta]] is `##NaN` (two finite shapes at least `1e7`).

Accuracy: relative error about 4e-14 for `a,b>0`.

See also [[regularized-beta]], [[beta]].
raw docstring

inv-erfclj

(inv-erf x)

Inverse error function.

Parameters:

  • x (double): the argument in $[-1,1]$.

Returns y such that erf(y)=x; inv-erf(±1)=±Inf, NaN outside $[-1,1]$.

Accuracy: relative error about 1e-16 (Apache Commons Math).

See also erf, inv-erfc.

Inverse error function.

Parameters:

- `x` (double): the argument in $[-1,1]$.

Returns `y` such that `erf(y)=x`; `inv-erf(±1)=±Inf`, `NaN` outside $[-1,1]$.

Accuracy: relative error about 1e-16 (Apache Commons Math).

See also [[erf]], [[inv-erfc]].
raw docstring

inv-erfcclj

(inv-erfc x)

Inverse complementary error function.

Parameters:

  • x (double): the argument in $[0,2]$.

Returns y such that erfc(y)=x; inv-erfc(0)=Inf, inv-erfc(2)=-Inf, NaN outside $[0,2]$. Accurate also for tiny x (inv-erfc(1e-300)=26.53), where inv-erf(1-x) cannot be used.

Accuracy: relative error about 1e-15.

See also erfc, inv-erf.

Inverse complementary error function.

Parameters:

- `x` (double): the argument in $[0,2]$.

Returns `y` such that `erfc(y)=x`; `inv-erfc(0)=Inf`, `inv-erfc(2)=-Inf`, `NaN` outside $[0,2]$. Accurate also for tiny `x` (`inv-erfc(1e-300)=26.53`), where `inv-erf(1-x)` cannot be used.

Accuracy: relative error about 1e-15.

See also [[erfc]], [[inv-erf]].
raw docstring

inv-gamma-1pm1clj

(inv-gamma-1pm1 x)

$\frac{1}{\Gamma(1+x)}-1$, accurate for x near zero.

Parameters:

  • x (double): the argument. For $-0.5≤x≤1.5$ a dedicated algorithm is used (Apache Commons Math), outside this range the result is computed from gamma.

See also gamma, log-gamma-1p.

$\frac{1}{\Gamma(1+x)}-1$, accurate for `x` near zero.

Parameters:

- `x` (double): the argument. For $-0.5≤x≤1.5$ a dedicated algorithm is used (Apache Commons Math), outside this range the result is computed from [[gamma]].

See also [[gamma]], [[log-gamma-1p]].
raw docstring

jacobi-acdclj

(jacobi-acd x m)

Inverse of the Jacobi elliptic function jacobi-cd: u such that cd(u|m)=x, $\operatorname{arccd}(x|m)$.

Parameters:

  • x (double): the value, -1<=x<=1 for m<1, any real for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u in [0, 2K]. NaN at m=1 (cd is constant). K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-acd (jacobi-cd u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-cd, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-cd]]: `u` such that `cd(u|m)=x`, $\operatorname{arccd}(x|m)$.

Parameters:

- `x` (double): the value, `-1<=x<=1` for `m<1`, any real for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[0, 2K]`. `NaN` at `m=1` (`cd` is constant). `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-acd (jacobi-cd u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-cd]], [[jacobi-am]].
raw docstring

jacobi-acnclj

(jacobi-acn x m)

Inverse of the Jacobi elliptic function jacobi-cn: u such that cn(u|m)=x, $\operatorname{arccn}(x|m)$.

Parameters:

  • x (double): the value, in the range of cn: -1<=x<=1 for m<1, sqrt(1-1/m)<=x<=1 for m>1, 0<x<=1 for m=1.
  • m (double): the parameter ($m=k^2$).

Returns u in [0, 2K] for m<1 (DLMF 22.15.6), in [0, K] for m>=1. K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-acn (jacobi-cn u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-cn, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-cn]]: `u` such that `cn(u|m)=x`, $\operatorname{arccn}(x|m)$.

Parameters:

- `x` (double): the value, in the range of `cn`: `-1<=x<=1` for `m<1`, `sqrt(1-1/m)<=x<=1` for `m>1`, `0<x<=1` for `m=1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[0, 2K]` for `m<1` (DLMF 22.15.6), in `[0, K]` for `m>=1`. `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-acn (jacobi-cn u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-cn]], [[jacobi-am]].
raw docstring

jacobi-acsclj

(jacobi-acs x m)

Inverse of the Jacobi elliptic function jacobi-cs: u such that cs(u|m)=x, $\operatorname{arccs}(x|m)$.

Parameters:

  • x (double): the value, any real for m<1; |x|>=sqrt(m-1) for m>=1.
  • m (double): the parameter ($m=k^2$).

Returns u in (0, 2K) for m<1 (DLMF 22.15.23, acs(-x)=2K-acs(x)); odd in x with u in (0, K] for x>0 when m>=1. K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-acs (jacobi-cs u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-cs, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-cs]]: `u` such that `cs(u|m)=x`, $\operatorname{arccs}(x|m)$.

Parameters:

- `x` (double): the value, any real for `m<1`; `|x|>=sqrt(m-1)` for `m>=1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `(0, 2K)` for `m<1` (DLMF 22.15.23, `acs(-x)=2K-acs(x)`); odd in `x` with `u` in `(0, K]` for `x>0` when `m>=1`. `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-acs (jacobi-cs u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-cs]], [[jacobi-am]].
raw docstring

jacobi-adcclj

(jacobi-adc x m)

Inverse of the Jacobi elliptic function jacobi-dc: u such that dc(u|m)=x, $\operatorname{arcdc}(x|m)$.

Parameters:

  • x (double): the value, |x|>=1 for m<1, -1<=x<=1 for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u in [0, 2K]. NaN at m=1 (dc is constant). K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-adc (jacobi-dc u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-dc, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-dc]]: `u` such that `dc(u|m)=x`, $\operatorname{arcdc}(x|m)$.

Parameters:

- `x` (double): the value, `|x|>=1` for `m<1`, `-1<=x<=1` for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[0, 2K]`. `NaN` at `m=1` (`dc` is constant). `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-adc (jacobi-dc u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-dc]], [[jacobi-am]].
raw docstring

jacobi-adnclj

(jacobi-adn x m)

Inverse of the Jacobi elliptic function jacobi-dn: u such that dn(u|m)=x, $\operatorname{arcdn}(x|m)$.

Parameters:

  • x (double): the value, in the range of dn: sqrt(1-m)<=x<=1 for 0<=m<=1, 1<=x<=sqrt(1-m) for m<0, -1<=x<=1 for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u in [0, K] for m<=1, in [0, 2K] for m>1. NaN at m=0 (dn is constant). K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-adn (jacobi-dn u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-dn, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-dn]]: `u` such that `dn(u|m)=x`, $\operatorname{arcdn}(x|m)$.

Parameters:

- `x` (double): the value, in the range of `dn`: `sqrt(1-m)<=x<=1` for `0<=m<=1`, `1<=x<=sqrt(1-m)` for `m<0`, `-1<=x<=1` for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[0, K]` for `m<=1`, in `[0, 2K]` for `m>1`. `NaN` at `m=0` (`dn` is constant). `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-adn (jacobi-dn u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-dn]], [[jacobi-am]].
raw docstring

jacobi-adsclj

(jacobi-ads x m)

Inverse of the Jacobi elliptic function jacobi-ds: u such that ds(u|m)=x, $\operatorname{arcds}(x|m)$.

Parameters:

  • x (double): the value, |x|>=sqrt(1-m) for m<=1, any real for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u odd in x with u in (0, K] for x>0 when m<=1; in (0, 2K) for m>1. K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-ads (jacobi-ds u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-ds, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-ds]]: `u` such that `ds(u|m)=x`, $\operatorname{arcds}(x|m)$.

Parameters:

- `x` (double): the value, `|x|>=sqrt(1-m)` for `m<=1`, any real for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` odd in `x` with `u` in `(0, K]` for `x>0` when `m<=1`; in `(0, 2K)` for `m>1`. `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-ads (jacobi-ds u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-ds]], [[jacobi-am]].
raw docstring

jacobi-amclj

(jacobi-am u m)

Jacobi amplitude $\phi=\operatorname{am}(u|m)$ such that $u=F(\phi|m)$, the inverse of the incomplete elliptic integral of the first kind.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$), any real.

For m<=1 returns an increasing function of u with $\operatorname{am}(u+2K(m))=\operatorname{am}(u)+\pi$ (the imaginary-modulus transformation for m<0), am(u|1) is the Gudermannian function. For m>1 returns asin(sn(u|m)): bounded by asin(1/sqrt(m)) and periodic (the convention of mpmath, atan2(sn, cn) with cn>0).

Returns ±Inf for u=±Inf and m<1, ±π/2 for m=1, NaN for m>1 (no limit) and for a NaN argument. For m=Inf and a finite u returns the limit 0, for m=-Inf and u≠0 the limit ±Inf. For large negative m the value grows like π u/(2K(m)) and is ±Inf only when that overflows.

Accuracy: relative error about 1e-16 for $|u|\le50$, up to 4e-15 next to m=1; about 1e-13 near the zeros of am for m>1.

See also elliptic-F, jacobi-sn.

Jacobi amplitude $\phi=\operatorname{am}(u|m)$ such that $u=F(\phi|m)$, the inverse of the incomplete elliptic integral of the first kind.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$), any real.

For `m<=1` returns an increasing function of `u` with $\operatorname{am}(u+2K(m))=\operatorname{am}(u)+\pi$ (the imaginary-modulus transformation for `m<0`), `am(u|1)` is the Gudermannian function. For `m>1` returns `asin(sn(u|m))`: bounded by `asin(1/sqrt(m))` and periodic (the convention of `mpmath`, `atan2(sn, cn)` with `cn>0`).

Returns `±Inf` for `u=±Inf` and `m<1`, `±π/2` for `m=1`, `NaN` for `m>1` (no limit) and for a `NaN` argument. For `m=Inf` and a finite `u` returns the limit `0`, for `m=-Inf` and `u≠0` the limit `±Inf`. For large negative `m` the value grows like `π u/(2K(m))` and is `±Inf` only when that overflows.

Accuracy: relative error about 1e-16 for $|u|\le50$, up to 4e-15 next to `m=1`; about 1e-13 near the zeros of `am` for `m>1`.

See also [[elliptic-F]], [[jacobi-sn]].
raw docstring

jacobi-ancclj

(jacobi-anc x m)

Inverse of the Jacobi elliptic function jacobi-nc: u such that nc(u|m)=x, $\operatorname{arcnc}(x|m)$.

Parameters:

  • x (double): the value, |x|>=1 for m<1, 1<=x<=1/sqrt(1-1/m) for m>1, x>=1 for m=1.
  • m (double): the parameter ($m=k^2$).

Returns u in [0, 2K] for m<1, in [0, K] for m>=1. K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-anc (jacobi-nc u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-nc, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-nc]]: `u` such that `nc(u|m)=x`, $\operatorname{arcnc}(x|m)$.

Parameters:

- `x` (double): the value, `|x|>=1` for `m<1`, `1<=x<=1/sqrt(1-1/m)` for `m>1`, `x>=1` for `m=1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[0, 2K]` for `m<1`, in `[0, K]` for `m>=1`. `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-anc (jacobi-nc u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-nc]], [[jacobi-am]].
raw docstring

jacobi-andclj

(jacobi-and x m)

Inverse of the Jacobi elliptic function jacobi-nd: u such that nd(u|m)=x, $\operatorname{arcnd}(x|m)$.

Parameters:

  • x (double): the value, 1<=x<=1/sqrt(1-m) for 0<=m<1, 1/sqrt(1-m)<=x<=1 for m<0, |x|>=1 for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u in [0, K] for m<=1, in [0, 2K] for m>1. NaN at m=0 (nd is constant). K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-and (jacobi-nd u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-nd, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-nd]]: `u` such that `nd(u|m)=x`, $\operatorname{arcnd}(x|m)$.

Parameters:

- `x` (double): the value, `1<=x<=1/sqrt(1-m)` for `0<=m<1`, `1/sqrt(1-m)<=x<=1` for `m<0`, `|x|>=1` for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[0, K]` for `m<=1`, in `[0, 2K]` for `m>1`. `NaN` at `m=0` (`nd` is constant). `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-and (jacobi-nd u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-nd]], [[jacobi-am]].
raw docstring

jacobi-ansclj

(jacobi-ans x m)

Inverse of the Jacobi elliptic function jacobi-ns: u such that ns(u|m)=x, $\operatorname{arcns}(x|m)$.

Parameters:

  • x (double): the value, |x|>=1 for m<=1, |x|>=sqrt(m) for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u odd in x with u in (0, K] for x>0. K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-ans (jacobi-ns u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-ns, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-ns]]: `u` such that `ns(u|m)=x`, $\operatorname{arcns}(x|m)$.

Parameters:

- `x` (double): the value, `|x|>=1` for `m<=1`, `|x|>=sqrt(m)` for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` odd in `x` with `u` in `(0, K]` for `x>0`. `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-ans (jacobi-ns u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-ns]], [[jacobi-am]].
raw docstring

jacobi-ascclj

(jacobi-asc x m)

Inverse of the Jacobi elliptic function jacobi-sc: u such that sc(u|m)=x, $\operatorname{arcsc}(x|m)$.

Parameters:

  • x (double): the value, any real for m<=1; |x|<=1/sqrt(m-1) for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u in (-K, K) (odd in x); ±K(m) for x=±Inf. K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-asc (jacobi-sc u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-sc, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-sc]]: `u` such that `sc(u|m)=x`, $\operatorname{arcsc}(x|m)$.

Parameters:

- `x` (double): the value, any real for `m<=1`; `|x|<=1/sqrt(m-1)` for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `(-K, K)` (odd in `x`); `±K(m)` for `x=±Inf`. `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-asc (jacobi-sc u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-sc]], [[jacobi-am]].
raw docstring

jacobi-asdclj

(jacobi-asd x m)

Inverse of the Jacobi elliptic function jacobi-sd: u such that sd(u|m)=x, $\operatorname{arcsd}(x|m)$.

Parameters:

  • x (double): the value, in the range of sd: |x|<=1/sqrt(1-m) for m<1, any real for m>=1.
  • m (double): the parameter ($m=k^2$).

Returns u in [-K, K] (odd in x). K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-asd (jacobi-sd u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-sd, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-sd]]: `u` such that `sd(u|m)=x`, $\operatorname{arcsd}(x|m)$.

Parameters:

- `x` (double): the value, in the range of `sd`: `|x|<=1/sqrt(1-m)` for `m<1`, any real for `m>=1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[-K, K]` (odd in `x`). `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-asd (jacobi-sd u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-sd]], [[jacobi-am]].
raw docstring

jacobi-asnclj

(jacobi-asn x m)

Inverse of the Jacobi elliptic function jacobi-sn: u such that sn(u|m)=x, $\operatorname{arcsn}(x|m)$.

Parameters:

  • x (double): the value, in the range of sn: |x|<=1 for m<=1, |x|<=1/sqrt(m) for m>1.
  • m (double): the parameter ($m=k^2$).

Returns u in [-K, K] (odd in x). K is the real quarter period, K(1/m)/sqrt(m) for m>1. NaN for x outside the range, also by a rounding error at its ends (no clamping), and for a NaN argument. Round trip: (jacobi-asn (jacobi-sn u m) m) = u for u in the first quarter period [0, K(m)].

See also jacobi-sn, jacobi-am.

Inverse of the Jacobi elliptic function [[jacobi-sn]]: `u` such that `sn(u|m)=x`, $\operatorname{arcsn}(x|m)$.

Parameters:

- `x` (double): the value, in the range of `sn`: `|x|<=1` for `m<=1`, `|x|<=1/sqrt(m)` for `m>1`.
- `m` (double): the parameter ($m=k^2$).

Returns `u` in `[-K, K]` (odd in `x`). `K` is the real quarter period, `K(1/m)/sqrt(m)` for `m>1`. `NaN` for `x` outside the range, also by a rounding error at its ends (no clamping), and for a `NaN` argument. Round trip: `(jacobi-asn (jacobi-sn u m) m) = u` for `u` in the first quarter period `[0, K(m)]`.

See also [[jacobi-sn]], [[jacobi-am]].
raw docstring

jacobi-cdclj

(jacobi-cd u m)

Jacobi elliptic function $\operatorname{cd}(u|m)=\operatorname{cn}(u|m)/\operatorname{dn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Poles where dn is zero (possible only for m>1). For m=Inf and a finite u other than 0 returns NaN (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{cd}(u|m)=\operatorname{cn}(u|m)/\operatorname{dn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Poles where `dn` is zero (possible only for `m>1`). For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-cnclj

(jacobi-cn u m)

Jacobi elliptic function $\operatorname{cn}(u|m)=\cos\operatorname{am}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. For m=Inf and a finite u other than 0 returns the limit 1.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period. For large negative m it grows with the phase u*sqrt(-m) (4e-9 at m=-1e10, u=3; no digits left beyond about m=-1e17, u=3). Next to m=1 the absolute error near the zeros of cn is up to about 1e-14 (also the absolute error of dn near its minimum sqrt(1-m) for m<1 and of cn near its minimum sqrt(1-1/m) for m>1).

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{cn}(u|m)=\cos\operatorname{am}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. For `m=Inf` and a finite `u` other than 0 returns the limit `1`.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period. For large negative `m` it grows with the phase `u*sqrt(-m)` (4e-9 at `m=-1e10`, `u=3`; no digits left beyond about `m=-1e17`, `u=3`). Next to `m=1` the absolute error near the zeros of `cn` is up to about 1e-14 (also the absolute error of `dn` near its minimum `sqrt(1-m)` for `m<1` and of `cn` near its minimum `sqrt(1-1/m)` for `m>1`).

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-csclj

(jacobi-cs u m)

Jacobi elliptic function $\operatorname{cs}(u|m)=\operatorname{cn}(u|m)/\operatorname{sn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Pole at u=0 (cs(0)=Inf). For m=Inf and a finite u other than 0 returns NaN (no limit, sn tends to 0 through both signs).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{cs}(u|m)=\operatorname{cn}(u|m)/\operatorname{sn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Pole at `u=0` (`cs(0)=Inf`). For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit, `sn` tends to 0 through both signs).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-dcclj

(jacobi-dc u m)

Jacobi elliptic function $\operatorname{dc}(u|m)=\operatorname{dn}(u|m)/\operatorname{cn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Poles where cn is zero. For m=Inf and a finite u other than 0 returns NaN (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{dc}(u|m)=\operatorname{dn}(u|m)/\operatorname{cn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Poles where `cn` is zero. For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-dnclj

(jacobi-dn u m)

Jacobi elliptic function $\operatorname{dn}(u|m)=\sqrt{1-m\sin^2\operatorname{am}(u|m)}$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. For m=Inf and a finite u other than 0 returns NaN (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period. For large negative m it grows with the phase u*sqrt(-m) (4e-9 at m=-1e10, u=3; no digits left beyond about m=-1e17, u=3). Next to m=1 the absolute error near the zeros of cn is up to about 1e-14 (also the absolute error of dn near its minimum sqrt(1-m) for m<1 and of cn near its minimum sqrt(1-1/m) for m>1).

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{dn}(u|m)=\sqrt{1-m\sin^2\operatorname{am}(u|m)}$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period. For large negative `m` it grows with the phase `u*sqrt(-m)` (4e-9 at `m=-1e10`, `u=3`; no digits left beyond about `m=-1e17`, `u=3`). Next to `m=1` the absolute error near the zeros of `cn` is up to about 1e-14 (also the absolute error of `dn` near its minimum `sqrt(1-m)` for `m<1` and of `cn` near its minimum `sqrt(1-1/m)` for `m>1`).

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-dsclj

(jacobi-ds u m)

Jacobi elliptic function $\operatorname{ds}(u|m)=\operatorname{dn}(u|m)/\operatorname{sn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Pole at u=0 (ds(0)=Inf). For m=Inf and a finite u other than 0 returns NaN (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{ds}(u|m)=\operatorname{dn}(u|m)/\operatorname{sn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Pole at `u=0` (`ds(0)=Inf`). For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-ncclj

(jacobi-nc u m)

Jacobi elliptic function $\operatorname{nc}(u|m)=\operatorname{nn}(u|m)/\operatorname{cn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Poles where cn is zero. For m=Inf and a finite u other than 0 returns the limit 1.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{nc}(u|m)=\operatorname{nn}(u|m)/\operatorname{cn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Poles where `cn` is zero. For `m=Inf` and a finite `u` other than 0 returns the limit `1`.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-ndclj

(jacobi-nd u m)

Jacobi elliptic function $\operatorname{nd}(u|m)=\operatorname{nn}(u|m)/\operatorname{dn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Poles where dn is zero (possible only for m>1). For m=Inf and a finite u other than 0 returns NaN (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{nd}(u|m)=\operatorname{nn}(u|m)/\operatorname{dn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Poles where `dn` is zero (possible only for `m>1`). For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-nsclj

(jacobi-ns u m)

Jacobi elliptic function $\operatorname{ns}(u|m)=\operatorname{nn}(u|m)/\operatorname{sn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Pole at u=0 (ns(0)=Inf). For m=Inf and a finite u other than 0 returns NaN (no limit, sn tends to 0 through both signs).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{ns}(u|m)=\operatorname{nn}(u|m)/\operatorname{sn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Pole at `u=0` (`ns(0)=Inf`). For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit, `sn` tends to 0 through both signs).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-scclj

(jacobi-sc u m)

Jacobi elliptic function $\operatorname{sc}(u|m)=\operatorname{sn}(u|m)/\operatorname{cn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Poles where cn is zero. For m=Inf and a finite u other than 0 returns the limit 0.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{sc}(u|m)=\operatorname{sn}(u|m)/\operatorname{cn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Poles where `cn` is zero. For `m=Inf` and a finite `u` other than 0 returns the limit `0`.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-sdclj

(jacobi-sd u m)

Jacobi elliptic function $\operatorname{sd}(u|m)=\operatorname{sn}(u|m)/\operatorname{dn}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. Poles where dn is zero (possible only for m>1). For m=Inf and a finite u other than 0 returns NaN (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period.

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{sd}(u|m)=\operatorname{sn}(u|m)/\operatorname{dn}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. Poles where `dn` is zero (possible only for `m>1`). For `m=Inf` and a finite `u` other than 0 returns `NaN` (no limit).

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period.

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jacobi-snclj

(jacobi-sn u m)

Jacobi elliptic function $\operatorname{sn}(u|m)=\sin\operatorname{am}(u|m)$.

Parameters:

  • u (double): the argument.
  • m (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against mpmath for m in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in u with the period $4K(m)$. For m=Inf and a finite u other than 0 returns the limit 0.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with |u| because the argument is reduced modulo the period. For large negative m it grows with the phase u*sqrt(-m) (4e-9 at m=-1e10, u=3; no digits left beyond about m=-1e17, u=3). Next to m=1 the absolute error near the zeros of cn is up to about 1e-14 (also the absolute error of dn near its minimum sqrt(1-m) for m<1 and of cn near its minimum sqrt(1-1/m) for m>1).

See also jacobi-am, elliptic-K.

Jacobi elliptic function $\operatorname{sn}(u|m)=\sin\operatorname{am}(u|m)$.

Parameters:

- `u` (double): the argument.
- `m` (double): the parameter ($m=k^2$, the square of the modulus). Values outside [0,1] are defined by the real analytic continuation (checked against `mpmath` for `m` in [-2, 3]).

Periodic (and quasi-periodic for the quotients) in `u` with the period $4K(m)$. For `m=Inf` and a finite `u` other than 0 returns the limit `0`.

Accuracy: relative error below 5e-14 for $|u|\le50$; the error grows with `|u|` because the argument is reduced modulo the period. For large negative `m` it grows with the phase `u*sqrt(-m)` (4e-9 at `m=-1e10`, `u=3`; no digits left beyond about `m=-1e17`, `u=3`). Next to `m=1` the absolute error near the zeros of `cn` is up to about 1e-14 (also the absolute error of `dn` near its minimum `sqrt(1-m)` for `m<1` and of `cn` near its minimum `sqrt(1-1/m)` for `m>1`).

See also [[jacobi-am]], [[elliptic-K]].
raw docstring

jincclj

(jinc x)

Normalised jinc function $2J_1(\pi x)/(\pi x)$, the radial analogue of sinc.

Parameters:

  • x (double): the argument.

Returns 1.0 at x=0 and 0.0 at ±Inf. Even function; the first zero is at x≈1.2197.

Accuracy: relative error about 1e-14 (a polynomial for |x|<0.002).

See also bessel-J1.

Normalised jinc function $2J_1(\pi x)/(\pi x)$, the radial analogue of `sinc`.

Parameters:

- `x` (double): the argument.

Returns `1.0` at `x=0` and `0.0` at `±Inf`. Even function; the first zero is at `x≈1.2197`.

Accuracy: relative error about 1e-14 (a polynomial for `|x|<0.002`).

See also [[bessel-J1]].
raw docstring

kummers-Mclj

(kummers-M a b x)

Kummer's confluent hypergeometric function $M(a,b,x)={}_1F_1(a;b;x)$.

Same function as hypergeometric-1F1; see there for the parameters and the conventions at the poles (b a non-positive integer) and for terminating series.

See also tricomis-U, hypergeometric-1F1.

Kummer's confluent hypergeometric function $M(a,b,x)={}_1F_1(a;b;x)$.

Same function as [[hypergeometric-1F1]]; see there for the parameters and the conventions at the poles (`b` a non-positive integer) and for terminating series.

See also [[tricomis-U]], [[hypergeometric-1F1]].
raw docstring

lambert-Wclj

(lambert-W x)

Lambert W_0 function, the principal branch of the inverse of $f(w)=we^w$; $W(xe^x)=x$ for $x≥-1$.

Parameters:

  • x (double): the argument, x >= -1/e.

Returns ##NaN for x < -1/e (no real value), -1.0 at -1/e, 0.0 at 0 and ##Inf at ##Inf.

Accuracy: relative error about 1e-15 away from -1/e; close to the branch point the problem is ill-conditioned (error about 1e-14 at 1e-5 from it).

See also lambert-W-1.

Lambert W_0 function, the principal branch of the inverse of $f(w)=we^w$; $W(xe^x)=x$ for $x≥-1$.

Parameters:

- `x` (double): the argument, `x >= -1/e`.

Returns `##NaN` for `x < -1/e` (no real value), `-1.0` at `-1/e`, `0.0` at `0` and `##Inf` at `##Inf`.

Accuracy: relative error about 1e-15 away from `-1/e`; close to the branch point the problem is ill-conditioned (error about 1e-14 at 1e-5 from it).

See also [[lambert-W-1]].
raw docstring

lambert-W-1clj

(lambert-W-1 x)

Lambert W_{-1} function, the lower real branch of the inverse of $f(w)=we^w$; $W_{-1}(xe^x)=x$ for $x≤-1$.

Parameters:

  • x (double): the argument, -1/e <= x < 0.

Returns ##NaN for x < -1/e and for x > 0 (no real value), -1.0 at -1/e, and ##-Inf at 0.0 and -0.0 (the limit from the left).

Accuracy: relative error about 1e-14.

See also lambert-W.

Lambert W_{-1} function, the lower real branch of the inverse of $f(w)=we^w$; $W_{-1}(xe^x)=x$ for $x≤-1$.

Parameters:

- `x` (double): the argument, `-1/e <= x < 0`.

Returns `##NaN` for `x < -1/e` and for `x > 0` (no real value), `-1.0` at `-1/e`, and `##-Inf` at `0.0` and `-0.0` (the limit from the left).

Accuracy: relative error about 1e-14.

See also [[lambert-W]].
raw docstring

Liclj

(Li x)

Offset logarithmic integral, Li(x) = integral_2^x dt/ln(t), for x > 0.

Related to li by Li(x) = li(x) - li(2), so that Li(2.0) is 0.0 (unlike li, whose corresponding reference point is 0). Shares li's singularity at x = 1 and its asymptotic growth for large x; Li is the form more commonly used in number theory as an estimate of the prime-counting function pi(x).

Parameters:

  • x (double): evaluation point, must be positive.

Returns Li(x) as a double. Li(2.0) is 0.0, Li(1.0) is ##-Inf. Returns ##NaN for a ##NaN input or a negative x.

Accuracy: relative error below 2e-13 (close to its zero at x = 2).

See also li, Ei.

Offset logarithmic integral, `Li(x) = integral_2^x dt/ln(t)`, for `x > 0`.

Related to [[li]] by `Li(x) = li(x) - li(2)`, so that `Li(2.0)` is `0.0`
(unlike `li`, whose corresponding reference point is `0`). Shares `li`'s
singularity at `x = 1` and its asymptotic growth for large `x`; `Li` is
the form more commonly used in number theory as an estimate of the
prime-counting function `pi(x)`.

Parameters:

- `x` (double): evaluation point, must be positive.

Returns `Li(x)` as a double. `Li(2.0)` is `0.0`, `Li(1.0)` is `##-Inf`.
Returns `##NaN` for a `##NaN` input or a negative `x`.

Accuracy: relative error below 2e-13 (close to its zero at `x = 2`).

See also [[li]], [[Ei]].
raw docstring

liclj

(li x)

Logarithmic integral, li(x) = integral_0^x dt/ln(t), for x > 0.

Related to Ei by li(x) = Ei(ln(x)). li has a singularity at x = 1 (-Inf from the left, +Inf from the right, since ln(1) = 0), a single real zero away from 0 near x = 1.4514 (the Ramanujan-Soldner constant), and grows without bound (roughly like x/ln(x)) as x grows without bound. By the prime number theorem, li is asymptotic to the prime-counting function pi(x) (the count of primes up to x).

Parameters:

  • x (double): evaluation point, must be positive.

Returns li(x) as a double. li(0.0) is -0.0, li(1.0) is ##-Inf. Returns ##NaN for a ##NaN input or a negative x (ln(x) is not real there).

Accuracy: relative error below 1e-14.

See also Ei, Li (the offset variant used in number theory).

Logarithmic integral, `li(x) = integral_0^x dt/ln(t)`, for `x > 0`.

Related to [[Ei]] by `li(x) = Ei(ln(x))`. `li` has a singularity at `x =
1` (`-Inf` from the left, `+Inf` from the right, since `ln(1) = 0`), a
single real zero away from `0` near `x = 1.4514` (the Ramanujan-Soldner
constant), and grows without bound (roughly like `x/ln(x)`) as `x` grows
without bound. By the prime number theorem, `li` is asymptotic to the
prime-counting function `pi(x)` (the count of primes up to `x`).

Parameters:

- `x` (double): evaluation point, must be positive.

Returns `li(x)` as a double. `li(0.0)` is `-0.0`, `li(1.0)` is `##-Inf`.
Returns `##NaN` for a `##NaN` input or a negative `x` (`ln(x)` is not
real there).

Accuracy: relative error below 1e-14.

See also [[Ei]], [[Li]] (the offset variant used in number theory).
raw docstring

log-betaclj

(log-beta p q)

Computes the natural logarithm of the absolute value of the Beta function of p and q.

Parameters:

  • p, q (double): real arguments, same domain as beta.

Returns a double, $\log|B(p,q)|$. Equal to the logarithm of beta wherever beta is positive (always the case for p,q>0) and defined through the absolute value where beta is negative. ##NaN at the poles of beta, ##-Inf at its removable zero and for an infinite p or q (with the other positive).

See also beta.

Computes the natural logarithm of the absolute value of the Beta
function of `p` and `q`.

Parameters:

- `p`, `q` (double): real arguments, same domain as [[beta]].

Returns a double, $\log|B(p,q)|$. Equal to the logarithm of [[beta]]
wherever [[beta]] is positive (always the case for `p,q>0`) and defined
through the absolute value where [[beta]] is negative. `##NaN` at the
poles of [[beta]], `##-Inf` at its removable zero and for an infinite
`p` or `q` (with the other positive).

See also [[beta]].
raw docstring

log-gammaclj

(log-gamma x)

Logarithm of the absolute value of the Gamma function, $\log|\Gamma(x)|$.

Parameters:

  • x (double): the argument.

Returns ##Inf at zero, at the negative integers and at ##Inf; ##NaN at -Inf (no limit). For negative non-integer x the result is the logarithm of the absolute value (the reflection formula is used).

Accuracy: absolute error about 1e-15 times the magnitude of the result.

See also gamma, log-gamma-1p, log-beta.

Logarithm of the absolute value of the Gamma function, $\log|\Gamma(x)|$.

Parameters:

- `x` (double): the argument.

Returns `##Inf` at zero, at the negative integers and at `##Inf`; `##NaN` at `-Inf` (no limit). For negative non-integer `x` the result is the logarithm of the absolute value (the reflection formula is used).

Accuracy: absolute error about 1e-15 times the magnitude of the result.

See also [[gamma]], [[log-gamma-1p]], [[log-beta]].
raw docstring

log-gamma-1pclj

(log-gamma-1p x)

$\ln\Gamma(1+x)$, accurate for x near zero.

Parameters:

  • x (double): the argument. For $-0.5≤x≤1.5$ a dedicated algorithm is used (Apache Commons Math), outside this range the result is (log-gamma (+ 1.0 x)).

See also log-gamma, inv-gamma-1pm1.

$\ln\Gamma(1+x)$, accurate for `x` near zero.

Parameters:

- `x` (double): the argument. For $-0.5≤x≤1.5$ a dedicated algorithm is used (Apache Commons Math), outside this range the result is `(log-gamma (+ 1.0 x))`.

See also [[log-gamma]], [[inv-gamma-1pm1]].
raw docstring

log-gamma-complexclj

(log-gamma-complex z)

Logarithm of the complex gamma function, the analytic branch with the cut along the negative real axis: Im log Gamma(z) is the continuous continuation (not wrapped to (-pi, pi], so that exp of it is Gamma(z)), as mpmath.loggamma and SpecialFunctions.loggamma.

Parameters:

  • z ([[Vec2]]): the argument.

Returns log(Gamma(z)). At the poles of Gamma (z a non-positive real integer, zero included), Gamma genuinely diverges there without a single well-defined direction-independent limit in the complex plane; this returns (Vec2. ##Inf ##Inf) for every such z except z = 0.0+0.0i exactly, which instead returns a finite imaginary part (##Inf real part only) following the standard convention for the principal branch approaching along the positive real axis. ##NaN/##Inf real or imaginary input parts propagate following the usual IEEE conventions.

See also gamma-complex, gamma.

Logarithm of the complex gamma function, the analytic branch with the cut along the negative real axis: `Im log Gamma(z)` is the continuous continuation (not wrapped to `(-pi, pi]`, so that `exp` of it is `Gamma(z)`), as `mpmath.loggamma` and `SpecialFunctions.loggamma`.

Parameters:

- `z` ([[Vec2]]): the argument.

Returns `log(Gamma(z))`. At the poles of Gamma (`z` a non-positive real integer, zero included), Gamma genuinely diverges there without a single well-defined direction-independent limit in the complex plane; this returns `(Vec2. ##Inf ##Inf)` for every such `z` except `z = 0.0+0.0i` exactly, which instead returns a finite imaginary part (`##Inf` real part only) following the standard convention for the principal branch approaching along the positive real axis. `##NaN`/`##Inf` real or imaginary input parts propagate following the usual IEEE conventions.

See also [[gamma-complex]], [[gamma]].
raw docstring

lower-incomplete-gammaclj

(lower-incomplete-gamma s x)

Lower incomplete gamma function $\gamma(s,x)=\int_0^x t^{s-1}e^{-t}dt$.

Parameters:

  • s (double): the shape; any real except non-positive integers, for s <= 0 the function is defined by the analytic continuation $\Gamma(s)-\Gamma(s,x)$.
  • x (double): the upper limit, x >= 0.

Returns ##NaN for x < 0 and for s a non-positive integer; 0.0 at x = 0 for s > 0; $\Gamma(s)$ at x = Inf for s > 0; for s = Inf the limit, 0.0 for x <= 1 and ##Inf above.

The result is computed without cancellation for small x (a series for s > 0 and x <= s+1, the product of the regularized function and $\Gamma(s)$ in log space otherwise; a power series for s <= 0 and x <= 1).

Accuracy: relative error about 1e-13 (about 2.4e-14 for a tiny s, where the value is near 1/s).

See also upper-incomplete-gamma, regularized-gamma-p.

Lower incomplete gamma function $\gamma(s,x)=\int_0^x t^{s-1}e^{-t}dt$.

Parameters:

- `s` (double): the shape; any real except non-positive integers, for `s <= 0` the function is defined by the analytic continuation $\Gamma(s)-\Gamma(s,x)$.
- `x` (double): the upper limit, `x >= 0`.

Returns `##NaN` for `x < 0` and for `s` a non-positive integer; `0.0` at `x = 0` for `s > 0`; $\Gamma(s)$ at `x = Inf` for `s > 0`; for `s = Inf` the limit, `0.0` for `x <= 1` and `##Inf` above.

The result is computed without cancellation for small `x` (a series for `s > 0` and `x <= s+1`, the product of the regularized function and $\Gamma(s)$ in log space otherwise; a power series for `s <= 0` and `x <= 1`).

Accuracy: relative error about 1e-13 (about 2.4e-14 for a tiny `s`, where the value is near `1/s`).

See also [[upper-incomplete-gamma]], [[regularized-gamma-p]].
raw docstring

minkowskiclj

(minkowski x)

Minkowski's question mark function $?(x)$, the increasing homeomorphism of $[0,1]$ that maps the rationals to the dyadic rationals (continued fraction $[a_0;a_1,a_2,\ldots]\mapsto a_0+2\sum_k(-1)^{k+1}2^{-(a_1+\cdots+a_k)}$).

Parameters:

  • x (double): any real. The function is extended to all reals by $?(x+1)=?(x)+1$, so $?(x)=\lfloor x\rfloor+?(x-\lfloor x\rfloor)$.

Returns ?(0)=0, ?(1)=1, ?(1/2)=1/2, ?(1/3)=1/4; ##NaN for ##NaN; ##Inf and ##-Inf for the infinities.

The value is computed by the Stern-Brocot descent until the added dyadic is below the unit in the last place of the result, so the absolute error is about 1e-16 times the magnitude.

See also fastmath.core/floor.

Minkowski's question mark function $?(x)$, the increasing homeomorphism of $[0,1]$ that maps the rationals to the dyadic rationals (continued fraction $[a_0;a_1,a_2,\ldots]\mapsto a_0+2\sum_k(-1)^{k+1}2^{-(a_1+\cdots+a_k)}$).

Parameters:

- `x` (double): any real. The function is extended to all reals by $?(x+1)=?(x)+1$, so $?(x)=\lfloor x\rfloor+?(x-\lfloor x\rfloor)$.

Returns `?(0)=0`, `?(1)=1`, `?(1/2)=1/2`, `?(1/3)=1/4`; `##NaN` for `##NaN`; `##Inf` and `##-Inf` for the infinities.

The value is computed by the Stern-Brocot descent until the added dyadic is below the unit in the last place of the result, so the absolute error is about 1e-16 times the magnitude.

See also [[fastmath.core/floor]].
raw docstring

owens-tclj

(owens-t h a)

Owen's T function $T(h,a)=\frac{1}{2\pi}\int_0^a \frac{e^{-h^2(1+x^2)/2}}{1+x^2}dx$.

Parameters:

  • h (double): the first argument; $T$ is even in h.
  • a (double): the second argument; $T$ is odd in a.

Returns T(h,0)=0, T(0,a)=atan(a)/(2π), T(h,±Inf)=±erfc(|h|/√2)/4, T(±Inf,a)=0. It is the probability that a bivariate normal vector lies in a wedge, with $\Phi(h)=\ldots$.

Accuracy: relative error about 1e-14 over the whole domain (computed with the upper tails of the normal distribution for a>1, so that it stays accurate in the far tail, e.g. T(10,2)=3.8e-24); underflows to 0.0 for |h| above about 38.

See also erfc.

Owen's T function $T(h,a)=\frac{1}{2\pi}\int_0^a \frac{e^{-h^2(1+x^2)/2}}{1+x^2}dx$.

Parameters:

- `h` (double): the first argument; $T$ is even in `h`.
- `a` (double): the second argument; $T$ is odd in `a`.

Returns `T(h,0)=0`, `T(0,a)=atan(a)/(2π)`, `T(h,±Inf)=±erfc(|h|/√2)/4`, `T(±Inf,a)=0`. It is the probability that a bivariate normal vector lies in a wedge, with $\Phi(h)=\ldots$.

Accuracy: relative error about 1e-14 over the whole domain (computed with the upper tails of the normal distribution for `a>1`, so that it stays accurate in the far tail, e.g. `T(10,2)=3.8e-24`); underflows to `0.0` for `|h|` above about 38.

See also [[erfc]].
raw docstring

polygammaclj

(polygamma m x)

Computes the polygamma function of order m at a real argument x.

The polygamma function is the m-th derivative of the digamma function, generalizing digamma (order 0) and trigamma (order 1) to arbitrary nonnegative integer order.

Parameters:

  • m (double): the order, a nonnegative integer (any other value gives ##NaN).
  • x (double): real argument.

Returns a double. Poles are at x equal to 0 or any negative integer: for odd m the result there is ##Inf (both one-sided limits agree), for even m it is ##NaN at the negative integers (the one-sided limits differ) and ##-Inf at 0.0 (##Inf at -0.0), the limits from the side of the zero's sign. For x>0, results are positive for odd m and negative for even m, and decay towards 0 as x grows.

Accuracy: relative error about 1e-13 for x>0; for x<=0 it degrades with the order and with the closeness of x to a pole.

See also digamma, trigamma, zeta.

Computes the polygamma function of order `m` at a real argument `x`.

The polygamma function is the `m`-th derivative of the digamma function,
generalizing [[digamma]] (order `0`) and [[trigamma]] (order `1`) to
arbitrary nonnegative integer order.

Parameters:

- `m` (double): the order, a nonnegative integer (any other value gives `##NaN`).
- `x` (double): real argument.

Returns a double. Poles are at `x` equal to `0` or any negative integer:
for odd `m` the result there is `##Inf` (both one-sided limits agree), for
even `m` it is `##NaN` at the negative integers (the one-sided limits
differ) and `##-Inf` at `0.0` (`##Inf` at `-0.0`), the limits from the
side of the zero's sign. For `x>0`, results are positive for odd `m` and
negative for even `m`, and decay towards `0` as `x` grows.

Accuracy: relative error about 1e-13 for `x>0`; for `x<=0` it degrades
with the order and with the closeness of `x` to a pole.

See also [[digamma]], [[trigamma]], [[zeta]].
raw docstring

regularized-betaclj

(regularized-beta x a b)

Regularized incomplete beta function $I_x(a,b)=B(x;a,b)/B(a,b)$.

Parameters:

  • x (double): the argument in $[0,1]$.
  • a, b (double): the shape parameters. For a,b>0: Apache Commons Math (continued fraction) for moderate shapes, the hypergeometric form for b below 1e-3 (a below 1e4), and the incomplete gamma limit for a shape below 1e-3 with the other at least 1e4, or when one shape is at least 1e8 and the other at most 1e-5 of it (below 1e7) or at most 1e-10 of it. Other values are defined by the analytic continuation through hypergeometric-2F1.

Returns 0 at x=0, 1 at x=1 (for a,b>0) and ##NaN outside $[0,1]$, for a=0 or b=0 and for a ##NaN argument. For shapes below 1e-20 the value is b/(a+b), for a below 1e-20 and below 1e-18 b it is 1; ##NaN for a non-positive integer 1-b of magnitude above 2^53 (a<0). Returns ##NaN when both shapes are at least 1e7 and their ratio is above 1e-10 (two large shapes are not supported: the continued fraction loses accuracy there).

The upper tail $1-I_x(a,b)$ is $I_{1-x}(b,a)$; for x near 1 (1-x exact) this gives the small upper tail without the cancellation of 1 - (regularized-beta x a b).

Accuracy: relative error about 5e-14 for moderate shapes, growing with the shapes (about 1e-11 at 1e4, 1e-9 at 1e6, up to 2e-8 when the larger shape is about 1e10 and the smaller 1e6); about 1e-13 for a shape below 1e-3, up to 5e-10 for a tiny b with a moderate a (the hypergeometric series; for b below 1e-6 and max(a,1)(1-x) at most 1 (x at least 0.5) an expansion in 1-x, about 5e-12 at b=1e-7 growing like b^2 to 5e-10 close to 1e-6; with x near 1 and b from 1e-6 to 1e-5 up to 5e-9, 4e-10 at 1e-5), worse in the far lower tail of a large a (I below 1e-13: about 1e-7 at 1e-16, 0.16 at 1e-21 for a=100); 1e-15 to 1e-8 for one large shape (worse as the smaller shape grows).

See also incomplete-beta, beta.

Regularized incomplete beta function $I_x(a,b)=B(x;a,b)/B(a,b)$.

Parameters:

- `x` (double): the argument in $[0,1]$.
- `a`, `b` (double): the shape parameters. For `a,b>0`: Apache Commons Math (continued fraction) for moderate shapes, the hypergeometric form for `b` below `1e-3` (`a` below `1e4`), and the incomplete gamma limit for a shape below `1e-3` with the other at least `1e4`, or when one shape is at least `1e8` and the other at most `1e-5` of it (below `1e7`) or at most `1e-10` of it. Other values are defined by the analytic continuation through [[hypergeometric-2F1]].

Returns `0` at `x=0`, `1` at `x=1` (for `a,b>0`) and `##NaN` outside $[0,1]$, for `a=0` or `b=0` and for a `##NaN` argument. For shapes below `1e-20` the value is `b/(a+b)`, for `a` below `1e-20` and below `1e-18 b` it is `1`; `##NaN` for a non-positive integer `1-b` of magnitude above `2^53` (`a<0`). Returns `##NaN` when both shapes are at least `1e7` and their ratio is above `1e-10` (two large shapes are not supported: the continued fraction loses accuracy there).

The upper tail $1-I_x(a,b)$ is $I_{1-x}(b,a)$; for `x` near `1` (`1-x` exact) this gives the small upper tail without the cancellation of `1 - (regularized-beta x a b)`.

Accuracy: relative error about 5e-14 for moderate shapes, growing with the shapes (about 1e-11 at `1e4`, 1e-9 at `1e6`, up to 2e-8 when the larger shape is about `1e10` and the smaller `1e6`); about 1e-13 for a shape below `1e-3`, up to 5e-10 for a tiny `b` with a moderate `a` (the hypergeometric series; for `b` below `1e-6` and `max(a,1)(1-x)` at most `1` (`x` at least `0.5`) an expansion in `1-x`, about 5e-12 at `b=1e-7` growing like `b^2` to 5e-10 close to `1e-6`; with `x` near `1` and `b` from `1e-6` to `1e-5` up to 5e-9, 4e-10 at `1e-5`), worse in the far lower tail of a large `a` (`I` below 1e-13: about 1e-7 at 1e-16, 0.16 at 1e-21 for `a=100`); 1e-15 to 1e-8 for one large shape (worse as the smaller shape grows).

See also [[incomplete-beta]], [[beta]].
raw docstring

regularized-gamma-pclj

(regularized-gamma-p a x)

Regularized lower incomplete gamma function $P(a,x)=\gamma(a,x)/\Gamma(a)$.

Parameters:

  • a (double): the shape, any real. For a <= 0 a non-positive integer gives P = 1 (the limit), other values are defined by the analytic continuation.
  • x (double): the argument, x >= 0.

Returns ##NaN for x < 0; P(a,0)=0 and P(a,Inf)=1 for a > 0; P(Inf,x)=0 for a finite x.

Accuracy: relative error about 1e-13 for a > 0: Apache Commons Math for 0.1 <= a < 1.5e4 (up to 3e-11 near x = a close to 1.5e4), a series for a < 0.1 (through 1 - Q where Q <= 0.5), Temme's uniform asymptotic expansion for a >= 1.5e4 (up to 6e-12 at 1.5e4, 3e-14 from 1e5).

See also regularized-gamma-q, lower-incomplete-gamma.

Regularized lower incomplete gamma function $P(a,x)=\gamma(a,x)/\Gamma(a)$.

Parameters:

- `a` (double): the shape, any real. For `a <= 0` a non-positive integer gives `P = 1` (the limit), other values are defined by the analytic continuation.
- `x` (double): the argument, `x >= 0`.

Returns `##NaN` for `x < 0`; `P(a,0)=0` and `P(a,Inf)=1` for `a > 0`; `P(Inf,x)=0` for a finite `x`.

Accuracy: relative error about 1e-13 for `a > 0`: Apache Commons Math for `0.1 <= a < 1.5e4` (up to 3e-11 near `x = a` close to `1.5e4`), a series for `a < 0.1` (through `1 - Q` where `Q <= 0.5`), Temme's uniform asymptotic expansion for `a >= 1.5e4` (up to 6e-12 at `1.5e4`, 3e-14 from `1e5`).

See also [[regularized-gamma-q]], [[lower-incomplete-gamma]].
raw docstring

regularized-gamma-qclj

(regularized-gamma-q a x)

Regularized upper incomplete gamma function $Q(a,x)=\Gamma(a,x)/\Gamma(a)=1-P(a,x)$.

Parameters:

  • a (double): the shape, any real. For a <= 0 a non-positive integer gives Q = 0 (the limit), other values are defined by the analytic continuation.
  • x (double): the argument, x >= 0.

Returns ##NaN for x < 0; Q(a,0)=1 and Q(a,Inf)=0 for a > 0; Q(Inf,x)=1 for a finite x.

Accuracy: relative error about 1e-13 for a > 0, also in the small upper tail: Apache Commons Math for 0.1 <= a < 1.5e4 (up to 3e-11 near x = a close to 1.5e4), upper-incomplete-gamma divided by $\Gamma(a)$ for a < 0.1, Temme's uniform asymptotic expansion for a >= 1.5e4 (up to 6e-12 at 1.5e4, 3e-14 from 1e5).

See also regularized-gamma-p, upper-incomplete-gamma.

Regularized upper incomplete gamma function $Q(a,x)=\Gamma(a,x)/\Gamma(a)=1-P(a,x)$.

Parameters:

- `a` (double): the shape, any real. For `a <= 0` a non-positive integer gives `Q = 0` (the limit), other values are defined by the analytic continuation.
- `x` (double): the argument, `x >= 0`.

Returns `##NaN` for `x < 0`; `Q(a,0)=1` and `Q(a,Inf)=0` for `a > 0`; `Q(Inf,x)=1` for a finite `x`.

Accuracy: relative error about 1e-13 for `a > 0`, also in the small upper tail: Apache Commons Math for `0.1 <= a < 1.5e4` (up to 3e-11 near `x = a` close to `1.5e4`), [[upper-incomplete-gamma]] divided by $\Gamma(a)$ for `a < 0.1`, Temme's uniform asymptotic expansion for `a >= 1.5e4` (up to 6e-12 at `1.5e4`, 3e-14 from `1e5`).

See also [[regularized-gamma-p]], [[upper-incomplete-gamma]].
raw docstring

Siclj

(Si x)

Sine integral, Si(x) = integral_0^x sin(t)/t dt.

Si is an entire, odd function that oscillates around and converges to pi/2 as x grows without bound (and to -pi/2 as x decreases without bound), with its largest overshoot (the Gibbs phenomenon peak, about 1.18*pi/2) at its first local maximum x = pi. Near zero, Si(x) behaves like x, since sin(t)/t -> 1 as t -> 0.

Parameters:

  • x (double): evaluation point, any real number.

Returns Si(x) as a double. Si(0.0) is 0.0 and the function saturates to the exact limits +-HALF_PI for very large |x|. Returns ##NaN for a ##NaN input.

Accuracy: relative error below 1e-15.

See also si (the same function shifted by -pi/2), Ci, Cin (the related cosine integrals).

Sine integral, `Si(x) = integral_0^x sin(t)/t dt`.

`Si` is an entire, odd function that oscillates around and converges to
`pi/2` as `x` grows without bound (and to `-pi/2` as `x` decreases without
bound), with its largest overshoot (the Gibbs phenomenon peak, about
1.18*pi/2) at its first local maximum `x = pi`. Near zero, `Si(x)` behaves
like `x`, since `sin(t)/t -> 1` as `t -> 0`.

Parameters:

- `x` (double): evaluation point, any real number.

Returns `Si(x)` as a double. `Si(0.0)` is `0.0` and the function saturates
to the exact limits `+-HALF_PI` for very large `|x|`. Returns `##NaN` for a
`##NaN` input.

Accuracy: relative error below 1e-15.

See also [[si]] (the same function shifted by `-pi/2`), [[Ci]], [[Cin]]
(the related cosine integrals).
raw docstring

siclj

(si x)

Sine integral Si shifted down by pi/2, i.e. si(x) = Si(x) - pi/2.

This shifted form is convenient when working with the large-x behavior of the sine integral, since si(x) -> 0 as x grows without bound (rather than Si's pi/2). Unlike Si, si is not an odd function (si(-x) = -Si(x) - pi/2, not -si(x)), because the shift by the constant pi/2 breaks the antisymmetry.

Parameters:

  • x (double): evaluation point, any real number.

Returns si(x) as a double. si(0.0) is -HALF_PI. Converges to 0.0 as x grows without bound and to -pi as x decreases without bound. Returns ##NaN for a ##NaN input.

Accuracy: absolute error about 2e-16 (the relative error grows with x because the value tends to zero: -cos(x)/x).

See also Si.

Sine integral [[Si]] shifted down by `pi/2`, i.e. `si(x) = Si(x) - pi/2`.

This shifted form is convenient when working with the large-`x` behavior of
the sine integral, since `si(x) -> 0` as `x` grows without bound (rather
than `Si`'s `pi/2`). Unlike [[Si]], `si` is not an odd function (`si(-x) =
-Si(x) - pi/2`, not `-si(x)`), because the shift by the constant `pi/2`
breaks the antisymmetry.

Parameters:

- `x` (double): evaluation point, any real number.

Returns `si(x)` as a double. `si(0.0)` is `-HALF_PI`. Converges to `0.0`
as `x` grows without bound and to `-pi` as `x` decreases without bound.
Returns `##NaN` for a `##NaN` input.

Accuracy: absolute error about 2e-16 (the relative error grows with `x` because the value tends to zero: `-cos(x)/x`).

See also [[Si]].
raw docstring

spherical-bessel-1-iclj

(spherical-bessel-1-i order x)

First modified spherical Bessel function of the first kind, $i^{(1)}n(x)=\sqrt{\pi/(2x)}I{n+1/2}(x)$.

Parameters:

  • order (double): the order n, any real for x>0; for x<0 only integer orders are defined, $i_n(-x)=(-1)^n i_n(x)$ (non-integer orders give ##NaN).
  • x (double): the argument.

Returns Inf at Inf; ##NaN for a ##NaN argument. At x=0 the one-sided limit: from the right at 0.0 and for a non-integer order, from the left at -0.0 for an integer order (x<0 is in the domain there); ##Inf, ##-Inf, a signed zero or the finite limit. As spherical-bessel-j, with +0 where n+1/2 is a negative integer. Orders 0, 1, 2 use closed forms (power series for small x).

Accuracy: relative error about 1e-13. Next to a half-integer order where the Bessel order of the function is a negative integer the value is ill-conditioned in the order (relative condition number about |n|/d, d the distance to the half-integer; the Bessel order is also rounded): the error is up to that times the machine epsilon, see bessel-I.

See also spherical-bessel-2-i, bessel-I.

First modified spherical Bessel function of the first kind, $i^{(1)}_n(x)=\sqrt{\pi/(2x)}I_{n+1/2}(x)$.

Parameters:

- `order` (double): the order `n`, any real for `x>0`; for `x<0` only integer orders are defined, $i_n(-x)=(-1)^n i_n(x)$ (non-integer orders give `##NaN`).
- `x` (double): the argument.

Returns `Inf` at `Inf`; `##NaN` for a `##NaN` argument. At `x=0` the one-sided limit: from the right at `0.0` and for a non-integer order, from the left at `-0.0` for an integer order (`x<0` is in the domain there); `##Inf`, `##-Inf`, a signed zero or the finite limit. As [[spherical-bessel-j]], with `+0` where `n+1/2` is a negative integer. Orders 0, 1, 2 use closed forms (power series for small `x`).

Accuracy: relative error about 1e-13. Next to a half-integer order where the Bessel order of the function is a negative integer the value is ill-conditioned in the order (relative condition number about `|n|/d`, `d` the distance to the half-integer; the Bessel order is also rounded): the error is up to that times the machine epsilon, see [[bessel-I]].

See also [[spherical-bessel-2-i]], [[bessel-I]].
raw docstring

spherical-bessel-1-i0clj

(spherical-bessel-1-i0 x)

First modified spherical Bessel function of the first kind and order 0, $i^{(1)}_0(x)=\sinh(x)/x$.

i0(0)=1, i0(±Inf)=Inf. Even function.

First modified spherical Bessel function of the first kind and order 0, $i^{(1)}_0(x)=\sinh(x)/x$.

`i0(0)=1`, `i0(±Inf)=Inf`. Even function.
raw docstring

spherical-bessel-1-i1clj

(spherical-bessel-1-i1 x)

First modified spherical Bessel function of the first kind and order 1.

i1(0)=0 (-0.0 at -0.0), i1(±Inf)=±Inf. Odd function. A power series is used for small |x|.

First modified spherical Bessel function of the first kind and order 1.

`i1(0)=0` (`-0.0` at `-0.0`), `i1(±Inf)=±Inf`. Odd function. A power series is used for small `|x|`.
raw docstring

spherical-bessel-1-i2clj

(spherical-bessel-1-i2 x)

First modified spherical Bessel function of the first kind and order 2.

i2(0)=0, i2(±Inf)=Inf. Even function. A power series is used for small |x|.

First modified spherical Bessel function of the first kind and order 2.

`i2(0)=0`, `i2(±Inf)=Inf`. Even function. A power series is used for small `|x|`.
raw docstring

spherical-bessel-2-iclj

(spherical-bessel-2-i order x)

Second modified spherical Bessel function of the first kind, $i^{(2)}n(x)=\sqrt{\pi/(2x)}I{-n-1/2}(x)$.

Parameters:

  • order (double): the order n, any real for x>0; for x<0 only integer orders are defined, $i^{(2)}_n(-x)=(-1)^{n+1} i^{(2)}_n(x)$ (non-integer orders give ##NaN).
  • x (double): the argument.

Returns Inf at Inf; ##NaN for a ##NaN argument and for the order ##Inf. At x=0 the one-sided limit: from the right at 0.0 and for a non-integer order, from the left at -0.0 for an integer order (x<0 is in the domain there); ##Inf, ##-Inf, a signed zero or the finite limit. ±Inf for n>-1 (orders 0, 1, 2: Inf, -Inf, Inf at 0.0), 1 for n=-1, a zero for n<-1 and where -n-1/2 is a negative integer.

Accuracy: relative error about 1e-13. Next to a half-integer order where the Bessel order of the function is a negative integer the value is ill-conditioned in the order (relative condition number about |n|/d, d the distance to the half-integer; the Bessel order is also rounded): the error is up to that times the machine epsilon, see bessel-I.

See also spherical-bessel-1-i, bessel-I.

Second modified spherical Bessel function of the first kind, $i^{(2)}_n(x)=\sqrt{\pi/(2x)}I_{-n-1/2}(x)$.

Parameters:

- `order` (double): the order `n`, any real for `x>0`; for `x<0` only integer orders are defined, $i^{(2)}_n(-x)=(-1)^{n+1} i^{(2)}_n(x)$ (non-integer orders give `##NaN`).
- `x` (double): the argument.

Returns `Inf` at `Inf`; `##NaN` for a `##NaN` argument and for the order `##Inf`. At `x=0` the one-sided limit: from the right at `0.0` and for a non-integer order, from the left at `-0.0` for an integer order (`x<0` is in the domain there); `##Inf`, `##-Inf`, a signed zero or the finite limit. `±Inf` for `n>-1` (orders 0, 1, 2: `Inf`, `-Inf`, `Inf` at `0.0`), `1` for `n=-1`, a zero for `n<-1` and where `-n-1/2` is a negative integer.

Accuracy: relative error about 1e-13. Next to a half-integer order where the Bessel order of the function is a negative integer the value is ill-conditioned in the order (relative condition number about `|n|/d`, `d` the distance to the half-integer; the Bessel order is also rounded): the error is up to that times the machine epsilon, see [[bessel-I]].

See also [[spherical-bessel-1-i]], [[bessel-I]].
raw docstring

spherical-bessel-2-i0clj

(spherical-bessel-2-i0 x)

Second modified spherical Bessel function of the first kind and order 0, $\cosh(x)/x$.

i0(0)=Inf (-Inf at -0.0, the limit from the left), i0(±Inf)=±Inf. Odd function.

Second modified spherical Bessel function of the first kind and order 0, $\cosh(x)/x$.

`i0(0)=Inf` (`-Inf` at `-0.0`, the limit from the left), `i0(±Inf)=±Inf`. Odd function.
raw docstring

spherical-bessel-2-i1clj

(spherical-bessel-2-i1 x)

Second modified spherical Bessel function of the first kind and order 1.

i1(0)=-Inf, i1(±Inf)=Inf. Even function.

Second modified spherical Bessel function of the first kind and order 1.

`i1(0)=-Inf`, `i1(±Inf)=Inf`. Even function.
raw docstring

spherical-bessel-2-i2clj

(spherical-bessel-2-i2 x)

Second modified spherical Bessel function of the first kind and order 2.

i2(0)=Inf (-Inf at -0.0, the limit from the left), i2(±Inf)=±Inf. Odd function.

Second modified spherical Bessel function of the first kind and order 2.

`i2(0)=Inf` (`-Inf` at `-0.0`, the limit from the left), `i2(±Inf)=±Inf`. Odd function.
raw docstring

spherical-bessel-jclj

(spherical-bessel-j order x)

Spherical Bessel function of the first kind, $j_n(x)=\sqrt{\pi/(2x)}J_{n+1/2}(x)$.

Parameters:

  • order (double): the order n, any real for x>0; for x<0 only integer orders are defined, $j_n(-x)=(-1)^n j_n(x)$ (non-integer orders give ##NaN).
  • x (double): the argument.

Returns 0 at ±Inf; ##NaN for a ##NaN argument. At x=0 the one-sided limit: from the right at 0.0 and for a non-integer order, from the left at -0.0 for an integer order (x<0 is in the domain there); ##Inf, ##-Inf, a signed zero or the finite limit. j_0(0)=1, j_n(0)=0 for n>0, j_n(0+)=±Inf for n<0 (+0 or -0 where n+1/2 is a negative integer); j_{-1}(±0)=±Inf. Orders 0, 1, 2 use closed forms (power series for small x).

Accuracy: relative error about 1e-13. Next to a half-integer order where the Bessel order of the function is a negative integer the value is ill-conditioned in the order (relative condition number about |n|/d, d the distance to the half-integer; the Bessel order is also rounded): the error is up to that times the machine epsilon, see bessel-J.

See also spherical-bessel-y, bessel-J.

Spherical Bessel function of the first kind, $j_n(x)=\sqrt{\pi/(2x)}J_{n+1/2}(x)$.

Parameters:

- `order` (double): the order `n`, any real for `x>0`; for `x<0` only integer orders are defined, $j_n(-x)=(-1)^n j_n(x)$ (non-integer orders give `##NaN`).
- `x` (double): the argument.

Returns `0` at `±Inf`; `##NaN` for a `##NaN` argument. At `x=0` the one-sided limit: from the right at `0.0` and for a non-integer order, from the left at `-0.0` for an integer order (`x<0` is in the domain there); `##Inf`, `##-Inf`, a signed zero or the finite limit. `j_0(0)=1`, `j_n(0)=0` for `n>0`, `j_n(0+)=±Inf` for `n<0` (`+0` or `-0` where `n+1/2` is a negative integer); `j_{-1}(±0)=±Inf`. Orders 0, 1, 2 use closed forms (power series for small `x`).

Accuracy: relative error about 1e-13. Next to a half-integer order where the Bessel order of the function is a negative integer the value is ill-conditioned in the order (relative condition number about `|n|/d`, `d` the distance to the half-integer; the Bessel order is also rounded): the error is up to that times the machine epsilon, see [[bessel-J]].

See also [[spherical-bessel-y]], [[bessel-J]].
raw docstring

spherical-bessel-j0clj

(spherical-bessel-j0 x)

Spherical Bessel function of the first kind and order 0, $j_0(x)=\sin(x)/x$.

j0(0)=1, j0(±Inf)=0. Even function.

Spherical Bessel function of the first kind and order 0, $j_0(x)=\sin(x)/x$.

`j0(0)=1`, `j0(±Inf)=0`. Even function.
raw docstring

spherical-bessel-j1clj

(spherical-bessel-j1 x)

Spherical Bessel function of the first kind and order 1, $j_1(x)=\sin(x)/x^2-\cos(x)/x$.

j1(0)=0 (-0.0 at -0.0), j1(±Inf)=0. Odd function. A power series is used for small |x| (the closed form cancels).

Spherical Bessel function of the first kind and order 1, $j_1(x)=\sin(x)/x^2-\cos(x)/x$.

`j1(0)=0` (`-0.0` at `-0.0`), `j1(±Inf)=0`. Odd function. A power series is used for small `|x|` (the closed form cancels).
raw docstring

spherical-bessel-j2clj

(spherical-bessel-j2 x)

Spherical Bessel function of the first kind and order 2.

j2(0)=0, j2(±Inf)=0. Even function. A power series is used for small |x| (the closed form cancels).

Spherical Bessel function of the first kind and order 2.

`j2(0)=0`, `j2(±Inf)=0`. Even function. A power series is used for small `|x|` (the closed form cancels).
raw docstring

spherical-bessel-kclj

(spherical-bessel-k order x)

Modified spherical Bessel function of the second kind, $k_n(x)=\sqrt{\pi/(2x)}K_{n+1/2}(x)$.

Parameters:

  • order (double): the order n, any real.
  • x (double): the argument, x>=0.

Returns ##NaN for x<0 and a ##NaN argument, Inf at 0 (also -0.0) and 0 at Inf. Orders 0, 1, 2 use closed forms.

Accuracy: relative error about 1e-13.

See also bessel-K, spherical-bessel-1-i.

Modified spherical Bessel function of the second kind, $k_n(x)=\sqrt{\pi/(2x)}K_{n+1/2}(x)$.

Parameters:

- `order` (double): the order `n`, any real.
- `x` (double): the argument, `x>=0`.

Returns `##NaN` for `x<0` and a `##NaN` argument, `Inf` at `0` (also `-0.0`) and `0` at `Inf`. Orders 0, 1, 2 use closed forms.

Accuracy: relative error about 1e-13.

See also [[bessel-K]], [[spherical-bessel-1-i]].
raw docstring

spherical-bessel-k0clj

(spherical-bessel-k0 x)

Modified spherical Bessel function of the second kind and order 0, $\frac{\pi}{2}e^{-x}/x$.

k0(0)=Inf (also at -0.0), k0(Inf)=0; ##NaN for x<0.

Modified spherical Bessel function of the second kind and order 0, $\frac{\pi}{2}e^{-x}/x$.

`k0(0)=Inf` (also at `-0.0`), `k0(Inf)=0`; `##NaN` for `x<0`.
raw docstring

spherical-bessel-k1clj

(spherical-bessel-k1 x)

Modified spherical Bessel function of the second kind and order 1.

k1(0)=Inf (also at -0.0), k1(Inf)=0; ##NaN for x<0.

Modified spherical Bessel function of the second kind and order 1.

`k1(0)=Inf` (also at `-0.0`), `k1(Inf)=0`; `##NaN` for `x<0`.
raw docstring

spherical-bessel-k2clj

(spherical-bessel-k2 x)

Modified spherical Bessel function of the second kind and order 2.

k2(0)=Inf (also at -0.0), k2(Inf)=0; ##NaN for x<0.

Modified spherical Bessel function of the second kind and order 2.

`k2(0)=Inf` (also at `-0.0`), `k2(Inf)=0`; `##NaN` for `x<0`.
raw docstring

spherical-bessel-yclj

(spherical-bessel-y order x)

Spherical Bessel function of the second kind, $y_n(x)=\sqrt{\pi/(2x)}Y_{n+1/2}(x)$.

Parameters:

  • order (double): the order n, any real for x>0; for x<0 only integer orders are defined, $y_n(-x)=(-1)^{n+1} y_n(x)$ (non-integer orders give ##NaN).
  • x (double): the argument.

Returns 0 at ±Inf; ##NaN for a ##NaN argument. At x=0 the one-sided limit: from the right at 0.0 and for a non-integer order, from the left at -0.0 for an integer order (x<0 is in the domain there); ##Inf, ##-Inf, a signed zero or the finite limit. y_n(0+)=-Inf for n>=-1/2; e.g. y_{-1}(0)=1, y_{-3/2}(0+)=Inf. Orders 0, 1, 2 use closed forms.

Accuracy: relative error about 1e-13; next to a half-integer order where bessel-Y uses its power series (x<7, also n+1/2 above 1.35x-4.5) up to about 400 eps/d (d the distance to the half-integer).

See also spherical-bessel-j, bessel-Y.

Spherical Bessel function of the second kind, $y_n(x)=\sqrt{\pi/(2x)}Y_{n+1/2}(x)$.

Parameters:

- `order` (double): the order `n`, any real for `x>0`; for `x<0` only integer orders are defined, $y_n(-x)=(-1)^{n+1} y_n(x)$ (non-integer orders give `##NaN`).
- `x` (double): the argument.

Returns `0` at `±Inf`; `##NaN` for a `##NaN` argument. At `x=0` the one-sided limit: from the right at `0.0` and for a non-integer order, from the left at `-0.0` for an integer order (`x<0` is in the domain there); `##Inf`, `##-Inf`, a signed zero or the finite limit. `y_n(0+)=-Inf` for `n>=-1/2`; e.g. `y_{-1}(0)=1`, `y_{-3/2}(0+)=Inf`. Orders 0, 1, 2 use closed forms.

Accuracy: relative error about 1e-13; next to a half-integer order where [[bessel-Y]] uses its power series (`x<7`, also `n+1/2` above `1.35x-4.5`) up to about `400 eps/d` (`d` the distance to the half-integer).

See also [[spherical-bessel-j]], [[bessel-Y]].
raw docstring

spherical-bessel-y0clj

(spherical-bessel-y0 x)

Spherical Bessel function of the second kind and order 0, $y_0(x)=-\cos(x)/x$.

y0(0)=-Inf (+Inf at -0.0, the limit from the left), y0(±Inf)=0. Odd function.

Spherical Bessel function of the second kind and order 0, $y_0(x)=-\cos(x)/x$.

`y0(0)=-Inf` (`+Inf` at `-0.0`, the limit from the left), `y0(±Inf)=0`. Odd function.
raw docstring

spherical-bessel-y1clj

(spherical-bessel-y1 x)

Spherical Bessel function of the second kind and order 1.

y1(0)=-Inf, y1(±Inf)=0. Even function.

Spherical Bessel function of the second kind and order 1.

`y1(0)=-Inf`, `y1(±Inf)=0`. Even function.
raw docstring

spherical-bessel-y2clj

(spherical-bessel-y2 x)

Spherical Bessel function of the second kind and order 2.

y2(0)=-Inf (+Inf at -0.0, the limit from the left), y2(±Inf)=0. Odd function.

Spherical Bessel function of the second kind and order 2.

`y2(0)=-Inf` (`+Inf` at `-0.0`, the limit from the left), `y2(±Inf)=0`. Odd function.
raw docstring

spherical-hankel-1clj

(spherical-hankel-1 order x)

Spherical Hankel function of the first kind, $h^{(1)}_n(x)=j_n(x)+iy_n(x)$, as a complex number [[Vec2]].

Parameters: order (double), x (double), see spherical-bessel-j and spherical-bessel-y for the domain.

See also spherical-hankel-2.

Spherical Hankel function of the first kind, $h^{(1)}_n(x)=j_n(x)+iy_n(x)$, as a complex number [[Vec2]].

Parameters: `order` (double), `x` (double), see [[spherical-bessel-j]] and [[spherical-bessel-y]] for the domain.

See also [[spherical-hankel-2]].
raw docstring

spherical-hankel-2clj

(spherical-hankel-2 order x)

Spherical Hankel function of the second kind, $h^{(2)}_n(x)=j_n(x)-iy_n(x)$, as a complex number [[Vec2]].

Parameters: order (double), x (double), see spherical-bessel-j and spherical-bessel-y for the domain.

See also spherical-hankel-1.

Spherical Hankel function of the second kind, $h^{(2)}_n(x)=j_n(x)-iy_n(x)$, as a complex number [[Vec2]].

Parameters: `order` (double), `x` (double), see [[spherical-bessel-j]] and [[spherical-bessel-y]] for the domain.

See also [[spherical-hankel-1]].
raw docstring

tricomis-Uclj

(tricomis-U a b x)

Confluent hypergeometric function U of the second kind, also known as Tricomi's function.

The second, generally unbounded-as-x-approaches-0 solution of Kummer's differential equation (the first being kummers-M), related to it for non-integer b via U(a,b,x) = Gamma(1-b)/Gamma(a-b+1) kummers-M(a,b,x) + Gamma(b-1)/Gamma(a) x^(1-b) kummers-M(a-b+1,2-b,x).

Parameters:

  • a, b (double): the two parameters.
  • x (double): the argument. The validated domain is x >= 0.0; x < 0.0 is not a domain this function is intended for (typically ##NaN, though a handful of specific parameter coincidences may return an unvalidated real number instead).

At x = 0.0: returns Gamma(1-b)/Gamma(a-b+1) for b < 1.0. For b >= 1.0, U genuinely diverges there, returning a signed ##Inf following the sign of Gamma(a), unless a is itself a non-positive integer, in which case the divergence is removable and the result is the finite value (-1)^n (b)_n (writing a = -n, and (b)_n the rising Pochhammer symbol). Elsewhere, real and finite.

Method: for a > 0 the integral $U=\frac{1}{\Gamma(a)}\int_0^\infty e^{-xt}t^{a-1}(1+t)^{b-a-1}dt$ with a positive integrand (no cancellation, trapezoidal rule in $\log t$); for a non-integer a < 0 the Kummer transformation $U(a,b,x)=x^{1-b}U(a-b+1,2-b,x)$ when a-b+1 > 0, otherwise the three-term recurrence in a from two positive first parameters; the terminating polynomial for a non-positive integer a; the asymptotic series (x > 50, large against a and a-b+1).

Accuracy: relative error below 1e-13 for a > 0 and for a non-positive integer a (checked on 1900 mpmath points, x from 0.01 to 1000, a and b up to 100); for a non-integer a < 0 it degrades with b: about 1e-11 for b <= 8.5, 1e-7 for b = 25, 1e-3 for b = 100 (a = -6.5), and a value that overflows a double is ##NaN instead of ±Inf.

See also kummers-M, whittaker-W, hypergeometric-2F0.

Confluent hypergeometric function U of the second kind, also known as Tricomi's function.

The second, generally unbounded-as-x-approaches-0 solution of Kummer's differential equation (the first being [[kummers-M]]), related to it for non-integer `b` via `U(a,b,x) = Gamma(1-b)/Gamma(a-b+1) kummers-M(a,b,x) + Gamma(b-1)/Gamma(a) x^(1-b) kummers-M(a-b+1,2-b,x)`.

Parameters:

- `a`, `b` (double): the two parameters.
- `x` (double): the argument. The validated domain is `x >= 0.0`; `x < 0.0` is not a domain this function is intended for (typically `##NaN`, though a handful of specific parameter coincidences may return an unvalidated real number instead).

At `x = 0.0`: returns `Gamma(1-b)/Gamma(a-b+1)` for `b < 1.0`. For `b >= 1.0`, `U` genuinely diverges there, returning a signed `##Inf` following the sign of `Gamma(a)`, unless `a` is itself a non-positive integer, in which case the divergence is removable and the result is the finite value `(-1)^n (b)_n` (writing `a = -n`, and `(b)_n` the rising Pochhammer symbol). Elsewhere, real and finite.

Method: for `a > 0` the integral $U=\frac{1}{\Gamma(a)}\int_0^\infty e^{-xt}t^{a-1}(1+t)^{b-a-1}dt$ with a positive integrand (no cancellation, trapezoidal rule in $\log t$); for a non-integer `a < 0` the Kummer transformation $U(a,b,x)=x^{1-b}U(a-b+1,2-b,x)$ when `a-b+1 > 0`, otherwise the three-term recurrence in `a` from two positive first parameters; the terminating polynomial for a non-positive integer `a`; the asymptotic series (`x > 50`, large against `a` and `a-b+1`).

Accuracy: relative error below 1e-13 for `a > 0` and for a non-positive integer `a` (checked on 1900 mpmath points, `x` from 0.01 to 1000, `a` and `b` up to 100); for a non-integer `a < 0` it degrades with `b`: about 1e-11 for `b <= 8.5`, 1e-7 for `b = 25`, 1e-3 for `b = 100` (`a = -6.5`), and a value that overflows a double is `##NaN` instead of `±Inf`.

See also [[kummers-M]], [[whittaker-W]], [[hypergeometric-2F0]].
raw docstring

tricomis-U-complexclj

(tricomis-U-complex a b z)

Complex version of Tricomi's confluent hypergeometric function U(a,b,z) of the second kind.

Arguments a, b and z can be real or complex numbers; plain numbers are promoted to complex automatically via ensure-complex.

  • Input: a, b, z — real or complex numbers (scalars or [[Vec2]] complex pairs)
  • Returns: [[Vec2]] complex number

At z = 0.0+0.0i with a and b both real: mirrors the real-valued tricomis-U's own x = 0 limit exactly (finite for a a non-positive integer or b < 1.0, a signed ##Inf-valued complex number otherwise). At z = 0.0+0.0i with a or b genuinely complex, the limit is path-dependent (branch-cut sensitive) and not resolved here; (Vec2. ##NaN ##NaN) is returned instead.

For z != 0.0+0.0i: tries the asymptotic-series formula first, for ANY z (see [[tricomis-U-complex-asymptotic]] -- this mirrors mpmath's own hyperu, which does the same). This alone resolves every case checked so far except Re(z) < 0.0 at moderate-to-large |z| with b also an integer, where it falls back to a Kummer-M-function reflection formula instead. That reflection formula remains accurate for small to moderate |z|, but its accuracy becomes unpredictable for larger |z| there -- confirmed to occasionally lose several or more digits, or return a non-finite value, for specific parameter combinations even at moderate |z| (around 5-10), with no clean magnitude threshold separating safe from unsafe cases; this is a known, uncorrected limitation, inherited from the same underlying resummation instability documented for hypergeometric-pFq-complex, and confirmed present in mpmath's own hyperu at at least one such point too (it recovers there only by raising its working precision arbitrarily, an option not available at fixed double precision). The reflection formula also has its own removable singularity whenever b is an integer, resolved via a small Richardson-extrapolated numerical limit.

Accuracy: relative error below 1e-12 for most arguments (300 random points); up to 1e-6 for a complex a with Re(a) < 0 and Re(z) < 0, and on the negative real axis (the cut).

See also the real-valued tricomis-U, hypergeometric-pFq-complex.

Complex version of Tricomi's confluent hypergeometric function U(a,b,z) of the second kind.

Arguments `a`, `b` and `z` can be real or complex numbers; plain numbers are promoted to
complex automatically via `ensure-complex`.

- Input: `a`, `b`, `z` — real or complex numbers (scalars or [[Vec2]] complex pairs)
- Returns: [[Vec2]] complex number

At `z = 0.0+0.0i` with `a` and `b` both real: mirrors the real-valued [[tricomis-U]]'s own `x = 0` limit exactly (finite for `a` a non-positive integer or `b < 1.0`, a signed `##Inf`-valued complex number otherwise). At `z = 0.0+0.0i` with `a` or `b` genuinely complex, the limit is path-dependent (branch-cut sensitive) and not resolved here; `(Vec2. ##NaN ##NaN)` is returned instead.

For `z != 0.0+0.0i`: tries the asymptotic-series formula first, for ANY `z` (see [[tricomis-U-complex-asymptotic]] -- this mirrors mpmath's own `hyperu`, which does the same). This alone resolves every case checked so far except `Re(z) < 0.0` at moderate-to-large `|z|` with `b` also an integer, where it falls back to a Kummer-`M`-function reflection formula instead. That reflection formula remains accurate for small to moderate `|z|`, but its accuracy becomes unpredictable for larger `|z|` there -- confirmed to occasionally lose several or more digits, or return a non-finite value, for specific parameter combinations even at moderate `|z|` (around 5-10), with no clean magnitude threshold separating safe from unsafe cases; this is a known, uncorrected limitation, inherited from the same underlying resummation instability documented for [[hypergeometric-pFq-complex]], and confirmed present in mpmath's own `hyperu` at at least one such point too (it recovers there only by raising its working precision arbitrarily, an option not available at fixed double precision). The reflection formula also has its own removable singularity whenever `b` is an integer, resolved via a small Richardson-extrapolated numerical limit.

Accuracy: relative error below 1e-12 for most arguments (300 random points); up to 1e-6 for a complex `a` with `Re(a) < 0` and `Re(z) < 0`, and on the negative real axis (the cut).

See also the real-valued [[tricomis-U]], [[hypergeometric-pFq-complex]].
raw docstring

trigammaclj

(trigamma x)

Second derivative of log of Gamma function, $\psi_1(x)$.

Parameters:

  • x (double): the argument.

Returns ##Inf at zero and at the negative integers (a double pole, both one-sided limits are +Inf). Negative non-integer x is handled by the reflection formula.

Accuracy: relative error about 1e-15.

See also digamma, polygamma.

Second derivative of log of Gamma function, $\psi_1(x)$.

Parameters:

- `x` (double): the argument.

Returns `##Inf` at zero and at the negative integers (a double pole, both one-sided limits are `+Inf`). Negative non-integer `x` is handled by the reflection formula.

Accuracy: relative error about 1e-15.

See also [[digamma]], [[polygamma]].
raw docstring

upper-incomplete-gammaclj

(upper-incomplete-gamma s x)

Upper incomplete gamma function $\Gamma(s,x)=\int_x^\infty t^{s-1}e^{-t}dt$.

Parameters:

  • s (double): the shape; any real, for s <= 0 the function is defined by the analytic continuation.
  • x (double): the lower limit, x >= 0.

Returns ##NaN for x < 0 and a ##NaN argument; $\Gamma(s,0)=\Gamma(s)$ for s > 0; $\Gamma(s,\infty)=0$; ##Inf for s = Inf and a finite x.

For 0 < s < 0.1 the function is computed directly (a series for x <= 1.5, En above), without the cancellation of the regularized ratio; otherwise from regularized-gamma-q and $\Gamma(s)$ in log space.

Accuracy: relative error about 1e-13.

See also lower-incomplete-gamma, regularized-gamma-q, En.

Upper incomplete gamma function $\Gamma(s,x)=\int_x^\infty t^{s-1}e^{-t}dt$.

Parameters:

- `s` (double): the shape; any real, for `s <= 0` the function is defined by the analytic continuation.
- `x` (double): the lower limit, `x >= 0`.

Returns `##NaN` for `x < 0` and a `##NaN` argument; $\Gamma(s,0)=\Gamma(s)$ for `s > 0`; $\Gamma(s,\infty)=0$; `##Inf` for `s = Inf` and a finite `x`.

For `0 < s < 0.1` the function is computed directly (a series for `x <= 1.5`, [[En]] above), without the cancellation of the regularized ratio; otherwise from [[regularized-gamma-q]] and $\Gamma(s)$ in log space.

Accuracy: relative error about 1e-13.

See also [[lower-incomplete-gamma]], [[regularized-gamma-q]], [[En]].
raw docstring

whittaker-Mclj

(whittaker-M kappa mu x)

Whittaker's M function.

A standard solution of Whittaker's differential equation, expressed via Kummer's confluent hypergeometric function kummers-M: M(kappa,mu,x) = exp(-x/2) x^(mu+1/2) kummers-M(mu-kappa+1/2, 2mu+1, x).

Parameters:

  • kappa (double): the first parameter.
  • mu (double): the second parameter.
  • x (double): the argument, restricted to x >= 0.0 (for x < 0.0, x^(mu+1/2) generally leaves the real line, so ##NaN is returned).

As x approaches 0.0 from above, the result approaches 0.0 when mu > -0.5, diverges to ##Inf when mu < -0.5, and approaches 1.0 when mu = -0.5 exactly (x^(mu+1/2) reduces to the constant 1 there). Elsewhere, inherits kummers-M's domain and pole structure through the transformed parameters mu-kappa+1/2 and 2mu+1.

See also kummers-M, whittaker-W, tricomis-U.

Whittaker's M function.

A standard solution of Whittaker's differential equation, expressed via Kummer's confluent hypergeometric function [[kummers-M]]: `M(kappa,mu,x) = exp(-x/2) x^(mu+1/2) kummers-M(mu-kappa+1/2, 2mu+1, x)`.

Parameters:

- `kappa` (double): the first parameter.
- `mu` (double): the second parameter.
- `x` (double): the argument, restricted to `x >= 0.0` (for `x < 0.0`, `x^(mu+1/2)` generally leaves the real line, so `##NaN` is returned).

As `x` approaches `0.0` from above, the result approaches `0.0` when `mu > -0.5`, diverges to `##Inf` when `mu < -0.5`, and approaches `1.0` when `mu = -0.5` exactly (`x^(mu+1/2)` reduces to the constant `1` there). Elsewhere, inherits [[kummers-M]]'s domain and pole structure through the transformed parameters `mu-kappa+1/2` and `2mu+1`.

See also [[kummers-M]], [[whittaker-W]], [[tricomis-U]].
raw docstring

whittaker-Wclj

(whittaker-W kappa mu x)

Whittaker's W function.

A standard solution of Whittaker's differential equation, expressed via the confluent hypergeometric function of the second kind tricomis-U: W(kappa,mu,x) = exp(-x/2) x^(mu+1/2) tricomis-U(mu-kappa+1/2, 2mu+1, x).

Parameters:

  • kappa (double): the first parameter.
  • mu (double): the second parameter.
  • x (double): the argument, restricted to x >= 0.0 (for x < 0.0, x^(mu+1/2) generally leaves the real line, so ##NaN is returned).

As x approaches 0.0 from above, the result approaches 0.0 when mu > -0.5, diverges (with a sign that follows tricomis-U's own limiting value there, unlike whittaker-M this is not always positive) when mu < -0.5, and approaches tricomis-U's own value at that point when mu = -0.5 exactly (x^(mu+1/2) reduces to the constant 1 there). Elsewhere, inherits tricomis-U's domain and pole structure through the transformed parameters mu-kappa+1/2 and 2mu+1.

See also tricomis-U, kummers-M, whittaker-M.

Whittaker's W function.

A standard solution of Whittaker's differential equation, expressed via the confluent hypergeometric function of the second kind [[tricomis-U]]: `W(kappa,mu,x) = exp(-x/2) x^(mu+1/2) tricomis-U(mu-kappa+1/2, 2mu+1, x)`.

Parameters:

- `kappa` (double): the first parameter.
- `mu` (double): the second parameter.
- `x` (double): the argument, restricted to `x >= 0.0` (for `x < 0.0`, `x^(mu+1/2)` generally leaves the real line, so `##NaN` is returned).

As `x` approaches `0.0` from above, the result approaches `0.0` when `mu > -0.5`, diverges (with a sign that follows [[tricomis-U]]'s own limiting value there, unlike [[whittaker-M]] this is not always positive) when `mu < -0.5`, and approaches [[tricomis-U]]'s own value at that point when `mu = -0.5` exactly (`x^(mu+1/2)` reduces to the constant `1` there). Elsewhere, inherits [[tricomis-U]]'s domain and pole structure through the transformed parameters `mu-kappa+1/2` and `2mu+1`.

See also [[tricomis-U]], [[kummers-M]], [[whittaker-M]].
raw docstring

xiclj

(xi s)

Riemann (Landau's) xi function $\xi(s)=\tfrac12 s(s-1)\pi^{-s/2}\Gamma(s/2)\zeta(s)$, entire and symmetric: $\xi(s)=\xi(1-s)$.

Parameters:

  • s (double): the argument.

Returns xi(0)=xi(1)=1/2.

See also zeta, gamma.

Riemann (Landau's) xi function $\\xi(s)=\\tfrac12 s(s-1)\\pi^{-s/2}\\Gamma(s/2)\\zeta(s)$, entire and symmetric: $\\xi(s)=\\xi(1-s)$.

Parameters:

- `s` (double): the argument.

Returns `xi(0)=xi(1)=1/2`.

See also [[zeta]], [[gamma]].
raw docstring

zetaclj

(zeta s)
(zeta s z)

Computes the Riemann zeta function of s, or the Hurwitz (generalized) zeta function of s and z.

The Riemann zeta function is sum(n^-s) for n from 1 to infinity, analytically continued to the whole real line except for its pole at s=1. The Hurwitz zeta function generalizes it with an additional real offset z, as sum((z+n)^-s) for n from 0 to infinity; it reduces to the Riemann zeta function when z is 0 or 1.

Parameters:

  • s (double): the order.
  • z (double, two-argument arity only): the offset.

Returns a double. ##NaN at the pole s=1 (single-argument arity), or where z<0 together with a non-integer s (two-argument arity, a domain where no real result exists). Values that legitimately exceed double precision saturate to ##Inf or ##-Inf.

Accuracy of the two-argument (Hurwitz) form degrades for very negative s (roughly below -5), particularly combined with z close to 0; the single-argument (Riemann) form is accurate across its whole domain.

See also eta, dirichlet-beta, xi, polygamma.

Computes the Riemann zeta function of `s`, or the Hurwitz (generalized)
zeta function of `s` and `z`.

The Riemann zeta function is `sum(n^-s)` for `n` from `1` to infinity,
analytically continued to the whole real line except for its pole at
`s=1`. The Hurwitz zeta function generalizes it with an additional real
offset `z`, as `sum((z+n)^-s)` for `n` from `0` to infinity; it reduces
to the Riemann zeta function when `z` is `0` or `1`.

Parameters:

- `s` (double): the order.
- `z` (double, two-argument arity only): the offset.

Returns a double. `##NaN` at the pole `s=1` (single-argument arity), or
where `z<0` together with a non-integer `s` (two-argument arity, a domain
where no real result exists). Values that legitimately exceed double
precision saturate to `##Inf` or `##-Inf`.

Accuracy of the two-argument (Hurwitz) form degrades for very negative
`s` (roughly below `-5`), particularly combined with `z` close to `0`;
the single-argument (Riemann) form is accurate across its whole domain.

See also [[eta]], [[dirichlet-beta]], [[xi]], [[polygamma]].
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close