title: Individual operations on coordinates in 2D arrays
body: <p>Im working on a problem with projectile motion in computational physics, and I want to perform different mathematical operations on the x and y coordinates in my array. The code Im struggling with is indexing inside a for loop.</p>
  
  <p>I've tried different forms for indexing but keep getting errors like "could not broadcast input array from shape (2,2) into shape (2)" and "setting an array element with a sequence."</p>
  
  <pre><code>g = 9.81
  theta = 30
  
  dt = 0.1
  t = 5
  
  n = int(t/dt)
  t = zeros(n)
  r = zeros((n, 2), float)
  v = zeros((n, 2), float)
  a = zeros((n, 2), float)
  
  r[0] = array([0,0])
  v[0] = array([10*cos(theta), 10*sin(theta)])
  t[0] = 0
  
  for i in range(n-1):
      v[i+1] = v[0] - g*dt
      r[i+1] = r[i] + v[i]*dt 
      t[i+1] = t[i] + dt
  </code></pre>
  
  <p>The inserted code shows two columns (v[x,y] and r[x,y]) with different values, where only the y coordinate is correct. This is because the x coordinate is supposed to be constant. I don't understand how to make the x coordinate constant, and only do the operation on the y coordinate. I want the result to be calculated as:</p>
  
  <pre><code>v[i+1] = v[0]         # x-coordinate
  v[i+1] = v[0] - g*dt  # y-coordinate
  </code></pre>