title: Index error: index 10000 is out of bounds for axis 0 with size 10000
body: <p>I don't know how to prevent this error, I am trying to calculate trajectory of a projectile for time->0 to 10 secs at certain launch angle.</p>
  
  <pre><code>g=9.81
  dt=1e3
  v0=40
  gamma=0.005
  height=100
  angle=math.pi/4
  time=np.arange(0,10,dt)
  
  def traj_fric(angle,v0):
      vx0=math.cos(angle)*v0
      vy0=math.sin(angle)*v0
      x=np.zeros(len(time))
      y=np.zeros(len(time))
  
      x[0],y[0]=0,0
      x[1],y[1]=x[0]+vx0*dt,y[0] +vy0*dt    
      i=1
      while y[i]&gt;=0:
          f=0.5*gamma*(height-y[i])*dt
          x[i+1]=((2*x[i]-x[i-1]+f*x[i-1])/1+f)
          y[i+1]=((2*y[i]-y[i-1]+f*y[i-1])-g*dt**2)/1+f
          i=i+1
      x=x[0:i+1]
      y=y[0:i+1]
      return x,y,(dt*i), x[i]    
  
  x,y,duration,distance=traj_fric(angle,v0)
  print ('Distance:' ,distance)
  print ('Duration:' ,duration)
  </code></pre>