SECANT TO TANGENT LINE

This animation takes a function, a point on the curve, and an increment, and it shows how a secant line is transformed into a tangent line by letting the increment approach zero. It's really cool animation. I stole it off the Internet. Enjoy!

> with(plots):

> f:=x->x^2;

f := proc (x) options operator, arrow; x^2 end proc...

> SecantToTangent := proc( f, a, h )
local n, Function, Point, Increment;
n := 30;
Function:=display(pointplot({[a,f(a)],[a,0]},symbol=circle, symbolsize=15),plot(f(x),x=-10..10, color=blue), thickness=3):
Point:=display(seq(pointplot({[a+(n-i)/(n/h), f(a+(n-i)/(n/h))], [ a+(n-i)/(n/h),0]},symbol=circle,symbolsize=20,color=red),i=0..n-1),insequence=true):
Increment:=display(seq( plot((f(a+(n-i)/(n/h))-f(a))/(n-i)*(n/h)*(x-a)+f(a), x=-10..10,thickness=2, color=red),i=0..n-1),insequence=true):
display(Function,Point,Increment, view=[-10..10, -10..10]);
end proc:

> SecantToTangent(f, 1, 2);

[Maple Plot]

>