Math 3
Winter 2004
Section 2.1, Tangent and velocity
We show the graphs of a function f and some secants.
>
f:=x->x^3/3: x0:=1:y0:=f(x0): printf(" x1 f(x1) m=(f(x1)-f(x0))/(x1-x0) \n\n"):
for n from 0 to 4 do
x1 := x0+2^(-n): m[n] := (f(x1)-f(x0))/(x1-x0): printf("%15.10f %15.10f %15.10f\n",x1,f(x1),m[n]);
end do:
>
x1 f(x1) m=(f(x1)-f(x0))/(x1-x0)
2.0000000000 2.6666666670 2.3333333330
1.5000000000 1.1250000000 1.5833333330
1.2500000000 .6510416667 1.2708333330
1.1250000000 .4746093750 1.1302083330
1.0625000000 .3998209635 1.0638020830
A graph is always good:
> plot([f(x),m[0]*(x-x0)+y0,m[1]*(x-x0)+y0,m[2]*(x-x0)+y0,m[3]*(x-x0)+y0],x=0.7..2,y=-1..3, color=[black,blue,red,green,yellow]);
>