I have a list of elements
list = {a, b, c, d, e, f, g, h, i, j, k, l, ...}
I am trying to get successive differences with step s apart. For example, for $s=3$, I am trying to get {-a + d, -d + g, -g + j, ...}
.
I started with diff = Differences[list, 1, 3]
which gives {-a + d, -b + e, -c + f, -d + g, -e + h, -f + i, -g + j, -h + k, -i + l}
. Then I apply Take[diff, {1, -1, 3}]
which gives me my desired values.
Is there any way to optimise this code for larger lists?
Thanks
Differences@list[[;; ;; 3]]
is what you want. $\endgroup$