File tree 1 file changed +1
-11
lines changed
1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change @@ -39,25 +39,18 @@ def max_index(X):
39
39
"""
40
40
i = 0
41
41
j = 0
42
-
43
- if isinstance (X , np .ndarray ) == False :
42
+ if isinstance (X , np .ndarray ) is False :
44
43
raise ValueError ("The input is not a numpy array" )
45
-
46
44
elif X .ndim != 2 :
47
45
raise ValueError ("The shape is not 2D" )
48
-
49
46
else :
50
47
for row in range (X .shape [0 ]):
51
48
for col in range (X .shape [1 ]):
52
49
if X [row , col ] > X [i , j ]:
53
50
i = row
54
51
j = col
55
-
56
52
return i , j
57
53
58
- # X = np.array([[1,2],[3,4]])
59
- # print("X", max_index(X))
60
-
61
54
62
55
def wallis_product (n_terms ):
63
56
"""Implement the Wallis product to compute an approximation of pi.
@@ -76,7 +69,4 @@ def wallis_product(n_terms):
76
69
pi : float
77
70
The approximation of order `n_terms` of pi using the Wallis product.
78
71
"""
79
- # XXX : The n_terms is an int that corresponds to the number of
80
- # terms in the product. For example 10000.
81
-
82
72
return 2 * np .prod ([(4 * i ** 2 ) / (4 * i ** 2 - 1 ) for i in range (1 , n_terms + 1 )])
You can’t perform that action at this time.
0 commit comments