I have some problems with the built-in function Differences
. I do not understand how its behaviour comes about under the following circumstances:
vec = {a, b, c, d, e, f, g, h};
vec2 = ConstantArray[1, 10];
Differences[#, 1, 0]^2 & /@ {vec, vec2}
gives me
{{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}
as an output. What is the reason for the 1 in the last entry of the second list? Shouldn't it be 0 as well?
0s
. $\endgroup$0s
$\endgroup$zeroes
only. Have you tried to restart the kernel before running the code? $\endgroup$Differences
indicates how many steps apart in the array elements should be so not entirely sure 0 makes sense here in the first place $\endgroup$