File: gamma.txt

package info (click to toggle)
mpmath 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,424 kB
  • sloc: python: 45,022; makefile: 17; sh: 4
file content (111 lines) | stat: -rw-r--r-- 3,042 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Factorials and gamma functions
------------------------------

Factorials and factorial-like sums and products are basic tools of combinatorics and number theory. Much like the exponential function is fundamental to differential equations and analysis in general, the factorial function (and its extension to complex numbers, the gamma function) is fundamental to difference equations and functional equations.

A large selection of factorial-like functions is implemented in mpmath. All functions support complex arguments, and arguments may be arbitrarily large. Results are numerical approximations, so to compute *exact* values a high enough precision must be set manually::

    >>> from mpmath import mp, fac
    >>> mp.dps = 15; mp.pretty = True
    >>> fac(100)
    9.33262154439442e+157
    >>> print(int(_))    # most digits are wrong
    93326215443944150965646704795953882578400970373184098831012889540582227238570431295066113089288327277825849664006524270554535976289719382852181865895959724032
    >>> mp.dps = 160
    >>> fac(100)
    93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000.0

The gamma and polygamma functions are closely related to :doc:`zeta`. See also :doc:`qfunctions` for q-analogs of factorial-like functions.


Factorials
..........

:func:`factorial`/:func:`fac`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: mpmath.factorial(x, **kwargs)

:func:`fac2`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.fac2(x)

Binomial coefficients 
....................................................

:func:`binomial`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.binomial(n,k)


Gamma function
..............

:func:`gamma`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.gamma(x, **kwargs)

:func:`rgamma`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.rgamma(x, **kwargs)

:func:`gammaprod`
^^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.gammaprod(a, b)

:func:`loggamma`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.loggamma(x)


Rising and falling factorials
.............................

:func:`rf`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.rf(x,n)

:func:`ff`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.ff(x,n)

Beta function
.............

:func:`beta`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.beta(x,y)

:func:`betainc`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.betainc(a,b,x1=0,x2=1,regularized=False)


Super- and hyperfactorials
..........................

:func:`superfac`
^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.superfac(z)

:func:`hyperfac`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.hyperfac(z)

:func:`barnesg`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.barnesg(z)


Polygamma functions and harmonic numbers
........................................

:func:`psi`/:func:`digamma`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.psi(m, z)

.. autofunction:: mpmath.digamma(z)

:func:`harmonic`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: mpmath.harmonic(z)