Given any mathematical function what is the easiest way to find the rate of gradient change at any X value?

I am currently calculating the absolute gradient like this...
Code:
let A = small value such as 0.00001
Gradient = (f(x+A) - f(x-A)) / 2A
Is it just a matter of finding the gradient on either side of the X value and subtracting...

(GradientOnRightSide - GradientOnLeftSide) / 2A