(* :Author: Christopher Moretti *) (* :Summary: DerivativeMovie[ function,point,{x,a,b},{y,c,d},hlist] creates a series of plots for animation which illustrate that the tangent line to a curve is the limit of secant lines. The tangent line to y= function at x=point is shown with the secant line using the x-interval lengths given in hlist, and the range for each fram is x=a to y=b and y=c to y=d. The option EstimateLabel-> True creates PlotLabels with the estimated slopes and the true slopes. Points is an option which is passed to PointSize and can be used to increase or decrease the size of the two points plotted on the secant line. DerivativeMovie accepts all the options for Plot using Mathematica 3.0's FilterOptions command.*) (* :History: Version 1.0 by Christopher Moretti, 1998 *) <.05,EstimateLabel->False,PlotLabel->None} DerivativeMovie[expr_,pt_,ind_List,dep_List,hlist_List,opts___]:= Block[{x,a,b,y,c,d,line,m,h,msec,linsec,yval,i,pl,r,est,plotopts,lab}, x=ind[[1]];a=ind[[2]];b=ind[[3]]; y=dep[[1]];c=dep[[2]];d=dep[[3]]; plotopts=FilterOptions[Plot,opts]; {r,est,lab}=( {Points,EstimateLabel,PlotLabel}/.{opts}/.Options[DerivativeMovie]); m=(D[expr,x])/.x->pt;yval=(expr/.x->pt); line=m (x-pt)+yval; Do[h=hlist[[i]]; msec=N[( (expr/.x->(pt+h))-yval)/h,6]; linesec=msec(x-pt)+yval; pl=Plot[{expr,line,linesec},{x,a,b},PlotRange->{{a,b},{c,d}}, PlotStyle->{GrayLevel[0],Hue[.5],GrayLevel[0]}, AspectRatio->Automatic,DisplayFunction->Identity]; Show[{pl,Graphics[{Disk[{pt,yval},r],Disk[{pt+h,(expr/.x->(pt+h))},r]}]}, DisplayFunction->$DisplayFunction, PlotLabel-> If[est,"Actual slope is "<>ToString[N[m]]<> " and the estimate is "<> ToString[msec],lab],plotopts];,{i,1,Length[hlist]}];] DerivativeMovie::usage= "DerivativeMovie[expr,pt,{x,a,b},{y,c,d},hlist,plotoptions] created a sequence of plots indexed by the list hlist as x goes from x=a to x=b, y=c to y=d, where the i-th plot contains the graph y=expr, the tangent line at the point (pt, expr(pt)), and the secant line from x=pt to x=pt+hlist[[i]]. DerivativeMovie accepts the options from Plot using the package FilterOptions." (*Example: DerivativeMovie[ Sin[x], Pi/4,{x,0,Pi},{y,-1.5,1.5},{1,.9,.8,.7,.6,.5,.4,.3,.2,.1}] *)