2024-05-14 14:24:23 发布
网友
import numpy as np data = [128,64,32,16,8,4,2,1] data = np.array(data, dtype=float) velocity = np.diff(data) acceleration = np.diff(velocity) print(acceleration)
上述代码提供了以下输出:
[32. 16. 8. 4. 2. 1.]
这些数字应该是负数,我不知道numpy到底怎么了
谢谢大家!
These numbers should be NEGATIVE and I have no idea what's going on with numpy.
这不是numpy的问题。此处的速度为负,但加速度为正(因为速度随时间增加)
这不是numpy的问题。此处的速度为负,但加速度为正(因为速度随时间增加)
相关问题 更多 >
编程相关推荐