def seidel(a, x ,b):
n = 3
# for loop for 3 times as to calculate x, y , z
for j in range(0, n):
# temp variable d to store b[j]
d = b[j]
# to calculate respective xi, yi, zi
for i in range(0, n):
if j != i:
d = d - a[j][i] * x[i]
# updating the value of our solution
x[j] = d / a[j][j]
# returning our updated solution
return x
n = 3
a = A(3,3)
x = [0,0,0]
b = [1,2,3]
[12, 1.6666666666666667, 2.0, 1.6666666666666667, 18, 2.3333333333333335, 2.0, 2.3333333333333335, 24]
seidel(a,x,b)
TypeError Traceback (most recent call last) in ----> 1 seidel(a,x,b)
in seidel(a, x, b)
10 for i in range(0, n):
11 if j != i:
---> 12 d = d - a[j][i] * x[i]
13 # updating the value of our solution 14 x[j] = d / a[j][j]
TypeError: 'NoneType' object is not subscriptable