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)
The above code gives me the following output:
[32. 16. 8. 4. 2. 1.]
These numbers should be NEGATIVE and I have no idea what's going on with numpy
Thank you!
This is not a problem with numpy. The velocity here is negative, but the acceleration is positive (since the velocity is increasing over time).