\START\ \COMMENT= \NAME=Secant \FILE=SECANT.85P ClLCD FnOff Disp " Secant Tracer" Disp "" Disp "Do you want graphics" Menu(1,"Yes",YES,5,"No",NO) Lbl NO ClLCD 0\->\graphics Disp "No Graphics" Goto main Lbl YES ClLCD 1\->\graphics Disp "Graphics On" Disp "" Disp "Do you want to set" Disp "the range or have" Disp "auto resize?" Menu(1,"auto",auto,5,"set",manual) End Lbl auto 1\->\resize Goto main Lbl manual 0\->\resize Prompt xMin Prompt xMax Lbl main Input "x=", X Lbl getH Input "h=", H If H==0 Then Disp "You cant set h=0." Disp "That's WHY you have" Disp "to take limits." Goto getH End If resize==0 Then If XxMax or X+HxMax Then Disp "One of your points x" Disp "or x+h lies outside" Disp "your graphing range." Disp "" Disp "Change entries?" Goto main End End If resize==1 Then min(X-H/4,X+5H/4)\->\xMin max(X+5H/4,X-H/4)\->\xMax 1\->\graphics End If graphics==1 Then FnOn 1 fMax(y1,x,xMin,xMax)\->\V evalF(y1,x,V)\->\yMax fMin(y1,x,xMin,xMax)\->\V evalF(y1,x,V)\->\yMin yMax+0.05*(yMax-yMin)\->\yMax yMin-0.05*(yMax-yMin)\->\yMin ClDrw DrawF y1 StPic functgr FnOff 1 2\->\graphics End evalF(y1,x,X)\->\YL evalF(y1,x,X+H)\->\YR (YR-YL )/H\->\slope If graphics==2 Then ClDrw RcPic functgr (xMax-xMin)/126\->\DX (yMax-yMin)/62\->\DY For(i,\(-)\1,1,1) For(j,\(-)\1,1,1) PtOn(X+i*DX,YL+j*DY) PtOn(X+H+i*DX,YR+j*DY) End End If H>0 Then X+max(1.5H, 0.5(xMax-X))\->\XR X-min((X-xMin)/4,H/2)\->\XL End If H<0 Then X+max((xMax-X)/4,H/2)\->\XR X+min(1.5H, 0.5(xMin-X))\->\XL End YL+(XR-X)*slope\->\YR YL+(XL-X)*slope\->\YL Line(XL,YL,XR,YR) Pause End Disp "Difference Quotient=" Disp slope Menu(1,"Again",again,5,"Quit",quit) Lbl again ClLCD Disp "Reenter x and h" Disp "or just h?" Menu(1,"h",getH,5,"x, h",main) Lbl quit \STOP\