: **************************************************** : * FUNCTION PLOTTER - plots F(x) on graphics screen * :( * Z88 Users' Club graphics patch required. * :2 * (C) Danny Langton, Aware Technology, 11/1988. * :< * ................................................ * :F * Functions are entered as strings in terms of X, * :P * i.e., X*X,X^3+5, EXP(0.5*X), COS X, etc. * :Z * For those interested in the code iteself, the * :d * complications introduced by the variables FLAG, * :n * X3 and the ON ERROR calls are necessary to deal * :x * with the mathematical errors such as division by * : * zero, log range, etc., otherwise the routines * : * are, I believe, fairly straightforward. * : **************************************************** : 1  4flag= - no errors yet!  #'"PLOT FUNCTION - f(X) = : "X$ 1"START VALUE FOR X : "X1$:X1=X1$:X3=X1 +"END VALUE FOR X : "X2$:X2=X2$ I0,4)400,4)"NUMBER OF POINTS : "INCX%:INCX%=INCX%:INCX%>1 10,5)"Calculating..." : "findYends(flag) ,ERROR:TbA 6X1=X3 !@(X2)>(X1)XD=(X2)XD=(X1) )J(YMAX)>(YMIN)YD=(YMAX)YD=(YMIN) TSCALEX=128/XD:SCALEY=32/YD 1^0,5)"Maximum : ";YMAX;10'"Minimum : ";YMIN h7 %rdrawaxes(128,32,X1,X2,YMAX,YMIN) |ERROR $X=X1:X*SCALEX+128,X$*SCALEY+32 ERROR X=X1 X2 (X2-X3)/INCX% Y=X$ X*SCALEX+128,Y*SCALEY+32  60,7)"Press Q to quit, any other to repeat";:G$= 7"Qq",G$)=0:'"Wipe display ?":G$=:"Yy",G$)>0 "Qq",G$)>0 0: : findYends(F%) ERROR:FLAG=:TbA F%X=X1:YMAX=X$:YMIN=YMAX X=X1 X2 (X2-X3)/INCX% X$>YMAX YMAX=X$ &X$YMAX YMAX=X$X$X2 X2=X1