Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0020/graph.uti
There are 2 other files named graph.uti in the archive. Click here to see a list.
100' NAME--GRAPH
110'
120' DESCRIPTION--PLOTS THE GRAPH OF A FUNCTION. THE X-AXIS
130' IS DRAWN IN, IF X=0 IS IN THE GIVEN DOMAIN OR WITHIN FIVE
140' X-INCREMENTS OF IT, THE Y-AXIS IS ALSO DRAWN IN. THE
150' X-AXIS RUNS VERTICALLY, AND THE Y-AXIS HORIZONTALLY, SO
160' THE GRAPH MUST BE TURNED ON ITS SIDE. THE X-VALUES ARE PRINTED
170' NEXT TO THE GRAPH.
180'
190' SOURCE--UNKNOWN
200'
210' INSTRUCTIONS--DEFINE THE FUNCTION AS FNF(X) IN LINE 290.
220' GIVE AS DATA IN LINE 2000 THE LEFT X-ENDPOINT, THE RIGHT
230' X-ENDPOINT THE X-SPACING, THE NUMBER OF UNDEFINED POINTS,
240' AND EACH UNDEFINED POINT SEPARATED BY COMMAS.
250'
260'
270' * * * * * * * MAIN PROGRAM * * * * * * * * * *
280'
290 DEF FNF(X)=1/((X-3)*(X+1))
300 READ A,B,D,N9
310 FOR I=1 TO N9
320 READ Z(I)
330 NEXT I
340 DEF FNG=INT((FNF(X)-L1)/D1+.5)+15
350 LET L2=R2=FNF(A)
360 FOR X=A TO B STEP D
370 FOR I=1 TO N9
380 IF X=Z(I) THEN 440
390 NEXT I
400 IF FNF(X)>L2 THEN 420
410 LET L2=FNF(X)
420 IF FNF(X)<R2 THEN 440
430 LET R2=FNF(X)
440 NEXT X
450 IF L2<0 THEN 480
460 LET R1=R2
470 GOTO 520
480 IF R2>0 THEN 500
490 GOTO 510
500 LET R1=R2
510 LET L1=L2
520 LET D1=(R1-L1)/50
530 IF L1<R1 THEN 560
540 PRINT "THIS IS THE CONSTANT FUNCTION Y=0."
550 STOP
560 PRINT "THE MINIMUM VALUE OF THE FUNCTION IS";L2
570 PRINT
580 PRINT "THE MAXIMUM VALUE OF THE FUNCTION IS";R2
590 PRINT
600 PRINT "THE SPACING ON THE Y-AXIS IS";D1
610 FOR I=1 TO 5
620 PRINT
630 NEXT I
640 LET F=INT(-L1/D1+.5)+15
650 IF A<=0 THEN 760
660 IF A/D>6 THEN 760
670 LET Q1=1
680 IF L1=0 THEN 700
690 PRINT TAB(F);"+"
700 PRINT ,
710 GOTO 950
720 FOR I=1 TO INT(A/D-.5)
730 PRINT TAB(F);"+"
740 NEXT I
750 LET Q1=0
760 FOR X=A TO B STEP D
770 IF D<1E-4 THEN 800
780 IF ABS(X)>1E-5 THEN 800
790 LET X=0
800 PRINT X,
810 FOR P=1 TO N9
820 IF X<>Z(P) THEN 920
830 IF X<>0 THEN 900
840 FOR I2=1 TO 50
850 PRINT "+";
860 NEXT I2
870 LET Q=1
880 PRINT "Y"
890 GO TO 1190
900 PRINT TAB(F); "+"
910 GO TO 1190
920 NEXT P
930 IF X*(X+D)>0 THEN 1100
940 IF X<-D/2 THEN 1100
950 FOR I=0 TO 50
960 IF Q1>0 THEN 980
970 IF FNG=I+15 THEN 1010
980 IF I+15=F THEN 1030
990 PRINT "+";
1000 GOTO 1040
1010 PRINT "*";
1020 GOTO 1040
1030 PRINT "O";
1040 NEXT I
1050 IF I+15<>F THEN 1070
1060 PRINT "+";
1070 PRINT "Y"
1080 LET Q=1
1090 ON Q1+1 GOTO 1190,720,1280
1100 IF X*(X-D)>0 THEN 1120
1110 IF X<=D/2 THEN 950
1120 IF FNG>F THEN 1180
1130 IF FNG=F THEN 1160
1140 PRINT TAB(FNG);"*";TAB(F);"+"
1150 GOTO 1190
1160 PRINT TAB(F);"*"
1170 GOTO 1190
1180 PRINT TAB(F);"+";TAB(FNG);"*"
1190 NEXT X
1200 IF X>=0 THEN 1290
1210 IF -X/D>6 THEN 1290
1220 FOR I=1 TO INT(-X/D-.5)
1230 PRINT TAB(F);"+"
1240 NEXT I
1250 LET Q1=2
1260 PRINT ,
1270 GOTO 950
1280 PRINT TAB(F);"+"
1290 PRINT TAB(F);"X"
1300 IF Q=0 THEN 1320
1310 STOP
1320 PRINT
1330 PRINT
1340 PRINT ,
1350 FOR I=0 TO 50
1360 PRINT "+";
1370 NEXT I
1380 PRINT "Y"
1390 PRINT
1400 PRINT
1410 PRINT " THE ABOVE 'Y-AXIS' IS DRAWN IN ONLY AS A SCALE,"
1420 PRINT " SINCE THE REAL Y-AXIS IS OFF THE GRAPH."
2000 DATA -5,5,.5,2,3,-1
2010 END