home *** CD-ROM | disk | FTP | other *** search
/ Softdisk G-S 144 / SGDS 144.2mg / SDGS.144 / PSL.SDA144 / A / STAT (.txt) < prev    next >
Encoding:
Applesoft BASIC Source Code  |  1993-07-19  |  12.3 KB  |  179 lines  |  [FC] Applesoft BASIC Program (0x0801)

  1. 10 G = 400:LL = 20: FOR I = 1 TO LL:C$ = C$ +" ": NEXT :H$ =  CHR$(8): DIM A%(G),P(G),V(G),W(G),X(G),Y(G),Z(G):H1 = 7:H2 = 9:H3 = 7:H4 = 21:H5 = 7:E$ = "1":F$ = "1": GOTO 280
  2. 20  PRINT "<CTRL-0x04>SAVE STAT": END 
  3. 30  POKE  -16368,0
  4. 40 A =  PEEK(49152): IF A <128  THEN 40
  5. 50  IF A = 155  THEN 280
  6. 60 A = A -128: POKE  -16368,0: RETURN 
  7. 70 L$ = "":R$ = R$ + MID$ (C$,1,LL - LEN(R$)):P1 = 0: POKE  -16368,0: REM <CTRL-0x0f>L$=STRICTLY.L.OF.CURSOR/R$=UNDER+R.OF.CURSOR<CTRL-0x0e>
  8. 80  GET A$:P1 =  LEN(L$):A =  ASC(A$): IF A = 13  THEN L$ = L$ +R$: GOSUB 240: PRINT : RETURN 
  9. 90  IF A = 27  THEN 280
  10. 100  IF A <32  AND A < >8  AND A < >16  AND A < >21  AND A < >25  THEN 80
  11. 110  IF A = 16  OR A = 127  THEN 190
  12. 120  IF A < >8  THEN 150
  13. 130  IF P1 = 0  THEN 80
  14. 140  PRINT A$;:R$ =  RIGHT$(L$,1) +R$:L$ =  MID$ (L$,1,P1 -1): GOTO 80
  15. 150  IF P1 = LL  THEN 80
  16. 160  IF A = 25  THEN R$ =  MID$ (C$,1,LL -P1): PRINT  MID$ (C$,1,LL -P1);: FOR K = 1 TO LL -P1: PRINT H$;: NEXT : GOTO 80
  17. 170  IF A = 21  THEN A$ =  LEFT$(R$,1)
  18. 180 R$ =  MID$ (R$,2,LL -P1 -1): PRINT A$;:L$ = L$ +A$: GOTO 80
  19. 190  IF A < >16  THEN 220
  20. 200  IF P1 = LL  OR R$ =  MID$ (C$,1,LL -P1)  THEN 80
  21. 210 R$ = " " + MID$ (R$,1,LL -P1 -1): PRINT R$;: FOR K = 1 TO LL -P1: PRINT H$;: NEXT : GOTO 80
  22. 220  IF P1 = 0  THEN 80
  23. 230 L$ =  MID$ (L$,1,P1 -1):R$ = R$ +" ": PRINT H$;R$;: FOR K = 1 TO LL -P1 +1: PRINT H$;: NEXT : GOTO 80
  24. 240 P1 =  LEN(L$): IF L$ =  MID$ (C$,1,P1)  THEN L$ = "": RETURN 
  25. 250  IF  MID$ (L$,1,1) = " "  THEN L$ =  MID$ (L$,2): GOTO 250
  26. 260 P1 =  LEN(L$): IF  MID$ (L$,P1) = " "  THEN L$ =  MID$ (L$,1,P1 -1): GOTO 260
  27. 270  RETURN 
  28. 273  VTAB 18: GOSUB 1210: PRINT " Use the following word processing aids when entering data:": PRINT "-<Ctrl>P: Push text from under the cursor to the right ->.": PRINT "-<Ctrl>Y: Erase everything under and to the right of the cursor."
  29. 276  PRINT "-Delete Key: Pull text to the left and delete at the same time.": POKE 35,17: VTAB 3: RETURN 
  30. 280  CALL 54915: GOSUB 1160:M$(1) = "Find statistical values for 1 variable":M$(2) =  LEFT$(M$(1),28) +"2 variables":M$(3) = "'Smooth' a set of ordinates": ONERR  GOTO 1800
  31. 290  VTAB 15: GOSUB 1210: PRINT "The abscissa is the first number of a coordinate pair, representing the value   on the horizontal scale. In the traditional X-Y plane, the abscissa is the      X-Coordinate.": PRINT 
  32. 300  PRINT "The ordinate is the second number of a coordinate pair, representing the value  on the vertical scale. In the traditional X-Y plane, the ordinate is the        Y-Coordinate. In the point (5,11), 5 is the abscissa and 11 is ";
  33. 310  PRINT "the ordinate.": GOSUB 1210:N = 4:M$(N) = "Return to the disk menu":V = H1:E = 6:H = 21:Q$ = "Main Menu": GOSUB 1080:H1 = V:Q$ = M$(V -E): ON V -E GOTO 320,320,980,1150
  34. 320  VTAB 3: GOSUB 1210: PRINT "This program will find the Mean, Median, Mode, etc. in a set of up to "G: PRINT "values, in either 1 or 2 variables.": GOSUB 1210: PRINT 
  35. 330  PRINT "-The Mean (average) of a set of values is the value which, if every value were   changed to the Mean, would make the sum of all of these values the same as      their original sum.": PRINT 
  36. 340  PRINT "-The Median (central value) of a set of values is a value which half of the": PRINT " values in the set are greater than, and which half of the values in the": PRINT " set are smaller than.": PRINT 
  37. 350  PRINT "-The Mode of a set of values is the value which occurs more frequently than any  of the other values. There may be no Mode for a set of values, but there is     always a Mean and a Median.": GOSUB 1190: IF H1 = 8  THEN 550
  38. 360  REM <CTRL-0x0d><CTRL-0x0f>1-VARIABLE.VALUES<CTRL-0x0e>
  39. 370 B$ = "values will you enter":D$ = "values": GOSUB 1250:V = 0: FOR I = 1 TO M:V = V +Z(I):P(I) = Z(I): NEXT :B$ =  STR$(V/M):T = M: GOSUB 1390: FOR I = 1 TO M:V(I) = P(I): NEXT :P1$ =  STR$(V((M +1)/2)): IF M/2 =  INT(M/2)  THEN P1$ =  STR$((V(M/2) +V(M/2 +1))/2)
  40. 380 D = 0:V(0) = V(1) +1: FOR I = 1 TO M -1: IF V(I) = V(I +1)  AND V(I) < >V(I -1)  THEN D = D +1:W(D) = V(I):A%(D) = 1
  41. 390  IF V(I) = V(I +1)  THEN A%(D) = A%(D) +1
  42. 400  NEXT : IF D <2  THEN 430
  43. 410  FOR I = 1 TO D -1: FOR J = I +1 TO D: IF A%(I) >A%(J)  THEN A = A%(I):A%(I) = A%(J):A%(J) = A:A = W(I):W(I) = W(J):W(J) = A
  44. 420  NEXT : NEXT 
  45. 430 P2$ =  STR$(W(D)): IF D = 0  OR (D >1  AND A%(D) = A%(D -1 +(D = 0)))  THEN P2$ = ""
  46. 440  GOSUB 1170: PRINT "Your "M" original values";: POKE 1403,31: PRINT "Sorted": GOSUB 1210: POKE 34,2: FOR I = 1 TO M: POKE 1403,3 -(I >9) -(I >99) -(I >999): PRINT "Value #"I": "Z(I);: POKE 1403,31: PRINT V(I): IF  PEEK(37) >21  AND I <M  THEN  GOSUB 1190
  47. 450  NEXT : IF PR = 0  THEN  GOSUB 1210
  48. 460  TEXT : GOSUB 1190: GOSUB 1210: POKE 34,1: PRINT "The Mean (average) of the "M" values is "B$".<CTRL-0x0d><CTRL-0x0d>The Median (central value) of the "M" values is "P1$".": PRINT : IF P2$ < >""  THEN  PRINT "The Mode is "P2$".";:H = 16 + LEN(P2$): GOTO 480
  49. 470  PRINT "There is no single Mode because no one value in the set occurs more frequently": PRINT "than any of the others.":H = 26
  50. 480  IF D = 0  THEN 510
  51. 490  FOR I = D TO 1  STEP  -1: POKE 1403,H -1: PRINT W(I)" occurs "A%(I)" times.": IF  PEEK(37) >21  AND I <D  THEN  GOSUB 1190
  52. 500  NEXT : POKE 1403,H -1: PRINT "every other value occurs only once."
  53. 510  IF PR = 0  THEN  GOSUB 1210
  54. 520  PRINT : GOSUB 1190:A = 0:H = 0: FOR I = 1 TO M:A = A +Z(I):H = H +Z(I) *Z(I): NEXT : PRINT "The sum of the "M" values is "A".": PRINT : PRINT "The sum of the squares of the "M" values is "H".":E =  SQR(H/M -A *A/(M *M))
  55. 530 E =  SQR(H/M -A *A/(M *M)): PRINT : PRINT "The 'N weighted' population Standard Deviation for the "M" values is "E".": PRINT : PRINT "The 'N-1 weighted' sample Standard Deviation for the "M" values is " SQR(M/(M -1)) *E".": GOSUB 1210: GOSUB 1190: GOTO 280
  56. 540  REM <CTRL-0x0d><CTRL-0x0f>2-VARIABLE.VALUES<CTRL-0x0e>
  57. 550 B$ = "pairs of coordinates will you enter": GOSUB 1250: FOR I = 1 TO M:P(I) = X(I): NEXT :T = M: GOSUB 1390: FOR I = 1 TO M:V(I) = P(I):P(I) = Y(I): NEXT : GOSUB 1390: FOR I = 1 TO M:W(I) = P(I): NEXT : GOSUB 1170
  58. 560  PRINT "      Original Coordinates" SPC( 15)"Abscissas sorted   Ordinates sorted": GOSUB 1210: POKE 34,2: FOR I = 1 TO M: POKE 1403,4 -(I >9) -(I >99) -(I >999): PRINT I". ("X(I)", "Y(I)")";: POKE 36,41: PRINT V(I);: POKE 36,60: PRINT W(I): IF  PEEK(37) >21  AND I <M  THEN  GOSUB 1190
  59. 570  NEXT : GOSUB 1210: TEXT : GOSUB 1190:A = 0:B = 0: FOR I = 1 TO M:A = A +X(I):B = B +Y(I): NEXT : PRINT "The Mean (average) of the "M" abscissas is "A/M".": PRINT : PRINT "The Mean (average) of the "M" ordinates is "B/M".": PRINT 
  60. 580 A = V((M +1)/2):B = W((M +1)/2): IF M/2 =  INT(M/2)  THEN A = (V(M/2) +V(M/2 +1))/2:B = (W(M/2) +W(M/2 +1))/2
  61. 590  PRINT "The Median (central value) of the "M" abscissas is "A".": PRINT : PRINT "The Median (central value) of the "M" ordinates is "B".": PRINT :D = 0:V(0) = V(1) +1: FOR I = 1 TO M -1: IF V(I) = V(I +1)  AND V(I) < >V(I -1)  THEN D = D +1:P(D) = V(I):A%(D) = 1
  62. 600  IF V(I) = V(I +1)  THEN A%(D) = A%(D) +1
  63. 610  NEXT : IF D <2  THEN 640
  64. 620  FOR I = 1 TO D -1: FOR J = I +1 TO D: IF A%(I) >A%(J)  THEN A = A%(I):A%(I) = A%(J):A%(J) = A:A = P(I):P(I) = P(J):P(J) = A
  65. 630  NEXT : NEXT 
  66. 640 A$ =  STR$(P(D)): IF D = 0  OR (D >1  AND A%(D) = A%(D -1 +(D = 0)))  THEN A$ = ""
  67. 650  IF A$ < >""  THEN  PRINT "The Mode of the abscissas is "A$".":H = 16 + LEN(A$): GOTO 670
  68. 660  PRINT "There is no single Mode for the abscissas because no one abscissa occurs more": PRINT "frequently than any of the others.":H = 26: IF  PEEK(37) >20  THEN  GOSUB 1190
  69. 670  IF D = 0  THEN 700
  70. 680  FOR I = D TO 1  STEP  -1: POKE 1403,H -1: PRINT P(I)" occurs "A%(I)" times.": IF  PEEK(37) >21  AND I <D  THEN  GOSUB 1190
  71. 690  NEXT : POKE 1403,H -1: PRINT "every other value occurs only once."
  72. 700  GOSUB 1220:D = 0:W(0) = W(1) +1: FOR I = 1 TO M -1: IF W(I) = W(I +1)  AND W(I) < >W(I -1)  THEN D = D +1:P(D) = W(I):A%(D) = 1
  73. 710  IF W(I) = W(I +1)  THEN A%(D) = A%(D) +1
  74. 720  NEXT : IF D <2  THEN 750
  75. 730  FOR I = 1 TO D -1: FOR J = I +1 TO D: IF A%(I) >A%(J)  THEN A = A%(I):A%(I) = A%(J):A%(J) = A:A = P(I):P(I) = P(J):P(J) = A
  76. 740  NEXT : NEXT 
  77. 750 A$ =  STR$(P(D)): IF D = 0  OR (D >1  AND A%(D) = A%(D -1 +(D = 0)))  THEN A$ = ""
  78. 760  IF A$ < >""  THEN  PRINT "The Mode of the ordinates is "A$".":H = 16 + LEN(A$): GOTO 780
  79. 770  PRINT "There is no single Mode for the ordinates because no one ordinate occurs more": PRINT "frequently than any of the others.":H = 26: IF  PEEK(37) >20  THEN  GOSUB 1190
  80. 780  IF D = 0  THEN 810
  81. 790  FOR I = D TO 1  STEP  -1: POKE 1403,H -1: PRINT P(I)" occurs "A%(I)" times.": IF  PEEK(37) >21  AND I <D  THEN  GOSUB 1190
  82. 800  NEXT : POKE 1403,H -1: PRINT "every other value occurs only once."
  83. 810  GOSUB 1220:E = 0:B = 0:C = 0:D = 0:V = 0: FOR I = 1 TO M:E = E +X(I):B = B +Y(I):C = C +X(I) *X(I):D = D +Y(I) *Y(I):V = V +X(I) *Y(I): NEXT : PRINT "The sum of the "M" abscissas is "E".": GOSUB 1220: PRINT "The sum of the "M" ordinates is "B".": GOSUB 1220
  84. 820  PRINT "The sum of the squares of the "M" abscissas is "C".": GOSUB 1220: PRINT "The sum of the squares of the "M" ordinates is "D".": GOSUB 1220: PRINT "The sum of the products of each pair of coordinates is "V".": GOSUB 1220
  85. 830 H =  SQR(C/M -E *E/(M *M)): PRINT "The 'N weighted' population Standard Deviation for the "M" abscissas is": PRINT H".": GOSUB 1220: PRINT "The 'N-1 weighted' sample Standard Deviation for the "M" abscissas is": PRINT  SQR(M/(M -1)) *H".": GOSUB 1220
  86. 840 J =  SQR(D/M -B *B/(M *M)): PRINT "The 'N weighted' population Standard Deviation for the "M" ordinates is": PRINT J".": GOSUB 1220: PRINT "The 'N-1 weighted' sample Standard Deviation for the "M" ordinates is": PRINT  SQR(M/(M -1)) *J".": GOSUB 1220
  87. 850  PRINT "The Correlation Coefficient of the "M" coordinate pairs is "(V/M -E *B/(M *M))/(H *J)".": IF PR = 0  THEN  GOSUB 1210: GOSUB 1190
  88. 860 A = 0:B = 0:C = 0:D = 0:E = 0: FOR I = 1 TO M:A = A +X(I):B = B +Y(I):C = C +X(I) *X(I):D = D +Y(I) *Y(I):E = E +X(I) *Y(I): NEXT :K = (E/M -(A/M) *(B/M))/(C/M -(A/M) *(A/M)):L = B/M -K *(A/M):A$ =  STR$( ABS(L)):D$ = "x + " +A$: IF L =  <0  THEN D$ = "x - " +A$: IF L = 0  THEN D$ = "x"
  89. 870  IF M = 2  AND X(1) < >X(2)  THEN K = (Y(2) -Y(1))/(X(2) -X(1)):L = (Y(1) *X(2) -X(1) *Y(2))/(X(2) -X(1)):A$ =  STR$( ABS(L)):D$ = "x + " +A$: IF L =  <0  THEN D$ = "x - " +A$: IF L = 0  THEN D$ = "x"
  90. 880 D$ =  STR$(K) +D$
  91. 890  GOSUB 1210: PRINT "The equation of the line which best approximates the "M" coordinate points is": PRINT : POKE 1403,38 - LEN(D$)/2: PRINT "y = "D$: PRINT : GOSUB 1210
  92. 900  PRINT "In the above line, "K" is the slope, and": PRINT L" is the intercept on the vertical axis.": PRINT 
  93. 910 V = 0: FOR I = 1 TO M:A = K *X(I) +L -Y(I):V = V +A *A: NEXT :A = M *(D/M -(B/M) *(B/M)):H = 1 -V/A:E = H *10000:A = E - INT(E +.005):I = ( INT(E) +(A > = .5))/100: IF M >2  THEN  PRINT "The Mean Square Error (MSE) is "V/(M -2)".": PRINT 
  94. 920  PRINT "The accuracy of the above regression line is "H", or "I"%.": GOSUB 1210: POKE 34,13: IF PR = 1  THEN  GOSUB 1160: GOTO 890
  95. 930  VTAB 19: POKE 1403,19: INVERSE : PRINT "In the linear equation above...": NORMAL :M$(1) = "Enter a value of x...get back a value of y":M$(2) = "Enter a value of y...get back a value of x":M$(3) = "Return to the Main Menu"
  96. 940 N = 3:V = H4:E = 20:H = 20: GOSUB 1090:H4 = V: ON V -E GOTO 950,960,280
  97. 950  VTAB 14: POKE 1403,19: PRINT "Enter a value of x: "X$;:R$ = X$: POKE 1403,39: GOSUB 70:A =  VAL(L$):X$ =  STR$(A): VTAB 16: POKE 1403,19: PRINT "When x = "A", then y = "K *A +L: GOTO 930
  98. 960  VTAB 14: POKE 1403,19: PRINT "Enter a value of y: "Y$;:R$ = Y$: POKE 1403,39: GOSUB 70:A =  VAL(L$):Y$ =  STR$(A): VTAB 16: POKE 1403,19: PRINT "When y = "A", then x = "(A -L)/K: GOTO 930
  99. 970  REM <CTRL-0x0d><CTRL-0x0f>SMOOTH.ORDINATES<CTRL-0x0e>
  100. 980  VTAB 6: GOSUB 1210: PRINT "To 'smooth' ordinates, you must enter them in ascending order of the abscissa,  i.e., from left to right, beginning with the smallest value of x.": GOSUB 1210: GOSUB 1190
  101. 990  VTAB 7: POKE 1403,41 - LEN(Q$)/2: INVERSE : PRINT Q$: NORMAL :M$(1) = "by finding the Median of each group of 3 consecutive ordinates":M$(2) = "by finding the Mean (average)" + MID$ (M$(1),22):N = 2:V = H2:E = 8:H = 6: GOSUB 1080:H2 = V:G$ = "Median": IF V = 10  THEN G$ = "Mean"
  102. 1000 B$ = "ordinates will you enter":D$ = "ordinates": GOSUB 1250: FOR I = 2 TO M -1:A = Z(I -1):B = Z(I):C = Z(I +1): IF H2 = 10  THEN W(I) = (A +B +C)/3: GOTO 1050
  103. 1010  IF A >B  THEN D = A:A = B:B = D
  104. 1020  IF B >C  THEN D = B:B = C:C = D
  105. 1030  IF A >B  THEN D = A:A = B:B = D
  106. 1040 W(I) = B
  107. 1050  NEXT :W(1) = Z(1):W(M) = Z(M): GOSUB 1170: PRINT "'Smooth' ordinates by finding the "G$" of each group of 3 consecutive values.": GOSUB 1210: POKE 34,2
  108. 1060  FOR I = 1 TO M: POKE 1403,3 -(I >9) -(I >99) -(I >999): PRINT I". Original ordinate: "Z(I);: POKE 36,44: PRINT "New ordinate: "W(I): IF  PEEK(37) >21  AND I <M  THEN  GOSUB 1190
  109. 1070  NEXT : GOSUB 1210: GOSUB 1190: GOTO 280
  110. 1080  VTAB 1: POKE 1403,0: PRINT "STAT";: POKE 1403,66: PRINT "Esc=Main Menu": GOSUB 1210: POKE 1403,40 - LEN(Q$)/2: PRINT Q$: GOSUB 1210: PRINT "Highlight your option with arrow keys or a number from 1 to "N"...then hit Return"
  111. 1090  FOR A = 1 TO N: VTAB E +A: POKE 36,H -3: PRINT A"."M$(A);: NEXT 
  112. 1100  VTAB V: POKE 36,H -1: INVERSE : PRINT M$(V -E);: NORMAL : GOSUB 30: IF A >48  AND A <49 +N  THEN  VTAB V: POKE 36,H -1: PRINT M$(V -E);:V = A +E -48: GOTO 1100
  113. 1110  IF A = 13  THEN  HOME : RETURN 
  114. 1120  VTAB V: POKE 36,H -1: PRINT M$(V -E);: IF A = 21  OR A = 10  THEN V = V +1: IF V = E +1 +N  THEN V = E +1
  115. 1130  IF A = 8  OR A = 11  THEN V = V -1: IF V = E  THEN V = E +N
  116. 1140  GOTO 1100
  117. 1150  PRINT : PRINT "<CTRL-0x04>-WORKHORSE"
  118. 1160  PRINT "<CTRL-0x04>PR#0": PRINT "<CTRL-0x04>PR#3":PR = 0: TEXT : HOME : PRINT : VTAB 1: RETURN 
  119. 1170  GOSUB 1160:M$(1) = "Print results to the screen":M$(2) =  LEFT$(M$(1),21) +"printer":N = 2:V = 7:E = 6:H = 27: GOSUB 1080: IF V = 8  THEN  VTAB 7: POKE 1403,30: PRINT "Set up the printer.": GOSUB 1190: PRINT : PRINT "<CTRL-0x04>PR#1":PR = 1: PRINT  CHR$(9)"81N"
  120. 1180  RETURN 
  121. 1190  IF PR = 0  THEN  VTAB 24: POKE 1403,22: INVERSE : PRINT "RETURN to continue. ESC = Main Menu.";: NORMAL : GOSUB 30: HOME 
  122. 1200  RETURN 
  123. 1210  POKE 1403,0: FOR A = 1 TO 78: PRINT "=";: NEXT : PRINT "=": RETURN 
  124. 1220  PRINT : IF  PEEK(37) >21  THEN  GOSUB 1190
  125. 1230  RETURN 
  126. 1240  REM <CTRL-0x0d><CTRL-0x0f>ENTER.VALUES<CTRL-0x0e>
  127. 1250  VTAB 8: GOSUB 1210: PRINT "*To a maximum of "G: VTAB 4: GOSUB 1210: PRINT : PRINT "How many* "B$"? "M;:R$ =  STR$(M): POKE 36,12 + LEN(B$): GOSUB 70:M =  VAL(L$): HOME : IF M < > INT(M)  OR M <2  OR M >G  THEN 1250
  128. 1260  IF H1 < >8  THEN  PRINT "   Enter your "M" "D$".": GOSUB 1210: GOSUB 273: POKE 34,2: FOR I = 1 TO M: POKE 1403,3 -(I >9) -(I >99) -(I >999): PRINT  LEFT$(D$, LEN(D$) -1)" #"I". "Z(I);
  129. 1265  IF H1 < >8  THEN R$ =  STR$(Z(I)): POKE 1403,7 + LEN(D$): GOSUB 70:Z(I) =  VAL(L$): NEXT : GOSUB 1330: ON V -E GOTO 270,1260
  130. 1270  VTAB 18: POKE 1403,15: PRINT "*For example, start with x=10 and increment by 10.":M$(1) = "Pre-enter abscissas to specifications*":M$(2) = "Enter abscissas one-by-one":N = 2:V = H5:E = 6:H = 22: GOSUB 1080:H5 = V: IF V = 8  THEN 1290
  131. 1280  VTAB 5: GOSUB 1210: PRINT "The first value of x will be: "E$;:R$ = E$: POKE 1403,30: GOSUB 70:X(1) =  VAL(L$):E$ =  STR$(X(1)): VTAB 8
  132. 1285  PRINT "The increment will be: "F$;:R$ = F$: POKE 1403,23: GOSUB 70:A =  VAL(L$):F$ =  STR$(A): FOR I = 2 TO M:X(I) = X(1) +(I -1) *A: NEXT : HOME 
  133. 1290  PRINT "      Enter the "M" pairs of coordinates.": GOSUB 1210: GOSUB 273: POKE 34,2: FOR I = 1 TO M: POKE 1403,3 -(I >9) -(I >99) -(I >999)
  134. 1295  PRINT I". Abscissa: "X(I);:R$ =  STR$(X(I)): POKE 1403,16: GOSUB 70:X(I) =  VAL(L$): VTAB  PEEK(37): POKE 1403,32: PRINT "Ordinate: "Y(I)
  135. 1300  VTAB  PEEK(37): POKE 36,42:R$ =  STR$(Y(I)): GOSUB 70:Y(I) =  VAL(L$): NEXT : GOSUB 1330: IF V = 8  THEN 1290
  136. 1310  VTAB 7: INVERSE : PRINT "Arrange the coordinate points* you just entered by their abscissas?": NORMAL 
  137. 1320  VTAB 15: PRINT "*For example, (4,2) (7,5) (2,4) would be put in this order: (2,4) (4,2) (7,5)":M$(1) = "No":M$(2) = "Yes":N = 2:V = H3:E = 6:H = 72: GOSUB 1080:H3 = V: ON V -E GOTO 270,1350
  138. 1330  GOSUB 1160:M$(1) = "Accept the values entered":M$(2) = "Review or correct these values":N = 2:V = 7:E = 6:H = 26: GOSUB 1080: RETURN 
  139. 1340  REM <CTRL-0x0d><CTRL-0x0f>ARRANGE.COORD.PAIRS.BY.ABSCISSA<CTRL-0x0e>
  140. 1350  IF M = 1  THEN  RETURN 
  141. 1360  FOR I = 1 TO M -1: FOR J = I +1 TO M: IF X(I) >X(J)  THEN A = X(I):X(I) = X(J):X(J) = A:A = Y(I):Y(I) = Y(J):Y(J) = A
  142. 1370  NEXT : NEXT : RETURN 
  143. 1380  REM <CTRL-0x0d><CTRL-0x0f>SORT:T,P(I)->P(I)<CTRL-0x0e>
  144. 1390  IF T = 1  THEN  RETURN 
  145. 1400  FOR J = 1 TO T -1: IF P(J) >P(J +1)  THEN 1420
  146. 1410  NEXT : RETURN 
  147. 1420 E = 1:A = 1:I = 1:J = T
  148. 1430  IF I > = J  THEN 1570
  149. 1440 K = I:N =  INT((J +I)/2):H = P(N): IF P(I) =  <H  THEN 1460
  150. 1450 P(N) = P(I):P(I) = H:H = P(N)
  151. 1460 V = J: IF P(J) > = H  THEN 1500
  152. 1470 P(N) = P(J):P(J) = H:H = P(N): IF P(I) =  <H  THEN 1500
  153. 1480 P(N) = P(I):P(I) = H:H = P(N): GOTO 1500
  154. 1490 P(V) = P(K):P(K) = P1
  155. 1500 V = V -1: IF P(V) >H  THEN 1500
  156. 1510 P1 = P(V)
  157. 1520 K = K +1: IF P(K) <H  THEN 1520
  158. 1530  IF K =  <V  THEN 1490
  159. 1540  IF V -I =  <J -K  THEN 1560
  160. 1550 Q(E) = I:R(E) = V:I = K:E = E +1: GOTO 1590
  161. 1560 Q(E) = K:R(E) = J:J = V:E = E +1: GOTO 1590
  162. 1570 E = E -1: IF E = 0  THEN  RETURN 
  163. 1580 I = Q(E):J = R(E)
  164. 1590  IF A =  <J -I  THEN 1440
  165. 1600  IF A = I  THEN 1430
  166. 1610 I = I -1
  167. 1620 I = I +1: IF I = J  THEN 1570
  168. 1630 H = P(I +1): IF P(I) =  <H  THEN 1620
  169. 1640 K = I
  170. 1650 P(K +1) = P(K):K = K -1: IF H <P(K)  THEN 1650
  171. 1660 P(K +1) = H: GOTO 1620
  172. 1670  REM <CTRL-0x0d><CTRL-0x0f>LIST.COORDINATE.PAIRS<CTRL-0x0e>
  173. 1680  GOSUB 1210: POKE 34,2:V =  INT((M +1)/2): IF PR = 0  AND V >20  THEN 1710
  174. 1690  FOR I = 1 TO V: POKE 1403,3 -(I >9) -(I >99) -(I >999): PRINT I". ("X(I)", "Y(I)")";:A = I +V: IF A =  <M  THEN  POKE 36,43 -(A >9) -(A >99) -(A >999): PRINT A". ("X(A)", "Y(A)")"
  175. 1700  NEXT : GOTO 1730
  176. 1710  FOR I = 1 TO M: POKE 1403,3 -(I >9) -(I >99) -(I >999): PRINT I". ("X(I)", "Y(I)")": IF  PEEK(37) >21  AND I <M  THEN  GOSUB 1190
  177. 1720  NEXT 
  178. 1730  TEXT : GOSUB 1190: RETURN 
  179. 1800  GOSUB 1160: VTAB 7: HTAB 34: PRINT "Error Code " PEEK(222): PRINT : PRINT "The size of some number may be beyond the range of the computer. The calculationcould not be continued.": GOSUB 1190: GOTO 280