L'Hopital's Rule

L'Hopital's rule says that if f[0] = g[0] = 0, then lim_{x --> 0} f(x)/g(x)  equals f'(0)/g'(0). Below we investigate a few special cases. If f'(0) = g'(0) = 0, then one repeats the process, and the limit equals f''(0)/g''(0), and so on.

cosminus1[x_] := Cos[x] - 1;
expminus1[x_] := Exp[x] - 1;
Manipulate[Plot[{f[x]/x, f'[x]/1},{x,-c, c},PlotRange -> {-r,r}], {c, 2 Pi, 0},{r,2,.2},{f, {Sin,cosminus1,expminus1}}]

sinminus[x_] := Sin[x] - x;
cosminus[x_] := Cos[x] - 1;
expminus[x_] := Exp[x] - 1-x;
Manipulate[Plot[{f[x]/x^2, f'[x]/(2x), f''[x]/2},{x,-c, c},PlotRange -> {-r,r}], {c, 2 Pi, 0}, {r,2, .2},{f, {sinminus,cosminus,expminus}}]

(* you can input your functions f and g here and compare *)
f[x_] := x Cos[x] -  Exp[x]+1;
g[x_] := x^2;
Manipulate[Plot[{f[x]/g[x], f'[x]/g'[x]},{x,-c, c},PlotRange -> {-r,r}], {c, 2 Pi, 0},{r,2,.2}]