title: Error:Index out of bounds
body: <p>As can be seen, I am having 1000 divisions each of theta, sigma. But when I am iterating from 1 to 1000 for theta as can be seen, I am getting an error.    </p>
  
  <pre><code>import time
  start_time = time.clock()
  
  import numpy as 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 at Re=5 @100 .txt")
  file = open("Sigma at Re=5 @100.txt", "w")
  
  for i 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&gt;0)
      K4=sigma[K3]
      K5=K4[0]
      K55=np.array(K5)
  
      file.write("%g\n" % K55)
  
  file.close()
  
  print time.clock() - start_time, "seconds"
  </code></pre>
  
  <p>The output is the following:</p>
  
  <pre><code> 33     K3=np.nonzero(K2&gt;0)
   34     K4=sigma[K3]
   35     K5=K4[0]
   36     K55=np.array(K5)
  
  IndexError: index out of bounds corresponding to line 35.
  </code></pre>
  
  <p>Kindly help.</p>