python - Error:Index out of bounds -
as can seen, having 1000 divisions each of theta, sigma. when iterating 1 1000 theta can seen, getting error. import time start_time = time.clock() import numpy np theta=np.linspace(3,100,1000) sigma=np.linspace(0,10,1000) re=5 import os completename = os.path.abspath("new volume (f:)/new innings 3/sigma @ re=5 @100 .txt") file = open("sigma @ re=5 @100.txt", "w") in np.arange(0,k,1): //k=1000 mu=np.sqrt(re*sigma) a=(mu-1)*np.exp(mu)+(mu+1)*np.exp(-mu) b=2*mu*(theta[i]) c=(a/b) d1=np.exp(mu)/(2*(mu+sigma)) d2=np.exp(-mu)/(2*(mu-sigma)) d3=mu**2 d4=np.exp(-sigma) d5=sigma d6=(mu**2)-(sigma**2) d7=d3*d4 d8=d5*d6 h=d7/d8 d9=(1/sigma) d=d1-d2+h-d9 k1=c-d k2=np.delete(k1,0) k3=np.nonzero(k2>0) k4=sigma[k3] k5=k4[0] k55=np.array(k5) file.write("%g\n" % k55) file.close() print time.clock() - start_time, "seconds" the output foll