" ValueError:使用序列"设置数组元素

时间:2015-02-16 23:44:13

标签: python numpy

def VerletNextV(v_t,a_t,a_t_plus_h):

  v_t_plus_h = [0.0, 0.0, 0.0]
  #<-- find v_t_plus_h[0], v_t_plus_h[1], v_t_plus_h[2], here -->
  for i in range(0,len(v_t_plus_h)):
    v_t_plus_h[i] = v_t + .5*(a_t[i] + a_t_plus_h[i])
  return v_t_plus_h

接下来我有这一行:

nV[i] = VerletNextV(V[i],A[i], a_t_h)

这给了我在标题中指定的错误:

ValueError: setting an array element with a sequence

这让我疯了 - 这里有什么问题? nV[i]声明使用:

nV = numpy.zeros((N,3))

0 个答案:

没有答案