90? CHR$(7):FOR k=1 TO 10:NEXT:? CHR$(7)
100HOME:VTAB 8
110? TAB(8); "FUNCTION GRAPH"
120?:? TAB(14); "by"
130?:? TAB(7); "KELLY F. PETERSEN"
140?:? TAB(6); "Fresno, Ca. - 1985 "; 
150FOR k=1 TO 4000:NEXT
160HOME:VTAB 10
170? " Do you need instructions? "; :GET a$
180IF a$="Y" OR a$="y" THEN 200
190GOTO 400
200HOME
210? " FUNCTION GRAPH will plot Y as  a function of X. Enter on line 5000 of the program the"
220? " function you would like to     plot. This must be entered"
230? " in the form of:"
240?:? "      Y=function of x"
242?:? " For example you might want to  try one of the following       functions:"
244?:? "     Y=TAN(X)                       Y=X^2-3"
246? "     Y=X^2/X^3                      Y=X+(1/X)                      Y=SIN(.05*X^2)*5"
248? "     Y=X^3-4*X                      Y=(2*(X^2))/((X^2)-X-2)        Y=X*COS(X)                     Y=X^2-EXP(-X)"
249?:? " Press any key to continue. "; :GET a$:HOME
250?:? " The function will be plotted   from the inputed negative      value of X to the positive"
260? " value. The best positive /     negative range to enter for    most functions is 10."
270?:? TAB(14); "+Y                              |                              |                         -X___|___+X"
275? TAB(14); " |                              |                              |                             -Y"
280?:? " Negative values of X are       plotted to the left and        positive values to the right."
290? " Positive values of Y are       plotted above center with the  negative values below. Both X"
300? " and Y equal 0 where the lines  cross. "; :GET a$
303HOME
305? " This program is designed to    plot functions in which there  is only one value of Y for a"
310? " given value of X."
315?:? " The menu command <R> will      redraw the screen. The command <N> allows you to choose a"
320? " new range to plot the function over. <P> lets you plot a      specific point on the graph"
325? " and gives you the value of Y   for a given value of X."
330?
335? " I would be interested to know  if you find this program       useful. Please send any"
337? " comments via Comp-U-Serve      Easyplex to user #72247,63. "; :GET a$
340HOME:VTAB 7
342? " The function that is currently written on line 5000 of the    program is Y=SIN(X). Would"
345? " you like to change this        function? "; :GET a$
350IF a$="Y" OR a$="y" THEN 355
352GOTO 400
355HOME:VTAB 7
360? " THE PROGRAM HAS ENDED. Please  type the new function on line  5000 then rerun the program."
365?:END
400GOSUB 7500
450CLEAR
500REM      
505? " Positive / negative range for"
507INPUT " X values? "; range
510 mi=-range
520 mx=range
810HCOLOR =5
1000 yunit=255/(range*2)
1010 xunit=255/(range*2)
1190 st=(range*2)/250
1192HOME
1195 z=0
1200FOR i=mi TO mx STEP st
1210 x=i
1215GOSUB 4900
1220GOSUB 5500
1230GOSUB 6000
1240IF x<1 THEN  x=1:GOTO 7000
1250IF x>254 THEN 1320
1260IF y<1 THEN  y=1:GOTO 7000
1270IF y>157 THEN  y=157:GOTO 7000
1280IF z=1 THEN 1300
1290HPLOT x, y:GOTO 1310
1300HPLOT x1, y1 TO x, y
1310 y1=y: x1=x
1315 z=1
1320NEXT i
1400? " Enter: <R>Redraw <N>New Range         <P>Plot Point <E>End "; :GET c$
1410IF c$="R" OR c$="r" THEN GOSUB 7500
1415HOME
1420IF c$="N" OR c$="n" THEN 450
1430IF c$="P" OR c$="p" THEN 2000
1440IF c$="E" OR c$="e" THEN GOTO 1900
1450GOTO 1400
1900TEXT:END
2000HOME: kfp=1
2010? " Input a value for X between"
2020? " "; mi; " and "; mx; "."; :INPUT " "; x
2030IF x>mx OR x<mi THEN GOTO 2000
2040GOSUB 4900
2050HOME
2060? " If X="; x; " then Y="; y
2070GOSUB 6000
2080GOSUB 6500
2090SCALE =1
2100XDRAW 1 AT x1, y1
2110DRAW 1 AT x, y
2120 x1=x: y1=y
2130 kfp=0:GOTO 1400
4900ONERR  GOTO 10000
5000 y=SIN(x)
5100RETURN
5500REM           
5510VTAB 1:? " When X="; x
5520? " Then Y="; y
5530RETURN
6000 x=INT((xunit*x)+127)
6005 y=-y
6010 y=INT((yunit*y)+79)
6100RETURN
6500IF x<1 THEN  x=1
6510IF x>254 THEN  x=254
6520IF y<1 THEN  y=1
6530IF y>157 THEN  y=157
6540RETURN
7000GOSUB 6500
7010HPLOT x1, y1 TO x, y
7100 k=1: z=1
7110FOR j=i+st TO mx STEP st
7120 x=j
7130GOSUB 4900
7140GOSUB 5500
7150GOSUB 6000
7170IF x<1 OR x>254 THEN GOTO 7200
7180IF y<1 OR y>157 THEN GOTO 7200
7190GOTO 7210
7200 x1=x: y1=y
7205NEXT j
7210 i=j
7215GOSUB 6500
7220IF x1<1 THEN  x1=1
7230IF x1>254 THEN  x1=254
7240IF y1<1 THEN  y1=1
7250IF y1>157 THEN  y1=157
7260HPLOT x1, y1 TO x, y
7270 k=0
7280GOTO 1315
7500HGR
7510HCOLOR =9
7520HPLOT 127, 0 TO 127, 158
7530HPLOT 0, 79 TO 255, 79
7540HPLOT 0, 0 TO 255, 0 TO 255, 158 TO 0, 158 TO 0, 0
7550RETURN
10000CLRERR:VTAB 1
10005? " When X="; x
10007? " There is no real number for Y"
10010IF k=1 THEN GOTO 7100
10015IF kfp=1 THEN GOTO 1400
10020GOTO 1320
