Derivative of linear function

diff computes the difference between elements in a vector, e.g.

julia> x = [1, 2, 5];

julia> diff(x)
2-element Vector{Int64}:
 1
 3

This operation is not defined on a single number, thats why you get a MethodError.

2 Likes