Why would you expect
ans = 0
to be non-zero? You are asking for the gradient at one point... to be honest I am surprised that it does not return NaN. Did you read the gradient documentation to know what the two arguments are for?
Perhaps you really wanted to do this:
"Also, is diff for calculating the derivative?"
Did you read the diff documentation? It answers your question, right on the very first line.