Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/graph1.uti
There are 2 other files named graph1.uti in the archive. Click here to see a list.
100'  NAME--GRAPH1
110'
120'  DESCRIPTION--PLOTS A GRAPH OF A FUNCTION. THE Y-AXIS IS THE
130'  LINE X=A, WHERE A IS THE MINIMAL X-VALUE IN THE GIVEN DOMAIN. THE
140'  X-AXIS IS THE LINE Y=B WHERE B IS THE MINIMAL Y-VALUE IN THE
150'  IN THE RANGE OF THE FUNCTION OVER THE GIVEN DOMAIN. 
160'  THE X-AXIS RUNS VERTICALLY AND THE Y-AXIS HORIZONTALLY SO THAT
170'  THE GRAPH MUST BE TURNED ON ITS SIDE. THERE IS AN OPTION
180'  OF PRINTING THE X-VALUES NEXT TO THE GRAPH (WHICH
190'  WOULD MAKE THE GRAPH ITSELF SMALLER). THERE IS THE OPTION
200'  OF SPECIFYING THE RANGE OF Y-VALUES (THAT IS, THE MINIMAL Y-VALUE
210'  WHCIH IS TO BE IN THE GRAPH, AND THE MAXIMAL Y-VALUE).
220'  IF THE LATTER OPTION IS NOT TAKEN, THE FUNCTION "FILLS" THE
230'  THE GRAPH. THE OPTION MAY BE TAKEN IF, FOR EXAMPLE, THE USER
240'  DESIRED A GRAPH FROM Y=0 TO Y=1, WHEN FOR THE GIVEN X-RANGE
250'  THE FUNCTION DOES NOT ATTAIN THESE VALUES. THUS, THE "REAL" X-AXIS
260'  IS DRAWN. IF THE SPECIFIED MINIMAL Y-POINT IS Y=0. ALSO, IF THE
270'  Y-VALUE OF SOME POINT FALLS OUTSIDE THE SPECIFIED RANGE, THE 
280'  POINT IS NOT PLOTTED.
290'
300'  SOURCE--RONALD FAGIN '67
310'
320'  INSTRUCTIONS--THE FUNCTION IS DEFINED IN LINE 400 AS FNF(X).
330'  FULL INSTRUCTIONS WILL BE GIVEN WHEN "RUN" IS TYPED.
340'
350'
360'  *  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *  *
370'
400 DEF FNF(X)=SIN(X)
410 DEF FNG=INT((FNF(X)-L1)*S1/(R1-L1)+.5)
420 PRINT "IF YOU HAVE NOT YET DEFINED THE FUNCTION, TYPE 'STOP', DEFINE"
430 PRINT "THE FUNCTION IN LINE 400 AS FNF(X), AND THEN TYPE 'RUN'."
440 PRINT
450 PRINT
460 PRINT "WHAT IS THE LEFT X-ENDPOINT, RIGHT X-ENDPOINT, AND"
470 PRINT "X-SPACING";
480 INPUT L,R,D
490 PRINT
500 PRINT "DO YOU WANT X-VALUES PRINTED NEXT TO THE GRAPH";
510 INPUT A$
520 PRINT
530 IF A$="YES" THEN 590
540 IF A$="NO" THEN 570
550 PRINT "INCORRECT ANSWER.  PLEASE TYPE EITHER 'YES' OR 'NO'."
560 GOTO 510
570 LET S1=60
580 GOTO 610
590 LET S1=45
600 LET Z=15
610 PRINT "DO YOU WANT TO SPECIFY THE Y-RANGE";
620 INPUT B$
630 IF B$="NO" THEN 710
640 IF B$="YES" THEN 670
650 PRINT "INCORRECT ANSWER.  PLEASE TYPE EITHER 'YES' OR 'NO'."
660 GOTO 620
670 PRINT
680 PRINT "WHAT IS THE BOTTOM Y-ENDPOINT, AND TOP Y-ENDPOINT";
690 INPUT L1,R1
700 GOTO 820
710 LET R1=L1=FNF(L)
720 FOR X=L TO R STEP D
730 IF FNF(X)>L1 THEN 750
740 LET L1=FNF(X)
750 IF FNF(X)<R1 THEN 770
760 LET R1=FNF(X)
770 NEXT X
780 IF L1<R1 THEN 820
790 PRINT
800 PRINT "THIS IS A CONSTANT FUNCTION."
810 STOP
820 FOR I=1 TO 5
830 PRINT
840 NEXT I
850 FOR I=1 TO 60
860 PRINT ".";
870 NEXT I
880 FOR I=1 TO 6
890 PRINT
900 NEXT I
910 PRINT "THE X-AXIS (THE VERTICAL AXIS) IS THE LINE Y=";L1
920 PRINT
930 PRINT "THE Y-AXIS (THE HORIZONTAL AXIS) IS THE LINE X=";L
940 PRINT
950 PRINT
960 PRINT "X RUNS FROM";L;"TO";R;"WITH EACH SPACE ON THE"
970 PRINT "X-AXIS REPRESENTING";D
980 PRINT
990 PRINT "Y RUNS FROM";L1;"TO";R1;"WITH EACH SPACE ON THE"
1000 PRINT "Y-AXIS REPRESENTING";(R1-L1)/S1
1010 FOR I=1 TO 5
1020 PRINT
1030 NEXT I
1040 IF A$="NO" THEN 1060
1050 PRINT L,
1060 LET X=L
1070 FOR I=0 TO S1
1080 IF FNG=I THEN 1110
1090 PRINT "+";
1100 GOTO 1120
1110 PRINT "*";
1120 NEXT I
1130 PRINT "Y"
1140 FOR X=L+D TO R STEP D
1150 IF A$="NO" THEN 1200
1160 IF D<1E-4 THEN 1190
1170 IF ABS(X)>1E-5 THEN 1190
1180 LET X=0
1190 PRINT X,
1200 IF FNG=0 THEN 1250
1210 PRINT "+";
1220 IF FNG>0 THEN 1270
1230 PRINT
1240 GOTO 1310
1250 PRINT "*"
1260 GOTO 1310
1270 IF FNG<=S1 THEN 1300
1280 PRINT
1290 GOTO 1310
1300 PRINT TAB(FNG+Z);"*"
1310 NEXT X
1320 PRINT TAB(Z);"X"
1330 END