GeezerVison is showing github.com — Remove extra imports in gamma.py doctests (#8060) · https-github-com-nzysoft/Python@b72d068
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: maths/gamma.py -15Lines changed: 0 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,42 +11,27 @@ def gamma(num: float) -> float: |
11 | 11 | used extension of the factorial function to complex numbers. |
12 | 12 | The gamma function is defined for all complex numbers except the non-positive |
13 | 13 | integers |
14 | | -
|
15 | | -
|
16 | 14 | >>> gamma(-1) |
17 | 15 | Traceback (most recent call last): |
18 | 16 | ... |
19 | 17 | ValueError: math domain error |
20 | | -
|
21 | | -
|
22 | | -
|
23 | 18 | >>> gamma(0) |
24 | 19 | Traceback (most recent call last): |
25 | 20 | ... |
26 | 21 | ValueError: math domain error |
27 | | -
|
28 | | -
|
29 | 22 | >>> gamma(9) |
30 | 23 | 40320.0 |
31 | | -
|
32 | 24 | >>> from math import gamma as math_gamma |
33 | 25 | >>> all(.99999999 < gamma(i) / math_gamma(i) <= 1.000000001 |
34 | 26 | ... for i in range(1, 50)) |
35 | 27 | True |
36 | | -
|
37 | | -
|
38 | | - >>> from math import gamma as math_gamma |
39 | 28 | >>> gamma(-1)/math_gamma(-1) <= 1.000000001 |
40 | 29 | Traceback (most recent call last): |
41 | 30 | ... |
42 | 31 | ValueError: math domain error |
43 | | -
|
44 | | -
|
45 | | - >>> from math import gamma as math_gamma |
46 | 32 | >>> gamma(3.3) - math_gamma(3.3) <= 0.00000001 |
47 | 33 | True |
48 | 34 | """ |
49 | | - |
50 | 35 | if num <= 0: |
51 | 36 | raise ValueError("math domain error") |
52 | 37 |
|
|