utils

This module contains generic utilities for the pydsol code.

pydsol.core.utils.sign(x: float) float[source]

Return the sign of x. Analogous to other programming languages, the following convention is used:

  • return -1 for negative x

  • return +1 for positive x

  • return 0 when x is zero

  • return nan when x is nan

pydsol.core.utils.erf_inv(y: float) float[source]

Approximates the inverse error function (erf) based on the C-algorithm at http://www.naic.edu/~jeffh/inverse_cerf.c.

Raises:
  • TypeError – when y is not a number

  • ValueError – when y is not between -1 and 1 (inclusive)

pydsol.core.utils.beta(z: float, w: float) float[source]

Calculates Beta(z, w) where Beta(z, w) = Gamma(z) * Gamma(w) / Gamma(z + w).

Raises:
  • TypeError – when z or w are not numbers

  • ValueError – when z < 0 or w < 0

exception pydsol.core.utils.DSOLError[source]

General Exception class for pydsol.

pydsol.core.utils.sign(x: float) float[source]

Return the sign of x. Analogous to other programming languages, the following convention is used:

  • return -1 for negative x

  • return +1 for positive x

  • return 0 when x is zero

  • return nan when x is nan

pydsol.core.utils.erf_inv(y: float) float[source]

Approximates the inverse error function (erf) based on the C-algorithm at http://www.naic.edu/~jeffh/inverse_cerf.c.

Raises:
  • TypeError – when y is not a number

  • ValueError – when y is not between -1 and 1 (inclusive)

pydsol.core.utils.beta(z: float, w: float) float[source]

Calculates Beta(z, w) where Beta(z, w) = Gamma(z) * Gamma(w) / Gamma(z + w).

Raises:
  • TypeError – when z or w are not numbers

  • ValueError – when z < 0 or w < 0