File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -801,6 +801,18 @@ Special functions
801801 Return the `Gamma function <https://en.wikipedia.org/wiki/Gamma_function >`_ at
802802 *x *.
803803
804+ Example::
805+
806+ >>> math.gamma(5) # factorial(n-1) for integer n
807+ 24.0
808+ >>> math.gamma(2.5) # fractional values
809+ 1.329340388179137
810+ >>> math.gamma(-1.5) # negative inputs
811+ 2.363271801207354
812+ >>> math.gamma(0) # pole at zero
813+ Traceback (most recent call last):
814+ ...
815+ ValueError: math domain error
804816 .. versionadded :: 3.2
805817
806818
@@ -809,6 +821,19 @@ Special functions
809821 Return the natural logarithm of the absolute value of the Gamma
810822 function at *x *.
811823
824+ Example::
825+
826+ >>> math.lgamma(5) # log(factorial(4))
827+ 3.1780538303479458
828+ >>> math.lgamma(10.5) # fractional values
829+ 13.458901694870227
830+ >>> math.lgamma(-0.5) # negative inputs
831+ 1.2655121234846454
832+ >>> math.lgamma(0) # pole at zero
833+ Traceback (most recent call last):
834+ ...
835+ ValueError: math domain error
836+
812837 .. versionadded :: 3.2
813838
814839
You can’t perform that action at this time.
0 commit comments