ddg.math.functions module
Basic functions and math expressions.
- ddg.math.functions.qgamma(z, q)[source]
A generalised variant of
mpmath.qgamma().Unlike
mpmath.qgamma(), this function returns infinity instead of raising aZeroDivisionError.- Parameters:
- zcomplex or mpmath.mpf
- qcomplex or mpmath.mpf
- Returns:
- mpmath.mpf or mpmath.mpc
If the result is complex, mpmath.mpc will be returned. Otherwise mpmath.mpf.
Examples
>>> from ddg.math.functions import qgamma >>> qgamma(4, 0.75) mpf('4.046875') >>> qgamma(6, 6) mpf('121226245.0') >>> qgamma(3 + 4j, 0.5j) mpc(real='0.16630823822551999', imag='0.019524745760259529') >>> qgamma(0, 1) mpf('+inf')
- ddg.math.functions.double_factorial(n)[source]
The double factorial function.
\[\begin{split}\text{double_factorial}(n) = \begin{cases} n \cdot \text{double_factorial}(n - 2) &\text{ if } n \ge 2 \\ 1 &\text{ otherwise}. \end{cases}\end{split}\]- Parameters:
- nint
- Returns:
- int
Examples
>>> from ddg.math.functions import double_factorial >>> double_factorial(4) 8 >>> double_factorial(10) 3840 >>> double_factorial(0) 1