我有一个数组,(219812,2)
但我需要拆分为2 (219812)
.
我不断收到错误ValueError: operands could not be broadcast together with shapes (219812,2) (219812)
我怎样才能完成?
如您所见,我需要从 u = odeint 中获取两个单独的解决方案并将它们多个。
def deriv(u, t):
return array([ u[1], u[0] - np.sqrt(u[0]) ])
time = np.arange(0.01, 7 * np.pi, 0.0001)
uinit = array([ 1.49907, 0])
u = odeint(deriv, uinit, time)
x = 1 / u * np.cos(time)
y = 1 / u * np.sin(time)
plot(x, y)
plt.show()