I need to loop backwards from i=n-2 to i = 0 to code this math formula:
for i in range(n-2,0):
X[i] = Y[i]
for m in range(i 1,n):
X[i] = X[i] - T[i,m] * X[m]
It doesn't work, what am I doing wrong?
All numbers from numpy arrays
CodePudding user response:
if you want to loop backward you can use the for loop like following
range(start, end, step)
the step is 1 by default. in your case, you have to specify the decrement in order the loop the work.