I want my program to spit out a vector whose entries are the average of the entries with same place index of other vectors. The entries of the latter vectors are updated in a for
loop, thus in the same for
loop i do the vector sum and in the end I divide by the number of iterations:
N=10000
path=np.zeros(N)
path_avg=path
def avg_path_finder(iterations):
for i in range(iterations):
index=int(random()*N)
path[index]+=1
path_avg+=path
path_avg=path_avg/iterations
return path_avg
This is the syntax error I get: Unresolved reference to path_avg
.
What can I do to fix this?