Derivatives

slope is an approximation the derivative  where we set h=0.01:

slope[f_,x_]:=(f[x+0.1]-f[x])/0.1;
f[x_]:=x^2;
tangent[f_,x0_,x_]:=f[x0]+(x-x0)*slope[f,x0];

A straight line has constant slope :

line[x_]:=4*x + 7;
slope[line,x];

Derivative of a polynomial :

Expand[(x+h)^2];
Expand[((x+h)^2-x^2)/h];

Manipulate[Plot[{f[x],tangent[f,x0,x]},{x,-5,5},PlotStyle->Thick,PlotRange->25],{x0,-5,5}];

For small values of h, the approximated slope and the actual slope are close:

Plot[{f'[x],slope[f,x]},{x,-5,5},PlotStyle->Thick];

Plot[{f[x],slope[f,x]},{x,-5,5},PlotStyle->Thick,AspectRatio->0.5];