Gradients of a simple function using ForwardDiff yields errorenous results? - Or am I doing something wrong?

(log.(x) .+ log.(gammax) .- log.(z) .- log.(gammaz))' = (1 ./ x .+ (gammax')./gammax .- (z')./x .- (gammaz')./gammaz). When z, and gammaz are independent on x(they are constants in f2), then, their partial derivatives are 0s (z' = gammaz' = some zeros) so the derivatives are different.

1 Like