Differentiation of tanx gives different value $\dfrac {d \tan(x)}{dx}$ at 31 gives $0.0238$ in casio calculator and using newtons forward method;
But $\sec^2(x)$ gives $1.3610$
 A: Actually both are correct if you understand that your "$\tan(x)$" isn't the usual tangent of $x$. It is "tangent of $x$ degrees" not "tangent of $x$ radians". 
The derivative of $\tan(x)$ (where $x$ is measured in radians) is $\sec^2(x)$. However, if your calculator is set to a "degrees mode", the "tan" function isn't really the standard mathematical tangent function anymore.
In degrees mode "$\tan(x)$" actually means "$\tan\left(\dfrac{\pi}{180}x\right)$" (to convert from unnatural degrees units to natural radians).The derivative of this function is $\dfrac{\pi}{180}\sec^2\left(\dfrac{\pi}{180}x\right)$ (by the chain rule). If you plug $x=31$ degrees into this function you'll get approximately $1.3610$. 
So the calculator's derivative computation is off from the "correct" answer by a factor of $\dfrac{\pi}{180}$ because in reality when you switch to degree mode your trigonometric functions are no longer the standard trig functions but instead some weird degree-mode monstrosities. 
Long story short: Don't use degree mode for anything beyond basic evaluations. Degrees are ok for basic basic stuff, but not for any serious mathematical computations.
