I tried to build the differences from the values of one element [n] to the next element [n+1] in the same numpy.array.
This must be repeated for all n, I expect n-1 result values.
Furthermore I want to avoid using loops, because loops may be a source of errors numbering the elements.
Now I'm looking for an operation like:
result = array[n+1] - array[n]
for all n.
I tried much similar implementations, but I always get some error messages.
How can I make it work?
np.diff(array)does what you ask