100 PRINT"PROGRAM FOR PLOTTING EQUALLY"
101 PRINT"SPACED DATA VALUES"
102 PRINT
103 PRINT"THE USER INPUTS THE STARTING "
104 PRINT"AND ENDING COORDINATES, ALONG "
105 PRINT"WITH THE NUMBER OF EVALUATION POINT."
106 PRINT"THE PROGRAM WILL THEN PLOT "
107 PRINT"THE DATA"
108 PRINT
109 PRINT
110 '   INITIALIZATION
111 PRINT "INPUT TERMINAL WIDTH: ";
112 INPUT L
113 PRINT "BEGINNING CORDINATE: ";
114 INPUT X1
115 PRINT "ENDING COORDINATE: ";
116 INPUT X2
117 PRINT "NUMBER OF DATA POINTS: ";
118 INPUT N
119 DIM D(N+1)
120 '   DATA INPUT
121 PRINT"INPUT DATA"
122 FOR I=1 TO N
123 PRINT I;
124 INPUT D(I)
125 NEXT I
126 '   GO TO PLOTTING SUBROUTINE PROPER
127 GOSUB 40000
128 END
129 PRINT"PROGRAM FOR PLOTTING EQUALLY"
130 PRINT"SPACED FUNCTION VALUES"
131 PRINT
132 PRINT"THE USER INPUTS THE STARTING "
133 PRINT"AND ENDING COORDINATES, ALONG "
134 PRINT"WITH THE NUMBER OF EVALUATION POINTS."
135 PRINT"THE PROGRAM WILL THEN PLOT "
136 PRINT"THE FUNCTION OVER THAT RANGE."
137 PRINT
138 PRINT
139 '   INITIALIZATION
140 PRINT "INPUT TERMINAL WIDTH: ";
141 INPUT L
142 PRINT "BEGINNING CORDINATE: ";
143 INPUT X1
144 PRINT "ENDING COORDINATE: ";
145 INPUT X2
146 PRINT "NUMBER OF DATA POINTS: ";
147 INPUT N
148 DIM D(N+1)
149 '   FUNCTION EVALUATION
150 FOR I=1 TO N
151 '   *****INPUT FUNCTION BELOW*****
152 X=X1+(I-1)*(X2-X1)/(N-1)
153 D(I)=.1*X*X*X-3*X*X+2*X-3
154 NEXT I
155 '   GO TO PLOTTING SUBROUTINE PROPER
156 GOSUB 40000
157 END
158 PRINT"PROGRAM FOR PLOTTING COORDINATE"
159 PRINT"SETS OF DATA"
160 PRINT
161 PRINT"THE PROGRAM ASSUMES THAT THE DATA IS"
162 PRINT"SEQUENTIALLY ORDERED, FIRST BY ABSCISSA"
163 PRINT"VALUE, SECOND BY ORDINATE"
164 PRINT"THE PROGRAM WILL THEN PLOT "
165 PRINT"THE DATA."
166 PRINT
167 PRINT
168 '   INITIALIZATION
169 PRINT "INPUT TERMINAL WIDTH: ";
170 INPUT L
171 PRINT "NUMBER OF DATA POINTS: ";
172 INPUT N
173 DIM D(N+1),C(N+1),E(N+1)
174 '   DATA INPUT
175 PRINT "INPUT DATA IN ABSCISSA, ORDINATE PAIRS: "
176 FOR I=1 TO N
177 PRINT I;
178 INPUT C(I),D(I)
179 '   C(I)=ABSCISSA, D(I)=ORDINATE
180 NEXT I
181 '   GO TO PLOTTING SUBROUTINE PROPER
182 GOSUB 40100
183 END
184 '   PROGRAM TO DEMONSTRATE COMPLEX NUMBER
185 '   ADDITION, SUBRACTION, MULTIPLICATION
186 '   AND DIVISION
187 PRINT"ENTER COMPLEX NUMBERS IN (X,Y) PAIRS:"
188 PRINT
189 PRINT"Z1= ";
190 INPUT X(1),Y(1)
191 PRINT
192 PRINT"Z2= ";
193 INPUT X(2),Y(2)
194 '   COMPLEX NUMBER ADDITION
195 GOSUB 40300
196 PRINT
197 PRINT
198 PRINT "Z1+Z2= ";X(3);
199 IF Y(3)>=0 THEN PRINT"+";
200 PRINT Y(3);" I"
201 PRINT
202 PRINT
203 '   COMPLEX NUMBER SUBTRACTION
204 GOSUB 40350
205 PRINT "Z1-Z2= ";X(3);
206 IF Y(3)>=0 THEN PRINT"+";
207 PRINT Y(3);" I"
208 PRINT
209 '   COMPLEX NUMBER MULTIPLICATION
210 GOSUB 40600
211 PRINT"Z1*Z2= ";X;
212 IF Y>=0 THEN PRINT" +";
213 PRINT Y;" I"
214 PRINT
215 '   COMPLEX NUMBER DIVISION
216 GOSUB 40800
217 PRINT"Z1/Z2= ";X;
218 IF Y>=0 THEN PRINT" +";
219 PRINT Y;" I"
220 END
221 '   PROGRAM TO DEMONSTRATE
222 '   RECTANGULAR TO POLAR CONVERSION
223 PRINT"INPUT RECTANGULAR COORDINATES TO BE CONVERTED";
224 INPUT X,Y
225 '   CONVERSIONS
226 GOSUB 40400
227 PRINT
228 PRINT"POLAR COORDINATES ARE : RADIUS= ";U
229 PRINT"                        ANGLE=  "V;" RADIANS"
230 END
231 '   PROGRAM TO DEMONSTRATE
232 '   POLAR TO RECTANGULAR CONVERSION
233 PRINT"INPUT POLAR COORDINATES TO BE CONVERTED";
234 INPUT U,V
235 '   CONVERSION
236 GOSUB 40450
237 PRINT
238 PRINT"RECTANGULAR COORDINATES ARE (X,Y)= ";X;" .";Y
239 END
240 '   PROGRAM TO DEMONSTRATE
241 '   COMPLEX NUMBER TO A POWER
242 PRINT
243 PRINT"INPUT THE POWER DESIRED, FOLLOWED BY THE"
244 PRINT"COMPLEX NUMBER"
245 PRINT"N ";
246 INPUT N
247 PRINT"X ";
248 INPUT X
249 PRINT"Y ";
250 INPUT Y
251 '   POWER CALCULATION
252 GOSUB 41200
253 PRINT
254 PRINT"RESULT= ";X;
255 IF Y1>=0 THEN PRINT" +";
256 PRINT Y;" I"
257 END
258 '   PROGRAM TO DEMONSTRATE
259 '   FINDING THE ROOTS OF A COMPLEX NUMBER
260 PRINT
261 PRINT"INPUT THE INTEGER ROOT DESIRED FOLLOWED"
262 PRINT"BY THE COMPLEX NUMBER"
263 PRINT"N ";
264 INPUT N
265 PRINT"X ";
266 X9 AND Y9 ARE STORED VALUES
267 INPUT X9
268 PRINT"Y ";
269 INPUT Y9
270 '   FIND N ROOTS
271 PRINT
272 PRINT
273 PRINT"ORDER    X+ YI"
274 PRINT"-----  ----------------"
275 PRINT
276 FOR M=1 TO N
277 '   CONVERT TO X,Y
278 X=X9
279 Y=Y9
280 GOSUB 41300
281 PRINT"  ";M;
282 PRINT"  ";INT(1000*X+.5)/1000;"  ";
283 IF Y>0 THEN PRINT "+";
284 PRINT INT(1000*Y+5)/1000;" I"
285 NEXT M
286 END
287 '   PROGRAM TO DEMONSTRATE SPHERICAL TO
288 '   CARTESIAN COORDINATE CONVERSION
289 PRINT"INPUT RADIUS, U: ";
290 INPUT U
291 PRINT"INPUT ANGLE IN (X,Y) PLANE, V: ";
292 INPUT V
293 PRINT"INPUT ANGLE OFF Z AXIS, W: ";
294 INPUT W
295 GOSUB 41400
296 PRINT
297 PRINT"(X,Y,Z)= (";X;" , ";Y;" , ";Z;")"
298 END
299 '   PROGRAM TO DEMONSTRATE CARTESIAN TO
300 '   SPHERICAL COORDINATE CONVERSION
301 PRINT"INPUT X, Y AND Z: ";
302 INPUT X,Y,Z
303 GOSUB 41450
304 PRINT
305 PRINT"RADIUS= ";U
306 PRINT"ANGLE IN (X,Y) PLANE= ";V;" RADIANS"
307 PRINT"ANGLE OFF Z AXIS= ";W;" RADIANS"
308 END
309 '   PROGRAM TO DEMONSTRATE VECTOR SUDROUTINES
310 N=3
311 DIM A(N),B(N),C(N)
312 PRINT "INPUT VECTOR A (X,Y,Z): ";
313 INPUT A(1),A(2),A(3)
314 PRINT "INPUT VECTOR B (X,Y,Z): ";
315 INPUT B(1),B(2),B(3)
316 '   SUM
317 GOSUB 41500
318 PRINT
319 PRINT "A+B= (";C(1);", ";C(2);", ";C(3);")"
320 '   DIFFERENCE
321 GOSUB 41550
322 PRINT
323 PRINT"A-B= (";C(1);", ";C(2);", ";C(3);")"
324 '   CROSS PRODUCT
325 GOSUB 41650
326 PRINT
327 PRINT"AXB= (";C(1);", ";C(2);", ";C(3);")"
328 '   DOT PRODUCT
329 GOSUB 41600
330 PRINT
331 PRINT "A,B= ";C
332 '   VECTOR ANGLE
333 GOSUB 41750
334 PRINT
335 PRINT "ANGLE BETWEEN VECTORS A AND B= ";A;" RADIANS"
336 '   VECTOR LENGTH
337 GOSUB 41700
338 PRINT
339 PRINT "LENGTH OF VECTOR B= ";L
340 PRINT
341 PRINT
342 '   PROGRAM TO DEMONSTRATE MATRIX OPERATIONS
343 PRINT"INPUT THE ROW AND COLUMN DIMENSIONS OF A(I,J) AND B(I,J):"
344 PRINT"ROW SIZE= ";
345 INPUT M
346 PRINT"COLUMN SIZE= "
347 INPUT N
348 '   FIND MAXIMUM MATRIX DIMENSION NEEDED
349 IF M>N THEN K=M+1
350 IF N>M THEN K=N+1
351 DIM A(K,K), B(K,K), C(K,K)
352 '   INPUT MATRIX A
353 PRINT
354 PRINT"INPUT MATRIX A ROW BY ROW"
355 PRINT
356 FOR I=1 TO M
357 PRINT"INPUT THE ";N;" ELEMENTS OF ROW ";I;" :"
358 FOR J=1 TO N
359 INPUT A(I,J)
360 NEXT J
361 PRINT
362 NEXT I
363 PRINT
364 '   PRINT MATRIX A
365 '   MOVE A TO C
366 N1=M
367 N2=N
368 N3=0
369 GOSUB 42150
370 PRINT"MATRIX A="
371 PRINT
372 '   PRINTING SUBROUTINE
373 GOSUB 1020
374 PRINT
375 '   INPUT MATRIX B
376 PRINT
377 PRINT"INPUT MATRIX B ROW BY ROW"
378 PRINT
379 FOR I=1 TO M
380 PRINT"INPUT THE ";N;" ELEMENTS OF ROW ";I;" :"
381 FOR J=1 TO N
382 INPUT B(I,J)
383 NEXT J
384 PRINT
385 NEXT I
386 PRINT
387 '   MOVE B TO C
388 GOSUB 42125
389 PRINT
390 PRINT"MATRIX B="
391 PRINT
392 '   PRINTING SUBROUTINE
393 GOSUB 1020
394 PRINT
395 '   MATRIX ADDITION
396 GOSUB 41800
397 PRINT"A+B="
398 '   PRINTING SUBROUTINE
399 GOSUB 1020
400 '   MATRIX SUBTRACTION
401 GOSUB 41850
402 PRINT"A-B="
403 '   PRINTING SUBROUTINE
404 GOSUB 1020
405 '   MATRIX TRANSPOSE (A)
406 '   FIRST, SAVE B IN C
407 GOSUB 42125
408 '   PUT TRANSPOSE OF A IN B
409 GOSUB 41950
410 '   MOVE TRANSPOSE OF A TO A
411 N1=N
412 N2=M
413 GOSUB 42075
414 '   RETURN C TO B
415 N1=M
416 N2=N
417 GOSUB 42100
418 PRINT
419 PRINT"A(TRANSPOSE)="
420 '   SWITCH ROW AND COLUMN SIZES FOR THE TRANSPOSE PRINT
421 N2=M
422 N1=N
423 M=N1
424 N=N2
425 '   MOVE A TO C FOR PRINTING
426 GOSUB 42150
427 PRINT
428 '   PRINTING SUBROUTINE
429 GOSUB 1020
430 '   DETERMINE PRODUCT OF A(TRANSPOSE) AND B
431 M1=M
432 N1=N
433 M2=N
434 N2=M
435 '   MATRIX MULTIPLICATION SUBROUTINE
436 GOSUB 41900
437 PRINT"A(TRANSPOSE) X B="
438 PRINT
439 '   PRINTING SUBROUTINE
440 N=M
441 GOSUB 1020
442 PRINT
443 END
444 '   PROGRAM TO DEMONSTRATE SPECIAL MATRIX OPERATIONS
445 '   FIRST CREATE A DIAGONAL MATRIX
446 PRINT"WHAT SIZE MATRIX IS DESIRED";
447 INPUT N
448 PRINT
449 PRINT"THIS MATRIX WILL HAVE ONLY DIAGONAL ELEMENTS.":
450 PRINT" WHAT VALUE SHOULD THEY BE";
451 INPUT B
452 DIM A(N+1,N+1),B(N+1,N+1),C(N+1,N+1)
453 '   GO TO DIAGONAL MATRIX CREATION SUBROUTINE
454 GOSUB 42000
455 '   SAVE MATRIX IN BOTH A AND C
456 N1=N
457 N2=N
458 N3=0
459 GOSUB 42075
460 GOSUB 42125
461 '   PRINT RESULT
462 M=N
463 GOSUB 1020
464 '   SWITCH TWO ROWS
465 PRINT
466 PRINT"INPUT THE NUMBERS OF THE ROWS TO BE SWITCHED":
467 INPUT N1,N2
468 '   GO TO SWITCHING SUBROUTINE
469 GOSUB 42250
470 '   MOVE RESULT TO C AND PRINT
471 N1=N
472 N2=N
473 GOSUB 42150
474 PRINT
475 GOSUB 1020
476 PRINT"INPUT SCALE FACTOR TO BE MULTIPLIED BY: ";
477 INPUT B
478 GOSUB 42200
479 '   PRINT RESULT
480 GOSUB 42150
481 GOSUB 1020
482 PRINT
483 PRINT"INPUT WHAT FRACTION OF ROW N1 IS TO BE ADDED TO ROW N2"
484 PRINT"FRACTION: ";
485 INPUT B
486 PRINT"N1: ";
487 INPUT N1
488 PRINT"N2: ";
489 INPUT N2
490 '   GO TO OPERATION
491 GOSUB 42275
492 '   PRINT RESULT
493 PRINT
494 N2=N
495 N1=N
496 GOSUB 42150
497 GOSUB 1020
498 PRINT"CLEAR MATRIX"
499 N1=N
500 N2=N
501 GOSUB 42225
502 '   PRINT RESULT
503 PRINT
504 GOSUB 42150
505 GOSUB 1020
506 END
507 '   PROGRAM TO DEMONSTRATE DETERMINANT
508 PRINT"INPUT MATRIX SIZE: ";
509 INPUT N
510 DIM A(N+1,N+1),B(N+1,N+1),C(N+1,N+1)
511 PRINT
512 '   INPUT MATRIX
513 FOR I=1 TO N
514 PRINT"INPUT ROW ";I
515 FOR J=1 TO N
516 INPUT A(I,J)
517 NEXT J
518 PRINT
519 NEXT I
520 PRINT
521 PRINT "MATRIX A="
522 '   MOVE A TO C FOR PRINTING
523 N1=N
524 N2=N
525 N3=0
526 GOSUB 42150
527 '   PRINT
528 M=N
529 GOSUB
530 PRINT
531 '   EVALUATE DETERMINANT
532 GOSUB 42350
533 PRINT"DETERMINANT= ";D
534 END
535 '   PROGRAM TO DEMONSTRATE MATRIX INVERSION
536 PRINT"INPUT DIMENSION OF MATRIX TO BE INVERTED: ";
537 INPUT N
538 DIM A(N+1,N+1),B(N+1,2*N+2),C(N+1,N+1)
539 PRINT
540 FOR I=1 TO N
541 PRINT"INPUT ROW ";I; :"
542 FOR J=1 TO N
543 INPUT A(I,J)
544 NEXT J
545 PRINT
546 NEXT I
547 PRINT
548 PRINT"MATRIX A="
549 N1=N
550 N2=N
551 N3=0
552 '   MOVE A TO C
553 GOSUB 42150
554 M=N
555 GOSUB 1020
556 '   GOTO INVERSION SUBROUTINE
557 GOSUB 42400
558 '   MOVE B TO C TO PRINT
559 PRINT"INVERSE OF A="
560 PRINT
561 GOSUB 42125
562 M=N
563 GOSUB 1020
564 '   CHECK RESULTS
565 '   MULTIPLY A TIMES B
566 M1=N
567 M2=N
568 GOSUB 41900
569 M=N
570 '   PRINT RESULTS
571 PRINT
572 PRINT"MATRIX A TIMES INVERSE MATRIX A="
573 GOSUB 1020
574 END
575 '   PROGRAM TO DEMONSTRATE USE OF INVERSE TO SOLVE
576 '   SIMULTANEOUS EQUATIONS
577 PRINT"INPUT SIZE OF EQUATION (NUMBER OF UNKNOWNS): ";
578 INPUT N
579 DIM A(N+1,N+1),B(N+1,2*N+2),C(N+1,N+1)
580 PRINT
581 FOR I=1 TO N
582 PRINT"INPUT ROW ":I;" OF COEFFICIENT MATRIX"
583 FOR J=1 TO N
584 INPUT A(I,J)
585 NEXT J
586 PRINT
588 PRINT"INPUT CONSTANT WHICH ROW EQUATION EQUALS: ";
589 INPUT B(I,1)
590 PRINT
591 NEXT I
592 PRINT
593 PRINT"MATRIX A="
594 N1=N
595 N2=N
596 N3=0
597 '   MOVE A TO C
598 GOSUB 42150
599 '   PRINT A
600 M=N
601 GOSUB 1020
603 '   MOVE CONSTANT VECTOR TO C
604 GOSUB 42125
605 '   PRINT CONSTANT VECTOR
606 PRINT
607 PRINT"CONSTANT VECTOR ="
608 N=1
609 GOSUB 1020
610 N=M
611 '   OBTAIN INVERSE
612 GOSUB 42400
613 '   MOVE RESULT IN B TO A
614 GOSUB 42075
615 '   MOVE CONSTANT VECTOR IN C TO B
616 GOSUB 42100
617 '   MULTIPLY INVERSE TIMES CONSTANT VECTOR
618 M1=N
619 N1=N
620 M2=N
621 N2=1
622 GOSUB 41900
623 '   RESULT IS IN C, PRINT C
624 M=N
625 N=1
626 PRINT"SOLUTION VECTOR="
627 GOSUB 1020
628 END
629 '   PROGRAM TO DEMONSTRATE OBTAINING THE LARGEST EIGENVALUE OF A MATRIX
630 PRINT"WHAT IS THE SIZE OF THE MATRIX: ";
631 INPUT N
632 PRINT
633 DIM A(N+1,N+1),B(N+1,N+1),C(N+1,N+1)
634 FOR I=1 TO N
635 PRINT"INPUT ROW ";I
636 FOR J=1 TO N
637 INPUT A(I,J)
638 NEXT J
639 PRINT
640 NEXT I
641 PRINT
642 PRINT"INPUT LEVEL OF ACCURACY: ";
643 INPUT E
644 PRINT"INPUT NUMBER OF ITERATIONS AT WHICH TO STOP: ";
645 INPUT D1
646 '   FIND EIGENVALUE
647 GOSUB 42700
648 PRINT
649 PRINT"EIGENVALUE= ";A
650 PRINT
651 PRINT"EIGENVECTOR="
652 FOR I=1 TO N
653 PRINT B(I,1)
654 NEXT I
655 PRINT
656 PRINT "NUMBER OF ITERATIONS= ";D
657 END
658 '   PROGRAM TO DEMONSTRATE THE MATRIX EXPONENT SUBROUTINE
659 PRINT"INPUT THE SIZE OF THE MATRIX TO BE EXPONENTIATED";
660 INPUT N
661 DIM A(N+1,N+1), B(N+1,N+1), C(N+1,N+1), D(N+1,N+1
662 FOR I=1 TO N
663 PRINT"INPUT ROW ";I
664 FOR J=1 TO N
665 INPUT A(I,J)
666 NEXT J
667 PRINT
668 NEXT I
669 PRINT
670 '   PRINT MATRIX A
671 N1=N
672 N2=N
673 N3=0
674 M=N
675 PRINT"MATRIX A="
676 PRINT
677 '   MOVE A TO C
678 GOSUB 42150
679 '   PRINT
680 GOSUB 1020
681 PRINT"INPUT THE VARIABLE X";
682 INPUT X
683 PRINT
684 PRINT"INPUT THE NUMBER OF TERMS TO BE CALCULATED";
685 INPUT K2
686 '   OBTAIN EXPONENT
687 GOSUB 42800
688 PRINT
689 PRINT"EXP(AX)= "
690 PRINT
691 GOSUB 1020
692 PRINT
693 END
694 '   PROGRAM TO DEMONSTRATE THE USE OF THE UNIFORM
695 '   RANDOM NUMBER GENERATOR
696 L=80
697 '   SET PLOT WIDTH
698 N=21
699 DIM C(22),D(22),E(22)
700 I=1 TO 21
701 D(I)=0
702 C(I)=(I-1)/10
703 NEXT I
704 '   SET SEED
705 Z2=RND(-.5)
706 FOR I2=1 TO 1000
707 Z2=10*RND(.9990001)+1
708 Z2=INT(Z2)
709 D(Z2)=D(Z2)+1
710 NEXT I2
711 PRINT"DISTRIBUTION OF THE 1000 RANDOM NUMBERS"
712 PRINT"IN TERMS OF THE NUMBER PER INTERVAL OF LENGTH 1/10"
713 PRINT
714 PRINT
715 GOSUB 40100
716 PRINT
717 PRINT
718 END
719 '   SINE AND COSINE APPROXIMATION DEMONSTRATION
720 PRINT"  X       SIN(X)             DELTA             COS(X)           DELTA"
721 PRINT" ---     --------           -------          -------          --------"
722 PRINT
723 FOR X=-5 TO 5 STEP .2
724 GOSUB 43210
725 PRINT INT(10*X)/10;TAB(8);Y;TAB(26);(SIN(X)-Y);
726 GOSUB 43225
727 PRINT TAB(46);Y;TAB(65);(COS(X)-Y)
728 NEXT X
729 END
730 '   ARCTANGENT APPROXIMATION DEMONSTRATION
731 PRINT" X";TAB(8);"ARCTANGENT";TAB(24);"DELTA"
732 PRINT"---"TAB(8);"-----------";TAB(24);"-----"
733 PRINT
734 FOR X=-5 TO STEP .2
735 GOSUB 43245
736 PRINT X;TAB(8);Y;TAB(21);(ATN(X)-Y)
737 NEXT X
738 END
739 '   NATURAL LOGARITHM AND EXPONENT APPROXIMATION DEMONSTRATION
740 PRINT" X";TAB(8);"  LN(X)  ";TAB(24);" DELTA ";TAB(40);"EXP(LN(X))";TAB(56);" DELTA "
741 PRINT"---";TAB(8);"---------";TAB(24);-------";TAB(40);----------";TAB(56);"-------"
742 FOR X=.1 TO 5 STEP .1
743 GOSUB 43280
744 PRINT X;TAB(8);Y;TAB(24);(LOG(X)-Y);
745 F=X
746 X=Y
747 GOSUB 43470
748 PRINT TAB(40);Y;TAB(56);(F-Y)
749 X=F
750 NEXT X
751 END
752 '   BASE 10 LOGARITHM AND EXPONENT APPROXIMATION DEMONSTRATION
753 PRINT" X";TAB(8);" LOG(X) ";TAB(24);" DELTA ";TAB(40);"10**(LOG(X))";TAB(56);" DELTA "
754 PRINT"---";TAB(8);"--------";TAB(24);"-------";TAB(40);"-----------";TAB(56);"-------"
755 FOR X=.1 TO 5 STEP .1
756 GOSUB 43260
757 PRINT X;TAB(8);Y;TAB(24);(.4342944#*LOG(X)-Y);
758 F=X
759 X=Y
760 GOSUB 43450
761 PRINT TAB(40);Y;TAB(56);(F-Y)
762 X=F
763 NEXT X
764 END
1000 '   ********************
1010 '   PRINTING SUBROUTINE
1020 PRINT
1030 FOR I=1 TO M
1040 FOR J=1 TO N
1050 PRINT TAB(6*J);INT(C(I,J)*100+.5)/100;
1060 NEXT J
1070 PRINT
1080 NEXT I
1090 PRINT
1100 RETURN
39998 '    PLOTTING SUBROUTINE (EQAPLOT)
39999 '    SHIFT DATA TO NON-NEGATIVE
40000 B=10000000#
40001 '    FIND MINIMUM DATA VALUE
40002 FOR I=1 TO N
40003 IF B>D(I) THEN B=D(I)
40004 NEXT I
40005 '    SUBTRACT MINIMUM VALUE FROM ALL DATA
40006 FOR I=1 TO N
40007 D(I)=D(I)-B
40008 NEXT I
40009 '    FIND MAX. SHIFTED DATA VALUE
40010 C=0
40011 FOR I=1 TO N
40012 IF C=1 THEN GOTO 40046
40044 PRINT"*";
40045 GOTO 40049
40046 PRINT":";
40047 PRINT TAB(E2);"*";
40048 IF INT(E2)=L THEN GOTO 40050
40049 PRINT TAB(L);":";
40050 PRINT
40051 NEXT I
40052 '    GO TO AXIS PRINT SUBROUTINE
40053 GOSUB 40200
40054 PRINT
40055 PRINT
40056 PRINT"END ABSCISSA VALUE= ";X2
40057 PRINT
40058 PRINT
40059 '    RETURN TO DATA SOURCE PROGRAM
40060 RETURN
40098 '    TWO DIMENSIONAL DATA PLOTTING SUBROUTINE (DATAPLOT)
40099 '    SHIFT DATA TO NON-NEGATIVE
40100 B=10000000#
40101 '    FIND MINIMUM DATA VALUE
40102 FOR I=1 TO N
40103 IF B>D(I) THEN B=D(I)
40104 NEXT I
40105 '    SUBTRACT MINIMUM VALUE FROM ALL DATA
40106 FOR I=1 TO N
40107 D(I)=D(I)-B
40108 NEXT I
40109 '    FIND MAX. SHIFTED DATA VALUE
40110 C=0
40111 FOR I=1 TO N
40112 IF C=1 THEN GOTO 40155
40153 PRINT"*";
40154 GOTO 40158
40155 PRINT":";
40156 PRINT TAB(E2);"*";
40157 IF INT(E2)=L THEN GOTO 40159
40158 PRINT TAB(L);":";
40159 PRINT
40160 GOTO 40175
40161 '    TEST FOT OVERLAY OF POINTS
40162 '    IF DUPLICATE POINT, SKIP TO END
40163 IF D(I)=D(I+1) THEN GOTO 40175
40164 IF E2>=1 THEN GOTO 40168
40165 '    PRINT DOUBLE VALUES ON ONE LINE
40166 PRINT"*";TAB(A*D(I+1));"*";
40167 GOTO 40171
40168 PRINT":";
40169 PRINT TAB(E2);"*";TAB(A*D(I+1));"*";
40170 '    TEST IF LINE LIMIT REACHED
40171 IF INT(A*D(I+1))=L THEN GOTO 40173
40172 PRINT TAB(L);":";
40173 PRINT
40174 I=I+1
40175 NEXT I
40176 '    GO TO AXIS PRINT SUBROUTINE
40177 GOSUB 40200
40178 PRINT
40179 PRINT
40180 PRINT"END ABSCISSA VALUE= ";C(N)
40181 PRINT
40182 PRINT
40183 '    RETURN TO DATA SOURCE PROGRAM
40184 RETURN
40199 '    AXIS PLOT (AXISPLOT)
40200 E3=E-5*INT(E/5)
40201 '    IF B IS POSITIVE, THEN SKIP ZERO LABEL
40202 IF B>0 THEN E3=0
40203 '    IF B IS GREATER THAN THE LARGEST VALUE, SKIP
40204 IF ABS(B)>C THEN E3=0
40205 IF E3<1 THEN GOTO 40208
40206 FOR J=1 TO E3:PRINT"-";
40207 NEXT J
40208 IF (L-E3)/5<1 THEN GOTO 40211
40209 FOR J=1 TO (L-E3)/5:PRINT"I----";
40210 NEXT J
40211 PRINT"I";
40212 E4=(J-1)*5+1+E3
40213 IF E4=L+1 THEN PRINT
40214 IF E4=L+1 THEN GOTO 40221
40215 E4=E4+1
40216 IF E4>L+1 THEN GOTO 40219
40217 PRINT"-";
40218 GOTO 40215
40219 PRINT":"
40220 '    RETURN TO MAIN PLOTTING PROGRAM
40221  RETURN
40229 '    COMPLEX NUMBER ADDITION SUBROUTINE (ZADD)
40300 X(3)=X(1)+X(2)
40301 Y(3)=Y(1)+Y(2)
40302 RETURN
40349 '    COMPLEX NUMBER SUBTRACTION SUBROUTINE (ZSUB)
40350 X(3)=X(1)-X(2)
40351 Y(3)=Y(1)-Y(2)
40352 RETURN
40399 '    RECTANGULAR TO POLAR CONVERSION SUBROUTINE (RECT/POL)
40400 U=SQR(X*X+Y*Y)
40401 '    GUARD AGAINST AMBIGUOUS VECTOR
40402 IF Y=0 THEN Y=(.1)^30
40403 '    GUARD AGAINST DIVIDE BY ZERO
40404 IF X=0 THEN X=(.1)^30
40405 '    SOME BASICS REQUIRE A SIMPLE ARGUMENT
40406 W=Y/X
40407 V=ATN(W)
40408 '    CHECK QUADRANT AND ADJUST
40409 IF X<0 THEN V=V+3.1415926535#
40410 IF V<0 THEN V=V+6.2831853072#
40411 RETURN
40449 '    POLAR TO RECTANGULAR CONVERSION SUBROUTINE (POL/RECT)
40450 X=U*COS(V)
40451 Y=U*SIN(V)
40452 RETURN
40499 '    POLAR MULTIPLICATION SUBROUTINE (ZPOLMLT)
40500 U=U(1)*U(2)
40501 V=V(1)+V(2)
40502 IF V>=6.2831853072# THEN V=V-6.2831853072#
40503 RETURN
40549 '    POLAR DIVISION SUBROUTINE (ZPOLDIV)
40550 U=U(1)/U(2)
40551 V=V(1)-V(2)
40552 IF V<0 THEN V=V+6.2831853072#
40553 RETURN
40599 '    RECTANGULAR COMPLEX NUMBER MULTIPLICATION SUBROUTINE (ZRECTMLT)
40600 X=X(1)
40601 Y=Y(1)
40602 '    RECTANGULAR TO POLAR CONVERSION
40603 GOSUB 40400
40604 U(1)=U
40605 V(1)=V
40606 X=X(2)
40607 Y=Y(2)
40608 '    RECTANGULAR TO POLAR TO POLAR CONVERSION
40609 GOSUB 40400
40610 U(2)=U
40611 V(2)=V
40612 '    POLAR MULTIPLICATION
40613 GOSUB 40500
40614 '    POLAR TO RECTANGULAR CONVERSION
40615 GOSUB 40450
40616 RETURN
40799 '    RECTANGULAR COMPLEX NUMBER DIVISION SUBROUTINE (ZRECTDIV)
40800 X=X(1)
40801 Y=Y(1)
40802 '    RECTANGULAR TO POLAR CONVERSION
40803 GOSUB 40400
40804 U(1)=U
40805 V(1)=V
40806 X=X(2)
40807 Y=Y(2)
40808 '    RECTANGULAR TO POLAR CONVERSION
40809 GOSUB 40400
40810 U(2)=U
40811 V(2)=V
40812 '    POLAR COMPLEX NUMBER DIVISION
40813 GOSUB 40550
40814 '    POLAR TO RECTANGULAR CONVERSION
40815 GOSUB 40450
40816 RETURN
41099 '    POLAR POWER SUBROUTINE (ZPOLPOW)
41100 U1=U^N
41101 V1=N*V
41102 V1=V1-6.2831853072#*INT(V1/6.2831853072#)
41103 RETURN
41149 '    POLAR (FIRST) ROOT SUBROUTINE (ZPOLRT)
41150 U1=U^(1/N)
41151 V1=V/N
41152 RETURN
41198 '    RECTANGULAR COMPLEX NUMBER POWER SUBROUTINE (ZRECTPOW)
41199 '    RECTANGULAR TO POLAR CONVERSION
41200 GOSUB 40400
41201 '    POLAR POWER
41202 GOSUB 41100
41203 '    CHANGE VARIABLEFOR CONVERSION
41204 U=U1
41205 V=V1
41206 '    POLAR TO RECTANGULAR CONVERSION
41207 GOSUB 40450
41208 RETURN
41298 '    RECTANGULAR COMPLEX NUMBER ROOT SUBROUTINE (ZRECTRT)
41299 '    RECTANGULAR TO POLAR CONVERSION
41300 GOSUB 40400
41301 '    POLAR (FIRST) ROOT
41302 GOSUB 41150
41303 U=U1
41304 '    FIND M ORDER ROOT
41305 '    M=1 CORRESPONDSTO THE FIRST ROOT
41306 V=V1+6.2831853072#*(M-1)/N
41307 '    POLAR TO RECTANGULAR CONVERSION
41308 GOSUB 40450
41309 RETURN
41399 '    SPHERICAL TO RECTANGULAR (CARTESIAN) CONVERSION SUBROUTINE (SPR/RECT)
41400 X=U*(SIN(W))*COS(V)
41401 Y=U*(SIN(W))*SIN(V)
41402 Z=U*COS(W)
41403 RETURN
41448 '    RECTANGULAR (CARTESIAN) TO SPHERICAL CONVERSION SUBROUTINE (RECT/SPR)
41449 '    RECTANGULAR TO POLAR CONVERSION
41450 GOSUB 40400
41451 '    SAVE AND CHANGE VARIABLES
41452 V1=V
41453 X=U
41454 Y=Z
41455 '    RECTANGULAR TO POLAR CONVERSION
41456 GOSUB 40400
41457 IF V>1.5707963268# THEN V=V-6.28318553072#
41458 W=1.5707963268#-V
41459 V=V1
41460 RETURN
41498 '    VECTOR ADDITION SUBROUTINE (VECTADD)
41499 '    C=A+B
41500 FOR I=1 TO N
41501 C(I)=A(I)+B(I)
41502 NEXT I
41503 RETURN
41548 '    VECTOR SUBTRACTION SUBROUTINE (VECTSUB)
41549 '    C=A-B
41550 FOR I=1 TO N
41551 C(I)=A(I)-B(I)
41552 NEXT I
41553 RETURN
41598 '    VECTOR DOT PRODUCT SUBROUTINE (VECTDOT)
41599 '    C=A.B
41600 C=0
41601 FOR I=1 TO N
41602 C=C+A(I)*B(I)
41603 NEXT I
41604 RETURN
41648 '    VECTOR CROSS PRODUCT SUBROUTINE (VECTCURL)
41649 '    C=A X B
41650 C(1)=A(2)*B(3)-A(3)*B(2)
41651 C(2)=A(3)*B(1)-A(1)*B(3)
41652 C(3)=A(1)*B(2)-A(2)*B(1)
41653 RETURN
41699 '    VECTOR LENGTH SUBROUTINE (VECTLEN)
41700 L=0
41701 FOR I=1 TO N
41702 L=L+A(I)*A(I)
41703 NEXT I
41704 L=SQR(L)
41705 RETURN
41747 '    VECTOR ANGLE SUBROUTINE (VECTANGL)
41748 '    ANGLE BETWEEN A AND B
41749 '    FIND DOT PRODUCT
41750 GOSUB 41600
41751 '    FIND LENGTH OF A
41752 GOSUB 41700
41753 '    SAVE VALUE
41754 L1=L
41755 '    FIND LENGTH OF B
41756 FOR I=1 TO N
41757 A(I)=B(I)
41758 NEXT I
41759 GOSUB 41700
41760 E=C/(L*L1)+(.1)^30
41761 E=SQR(1-E*E)/E
41762 A=ATN(E)
41763 IF C<0 THEN A=3.1415926536#-A
41764 RETURN
41798 '    MATRIX ADDITION SUBROUTINE (MATADD)
41799 '    C=A+B
41800 FOR I=1 TO M
41801 FOR J=1 TO N
41802 C(I,J)=A(I,J)+B(I,J)
41803 NEXT J
41804 NEXT I
41805 RETURN
41848 '    MATRIX SUBTRACTION SUBROUTINE (MATSUB)
41849 '    C=A-B
41850 FOR I=1 TO M
41851 FOR J=1 TO N
41852 C(I,J)=A(I,J)-B(I,J)
41853 NEXT J
41854 NEXT I
41855 RETURN
41898 '    MATRIX MULTIPLICATION SUBROUTINE (MATMULT)
41899 '    C=A X B   A IS M1 BY N1   B IS M2 BY N2   C IS 1 BY N2
41900 FOR I=1 TO M1
41901 FOR J=1 TO N2
41902 C(I,J)=0
41903 FOR K=1 TO N1
41904 C(I,J)=C(I,J)+A(I+K)*B(K,J)
41905 NEXT K
41906 NEXT J
41907 NEXT I
41908 RETURN
41948 '    MATRIX TRANSPOSE SUBROUTINE (MATTRANS)
41949 '    B=TRANSPOSE(A)
41950 FOR I=1 TO N
41951 FOR J=1 TO M
41952 B(I,J)=A(J,I)
41953 NEXT J
41954 NEXT I
41955 RETURN
41998 '    DIAGONAL MATRIX CREATION SUBROUTINE (MATDIAG)
41999 '    MATRIX B(I,J) IS THE IDENTITY MATRIX TIMES 
42000 FOR I=1 TO N
42001 FOR J=1 TO N
42002 B(I,J)=0
42003 IF I=J THEN B(I,J)=B
42004 NEXT J
42005 NEXT I
42006 RETURN
42048 '    MATRIX SAVE (A IN B) SUBROUTINE (MATSAVAB)
42049 '    N1,N2 AND N3 ARE INPUT INDICES
42050 IF N1*N2*N3=0 THEN GOTO 42060
42051 '    CHECK DIMENSION
42052 FOR I1=1 TO N1
42053 FOR I2=1 TO N2
42054 FOR I3=1 TO N3
42055 B(I1,I2,I3)=A(I1,I2,I3)
42056 NEXT I3
42057 NEXT I2
42058 NEXT I1
42059 RETURN
42060 IF N1*N2=0 THEN GOTO 42067
42061 FOR I1=1 TO N1
42062 FOR I2=1 TO N2
42063 B(I1,I2)=A(I1,I2)
42064 NEXT I2
42065 NEXT I1
42066 RETURN
42067 IF N1=0 THEN RETURN
42068 FOR I1=1 TO N1
42069 B(I1)=A(I1)
42070 NEXT I1
42071 RETURN
42073 '    MATRIX SAVE (B IN A) SUBROUTINE (MATSAVBA)
42074 '    NI,N2 AND N3 ARE INPUT INDICES
42075 IF N1*N2*N3=0 THEN GOTO 42085
42076 '    CHECK DIMENSIONS
42077 FOR I1=1 TO N1
42078 FOR I2=1 TO N2
42079 FOR I3=1 TO N3
42080 A(I1,I2,I3)=B(I1,I2,I3)
42081 NEXT I3
42082 NEXT I2
42083 NEXT I1
42084 RETURN
42085 IF N1*N2=0 THEN GOTO 42092
42086 FOR I1=1 TO N1
42087 FOR I2=1 TO N2
42088 A(I1,I2)=B(I1,I2)
42089 NEXT I2
42091 RETURN
42092 IF N1=0 THEN RETURN
42093 FOR I1=1 TO N1
42094 A(I1)=B(I1)
42095 NEXT I1
42096 RETURN
42098 '    MATRIX SAVE (C IN B) SUBROUTINE (MATSAVCB)
42099 '    N1,N2 AND N3 ARE INPUT INDICES
42100 IF N1*N2*N3=0 THEN GOTO 42110
42101 '    CHECK DIMENSION
42102 FOR I1=1 TO N1
42103 FOR I2=1 TO N2
42104 FOR I3=1 TO N3
42105 B(I1,I2,I3)=C(I1,I2,I3)
42106 NEXT I3
42107 NEXT I2
42108 NEXT I1
42109 RETURN
42110 IF N1*N2=0 THEN GOTO 42117
42111 FOR I1=1 TO N1
42112 FOR I2=1 TO N2
42113 B(I1,I2)=C(I1,I2)
42114 NEXT I2
42115 NEXT I1
42116 RETURN
42117 IF N1=0 THEN RETURN
42118 FOR I1=1 TO N1
42119 B(I1)=C(I1)
42120 NEXT I1
42121 RETURN
42123 '    MATRIX SAVE (B IN C) SUBROUTINE (MATSAVBC)
42124 '    N1,N2 AND N3 ARE INPUT INDICES
42125 IF N1*N2*N3=0 THEN GOTO 42135
42126 '    CHECK DIMENSION
42127 FOR I1=1 TO N1
42128 FOR I2=1 TO N2
42129 FOR I3=I TO N3
42130 C(I1,I2,I3)=B(I1,I2,I3)
42131 NEXT I3
42132 NEXT I2
42133 NEXT I1
42134 RETURN
42135 IF N1*N2=0 THEN GOTO 42142
42136 FOR I1=1 TO N1
42137 FOR I2=1 TO N2
42138 C(I1,I2)=B(I1,I2)
42139 NEXT I2
42140 NEXT I1
42141 RETURN
42142 IF N1=0 THEN RETURN
42143 FOR I1=1 TO N1
42144 C(I1)=B(I1)
42145 NEXT I1
42146 RETURN
42148 '    MATRIX SAVE (A IN C) SUBROUTINE (MATSAVAC)
42149 '    N1,N2 AND N3 ARE INPUT INDICES
42150 IF N1*N2*N3=0 THEN GOTO 42160
42151 '    CHECK DIVISION
42152 FOR I1=1 TO N1
42153 FOR I2=1 TO N2
42154 FOR I3=1 TO N3
42155 C(I1,I2,I3)=A(I1,I2,I3)
42156 NEXT I3
42157 NEXT I2
42158 NEXT I1
42159 RETURN
42160 IF N1*N2=0 THEN GOTO 42167
42161 FOR I1=1 TO N1
42162 FOR I2=1 TO N2
42163 C(I1,I2)=A(I1,I2)
42164 NEXT I2
42165 NEXT I1
42166 RETURN
42167 IF N1=0 THEN RETURN
42168 FOR I1=1 TO N1
42169 C(I1)=A(I1)
42170 NEXT I1
42171 RETURN
42173 '    MATRIX SAVE (C IN A) SUBROUTINE (MATSAVCA)
42174 '    N1,N2 AND N3 ARE INPUT INDICES
42175 IF N1*N2*N3=0 THEN GOTO 42185
42176 '    CHECK DIMENSION
42177 IF N1*N2=0 THEN GOTO 42192
42178 FOR I2=1 TO N2
42179 FOR I3=1 TO N3
42180 A(I1,I2,I3)=C(I1,I2,I3)
42181 NEXT I3
42182 NEXT I2
42183 NEXT I1
42184 RETURN
42186 FOR I1=1 TO N1
42187 FOR I2=1 TO N2
42188 A(I1,I2)=C(I1,I2)
42189 NEXT I2
42190 NEXT I1
42191 RETURN
42192 IF N1=0 THEN RETURN
42193 FOR I1=1 TO N1
42194 A(I1)=C(I1)
42195 NEXT I1
42196 RETURN
42198 '    SCALAR B X MATRIX A SUBROUTINE (MATSCALE)
42199 '    N1,N2 AND N3 ARE INPUT INDICES
42200 IF N1*N2*N3=0 THEN GOTO 42210
42201 '    CHECK DIMENSION
42202 FOR I1=1 TO N1
42203 FOR I2=1 TO N2
42204 FOR I3=1 TO N3
42205 A(I1,I2,I3)=B*A(I1,I2,I3)
42206 NEXT I3
42207 NEXT I2
42208 NEXT I1
42209 RETURN
42210 IF N1*N2=0 THEN GOTO 42217
42211 FOR I1=1 TO N1
42212 FOR I2=1 TO N2
42213 A(I1,I2)=B*A(I1,I2)
42214 NEXT I2
42215 NEXT I1
42216 RETURN
42217 IF N1=0 THEN RETURN
42218 FOR I1=1 TO N1
42219 A(I1)=B*A(I1)
42220 NEXT I1
42221 RETURN
42223 '    MATRIX A CLEAR SUBROUTINE (MATCLRA)
42224 '    N1,N2, AND N3 ARE INPUT INDICES
42225 IF N1*N2*N3=0 THEN GOTO 42235
42226 '    CHECK DIMENSION
42227 FOR I1=1 TO N1
42228 FOR I2=1 TO N2
42229 FOR I3=1 TO N3
42230 A(I1,I2,I3)=0
42231 NEXT I3
42232 NEXT I2
42233 NEXT I1
42234 RETURN
42235 IF N1*N2=0 THEN GOTO 42242
42236 FOR I1=1 TO N1
42237 FOR I2=1 TO N2
42238 A(I1,I2)=0
42239 NEXT I2
42240 NEXT I1
42241 RETURN
42242 IF N1=0 THEN RETURN
42243 FOR I1=1 TO N1
42244 A(I1)=0
42245 NEXT I1
42246 RETURN
42248 '    ROW SWITCHING SUBROUTINE (MATSWCH)
42249 '    ROWS N1 AND N2 ARE INTERCHANGED
42250 FOR J=1 TO N
42251 B=A(N1,J)
42252 A(N1,J)=A(N2,J)
42253 A(N2,J)=B
42254 NEXT J
42255 RETURN
42273 '    ROW MULTIPLICATION/ADD SUBROUTINE (MATRMAD)
42274 '    B TIMES ROW N1 ADDED TO N2
42275 ROW J=1 TO N
42276 A(N2,J)=A(N2,J)+B*A(N1,J)
42277 NEXT J
42278 RETURN
42296 '    COFACTOR K SUBROUTINE (MATCOFAT)
42297 '    INPUT MATRIX SIZE IS N X N
42298 '    MATRIX A(I,J) IN, MATRIX B(I,J) OUT
42299 '    FIRST SHIFT UP ONE ROW
42300 FOR I=2 TO N
42301 FOR J=1 TO N
42302 B(I-1,J)=A(I,J)
42303 NEXT J
42304 NEXT I
42305 FOR I=1 TO N-1
42306 FOR J=K TO N
42307 IF K=N THEN GOTO 42309
42308 B(I,J)=B(I,J=1)
42309 NEXT J
42310 NEXT I
42311 RETURN
42348 '    MATRIX DETERMINANT SUBROUTINE (MATDET)
42349 '    FINDS DETERMINANT FOR UP TO A 4 X 4 MATRIX
42350 IF N>=2 THEN GOTO 42355
42351 '    ********************
42352 '    FIRST ORDER DETERMINANT
42353 D=A(1,1)
42354 RETURN
42355 IF N>=3 THEN GOTO 42360
42356 '    ********************
42357 '    SECOND ORDER DETERMINANT
42358 D=A(1,1)*A(2,2)-A(1,2)*A(2,1)
42359 RATURN
42360 IF N>=4 THEN GOTO 42370
42361 '    ********************
42362 '    THIRD ORDER DETERMINANT
42363 D=A(1,1)*(A(2,2)*A(3,3)-A(2,3)*A(3,2))
42364 D=D-A(1,2)*(A(2,1)*A(3,3)-A(2,3)*A(3,1))
42365 D=D+A(1,3)*(A(2,1)*A(3,2)-A(2,2)*A(3,1))
42366 RETURN
42367 '    ********************
42368 '    FOURTH ORDER DETERMINANT
42369 '    SAVE A IN C
42370 N1=N
42371 N2=N
42372 N3=0
42373 GOSUB 42150
42374 IF N>=5 THEN RETURN
42375 '    D1 WILL BE THE DETERMINANT
42376 D1=0
42377 '    FIND DETERMINANT OF EACH COFACTOR
42378 FOR K=1 TO 4
42379 '    GET COFACTOR K
42380 GOSUB 42300
42381 '    COFACTOR RETURNED IN B
42382 '    MOVE B TO A
42383 GOSUB 42075
42384 '    GET DET(A)
42385 GOSUB 42363
42386 D1=D1+C(1,K)*D
42387 '    REVERSE SIGN FOR NEXT COFACTOR
42388 D1=-D1
42389 '    SAVE C IN A
42390 GOSUB 42175
42391 NEXT K
42392 D=D1
42393 RETURN
42395 '    MATRIX INVERSION SUBROUTINE (MATINV)
42396 '    GAUSS-JORDAN ELIMINATION
42397 '    MATRIX A IS INPUT, MATRIX B IS OUTPUT
42398 '    DIM A=N X N    TEMPORARY DIM B=N X 2N
42399 '    FIRST CREATE MATRIX WITH A ON THE LEFT AND I ON THE RIGHT
42400 FOR I=1 TO N
42401 FOR J=1 TO N
42402 B(I,J+N)=0
42403 B(I,J)=A(I,J)
42404 NEXT J
42405 B(I,I+N)=1
42406 NEXT I
42407 '    PERFORM ROW ORIENTD OPERATIONS TO CONVERT THE LEFT HAND
42408 '    SIDE OF B TO THE IDENTITY MATRIX. THE INVERSE OF A WILL
42409 '    THEN BE ON THE RIGHT
42410 FOR K=1 TO N
42411 IF K=N THEN GOTO 42424
42412 M=K
42413 '    FIND MAXIMUM ELEMENT
42414 FOR I=K+1 TO N
42415 IF ABS(B(I,K))>ABS(B(M,K)) THEN M=I
42416 NEXT I
42417 IF M=K THEN GOTO 42424
42418 J=K TO 2*N
42419 B=B(K,J)
42420 B(K,J)=B(M,J)
42421 B(M,J)=B
42422 NEXT J
42423 '    DIVIDE ROW K
42424 FOR J=K+1 TO 2*N
42425 B(K,J)=B(K,J)/B(K,K)
42426 NEXT J
42427 IF K=1 THEN GOTO 42434
42428 FOR I=1 TO K-1
42429 FOR J=K+1 TO 2*N
42430 B(I,J)=B(I,J)-B(I,K)*B(K,J)
42431 NEXT J
42432 NEXT I
42433 IF K=N THEN GOTO 42441
42434 FOR I=K+1 TO N
42435 FOR J=K+1 TO 2*N
42436 B(I,J)=B(I,J)-B(I,K)*B(K,J)
42437 NEXT J
42438 NEXT I
42439 NEXT J
42440 '    RETRIEVE INVERSE FROM THE RIGHT SIDE OF B
42441 FOR I=1 TO N
42442 FOR J=1 TO N
42443 B(I,J)=B(I,J+N)
42444 NEXT J
42445 NEXT I
42446 RETURN
42693 '    EIGENVALUE (POWER METHOD) SUBROUTINE (EIGENPOW)
42694 '    AX=LX
42695 '    A IS THE N X N MATRIX
42696 '    B IS AN ARBITRARY VECTOR
42697 '    E IS THE RELATIVE ERROR CHOSEN
42698 '    D = COUNT OF THE NUMBER OF ITERATIONS
42699 '    SET PARAMETERS NEEDED FOR MULTIPLY SUBROUTINE
42700 M1=N
42701 N1=N
42702 M2=N
42703 N2=1
42704 '    GENERATE ARBITRARY NORMALIZED VECTOR B(I,1)
42705 FOR I=1 TO N
42706 B(I,1)=1/SQR(N)
42707 NEXT I
42708 '    B = LAST EIGENVALUE ESTIMATE
42709 '    A = CURRENT EIGENVALUE ESTIMATE
42710 '    PICK AN INITIAL VALUE FOR THE EIGENVALUE GUESS
42711 B=1
42712 D=0
42713 '    START ITERATION
42714 A=0
42715 GOSUB 41900
42716 '    CONVERT C OUTPUT TO B
42717 FOR I=1 TO N
42718 B(I,1)=C(I,1)
42719 A=A+B(I,1)*B(I,1)
42720 NEXT I
42721 D=D+1
42722 A=SQR(A)
42723 '   NORMALIZE VECTOR
42724 FOR I=1 TO N
42725 B(I,1)=B(I,1)/A
42726 NEXT I
42727 IF ABS((A-B)/AD1 THEN RETURN
42730 GOTO 42714
42796 '   MATRIX EXPONENT SUBROUTINE (MATEXP)
42797 '   INPUTS TO THE SUBROUTINE ARE THE MATRIX A, MATRIX
42798 '   SIZE N, NUMBER OF TERMS K2, AND VARIABLE X
42799 '   SET UP INDICES TO BE USED LATER
42800 N1=N
42801 N2=N
42802 N3=0
42803 M1=N
42804 M2=N
42805 '   GUARD AGAINST DIVIDE BY ZERO
42806 IF X=0 THEN X=1E-13
42807 '   INITIALIZE STORAGE MATRIX D(I,J)
42808 FOR I=1 TO N
42809 FOR J=1 TO N
42810 D(I,J)=O
42811 NEXT J
42812 NEXT I
42813 '   K2 IS THE NUMBER OF TERMS TO BE CALCULATED
42814 K1=0
42815 '   CREATE IDENTITY MATRIX IN B
42816 B=1
42817 GOSUB 42000
42818 '   MOVE B TO C
42819 GOSUB 42125
42820 '   ADD TO D
42821 GOSUB 42847
42822 K1=K1+1
42823 IF K1>=K2 THEN GOTO 42838
42824 '   SCALE MATRIX A BY X/K1
42825 B=X/K1
42826 GOSUB 42200
42827 '   MULTIPLY A TIMES B
42828 GOSUB 41900
42829 '   ADD RESULT TO MATRIX D
42830 GOSUB 42847
42831 '   MOVE C TO B
42832 GOSUB 42100
42833 '   RETURN MATRIX A TO ORIGINAL CONDITION
42834 B=K1/X
42835 GOSUB 42200
42836 '   CONTINUE SUMMATION
42837 GOTO 42822
42838 '   MOVE RESULT IN D TO C
42839 FOR I=1 TO N
42840 FOR J=1 TO N
42841 C(I,J)=D(I,J)
42842 NEXT J
42843 NEXT I
42844 '   RETURN TO CALLING PROGRAM
42845 RETURN
42846 '   D(I,J) IS USED FOR TEMPORARY STORAGE
42847 FOR I=1 TO N
42848 FOR J=1 TO N
42849 D(I,J)=D(I,J)+C(I,J)
42850 NEXT J
42851 NEXT I
42852 RETURN
42899 '   LINEAR RANDOM NUMBER GENERATOR (LINEAR)
42900 '   U=MEAN, V=SPREAD, D=SEED
42901 I9=I9+1
42902 A=3.141492653589793#
42903 B=2.718281828459045#
42904 C=1.14142135623731#
42905 D=1+ABS(D)
42906 E=E+(1+D/B)*C
42907 E=E*I9
42908 E=E-A*INT(E/A)
42909 E=E-INT(E)+.018
42910 IF E>.1 THEN E=E+9.000001E-03
42911 IF E>.2 THEN E=E-.002
42912 IF E>.3 THEN E=E-5.000001E-03
42913 IF E>.4 THEN E=E-5.000001E-03
42914 IF E>.5 THEN E=E-.015
42915 E=V*(E-.5)+U
42916 RETURN
42923 '   NORMAL DISTRIBUTION BY CENTRAL LIMIT THEOREM (NORMAL)
42924 '   U=MEAN, V=STANDARD DEVIATION, E=RANDOM NO. GENERATED
42925 E=0
42926 FOR I9=1 TO 48
42927 E=E+RND(.9990001)-.5
42928 NEXT I9
42929 E=V*E/2+U
42930 RETURN
42948 '   POISSON RANDOM NUMBER GENERATOR (POISSON)
42949 '   INPUT PARAMETER U
42950 X=RND(.9990001)*EXP(U)
42951 X1=1
42952 Y1=1
42953 Y=0
42954 IF X1>X THEN GOTO 42959
42955 Y=Y+1
42956 Y1=Y1*U/Y
42957 X1=X1+Y1
42958 GOTO 42954
42959 IF Y>0 THEN Y=Y-(X1-X)/Y1
42960 E=Y
42961 RETURN
42972 '   BINOMIAL RANDOM NUMBER GENERATOR (BINOMIAL
42973 '   B=PROBABILITY PER TRIAL
42974 '   N=NUMBER OF TRIALS
42975 E=0
42976 FOR K=1 TO N
42977 Y1=RND(.9990001)
42978 IF Y0 THEN GOTO 43103
43101 E=1
43102 RETURN
43103 '   B>0
43104 IF A>2 THEN RETURN
43105 X=RND(.9990001)
43106 IF A=2 THEN GOTO 43109
43107 E=1-(1-X)**(1/B)
43108 RETURN
43109 Y=1
43110 Y1=1-((1-X)/(1+B*Y))**(1/B)
43111 IF ABS((Y-Y1)/Y)<.001 THEN GOTO 43114
43112 Y=Y1
43113 GOTO 43110
43114 E-Y1
43115 RETURN
43148 '   WEIBULL RANDOM NUMBER GENERATOR (WEIBULL)
43149 '   INPUT PARAMETERS ARE U AND V
43150 X=RND(.9990001)
43151 E=U*((LOG(1/(1-X)))**(1/V))
43152 RETURN
43199 '   SERIES SUMMATION SUBROUTINE (SERSUM)
43200 Y=0
43201 FOR I=N TO 0 STEP -1
43202 Y=Z*Y+A(I)
43203 NEXT I
43204 RETURN
43209 '   SINE SERIES SUBROUTINE (SINE)
43210 X1=1
43211 IF X<0 THEN X1=-1
43212 X3=ABS(X)
43213 X2=3.141592653589793#
43214 '   REDUCE RANGE
43215 X3=X3-2*X2*INT(.5*X3/X2)
43216 IF X3>X2 THEN X1=-X1
43217 IF X3>X2 THEN X3=X3-X2
43218 IF X3>X2/2 THEN X3=X2-X3
43219 Z=X3*X3
43220 GOSUB 43300
43221 GOSUB 43200
43222 Y=X1*X3*Y
43223 RETURN
43224 '   COSINE SERIES SUBROUTINE (COSINE)
43225 X2=3.141592653589793#
43226 X1=1
43227 '   REDUCE RANGE
43228 X3=ABS(X)
43229 X3=X3-2*X2*INT(.5*X3/X2)
43230 IF X3>X2 THEN X1=-1
43231 IF X3>X2 THEN X3=X3-X2
43232 IF X3>X2/2 THEN X1=-X1
43233 IF X3>X2/2 THEN X3=X2-X3
43234 Z=X3*X3
43235 GOSUB 43310
43236 GOSUB 43200
43237 Y=X1*Y
43238 RETURN
43244 '   ARCTANGENT SERIES SUBROUTINE (ARCTAN)
43245 X1=1
43246 IF X<0 THEN X1=-1
43247 X3=ABS(X)
43248 Z1=(X3-1)/(X3+1)
43249 IF X3<.5 THEN Z1=X3
43250 Z=Z1*Z1
43251 '   GET SERIES COEFFICIENTS
43252 GOSUB 43320
43253 '   SUM SERIES
43254 GOSUB 43200
43255 Y=Z1*Y
43256 IF X3>=.5 THEN Y=Y+.78539816339745#
43257 Y=X1*Y
43258 RETURN
43259 '   LOG BASE TEN SERIES SUBROUTINE (LOG(X))
43260 X1=1
43261 C=-1
43262 X2=10
43263 X3=X
43264 IF X>=1 THEN GOTO 43268
43265 X=1/X
43266 X1=-1
43267 '   REDUCE RANGE
43268 X=X2*X
43269 C=C+1
43270 X=X/X2
43271 IF X>X2 THEN GOTO 43269
43272 Z1=(X-3.16227766#)/(X+3.16227766#)
43273 Z=Z1*Z1
43274 GOSUB 43340
43275 GOSUB 43200
43276 Y=X1*(C+Z1*Y+.5)
43277 X=X3
43278 RETURN
43279 '   NATURAL LOGARITHM SERIES SUBROUTINE (LN(X))
43280 X1=1
43281 C=-1
43282 X2=2.718281828459045#
43283 X3=X
43284 IF X>=1 THEN GOTO 43288
43285 X=1/X
43286 X1=-1
43287 '   REDUCE RANGE
43288 X=X2*X
43289 C=C+1
43290 X=X/X2
43291 IF X>X2 THEN GOTO 43289
43292 Z1=(X-1.6487212707#)/(X+1.6487212707#)
43293 Z=Z1*Z1
43294 GOSUB 43360
43295 GOSUB 43200
43296 Y=X1*(C+Z1*Y+.5)
43297 X=X3
43298 RETURN
43299 '   SINE SERIES COEFFICIENTS (SINDATA)
43300 N=6
43301 A(0)=1
43302 A(1)=-.1666666666671334#
43303 A(2)=8.33333333809067D-03
43304 A(3)=-1.98412715551283D-04
43305 A(4)=2.7557589750762D-06
43306 A(5)=-2.507059876207D-08
43307 A(6)=1.64105986683D-10
43308 RETURN
43309 '   COSINE SERIES COEFFICIENTS (COSDATA)
43310 N=6
43311 A(0)=1
43312 A(1)=-.4999999999982#
43313 A(2)=.04166666664651#
43314 A(3)=-.001388888805755#
43315 A(4)=.000024801428034#
43316 A(5)=-.0000002754213324#
43317 A(6)=.0000000020189405#
43318 RETURN
43319 '   ARCTANGENT SERIES COEFFICIENTS (ARCDATA)
43320 N=10
43321 A(0)=1
43322 A(1)=-.333333311286#
43323 A(2)=.199998774421#
43324 A(3)=-.142831560376#
43325 A(4)=.110840091104#
43326 A(5)=-.089229124381#
43327 A(6)=.070315200033#
43328 A(7)=-.04927890803#
43329 A(8)=.026879941561#
43330 A(9)=-.00956838452#
43331 A(10)=.001605444922#
43332 RETURN
43339 '   LOG BASE TEN SERIES COEFFICIENTS (LOGDATA)
43340 N=9
43341 A(0)=.8685889644#
43342 A(1)=.2895297117#
43343 A(2)=.1737120608#
43344 A(3)=.1242584742#
43345 A(4)=.093908046#
43346 A(5)=.1009301264#
43347 A(6)=-.0439630355#
43348 A(7)=-.3920576195#
43349 A(8)=-.5170494708#
43350 A(9)=.4915571108#
43351 RETURN
43359 '   NATURAL LOGARITHM SERIES COEFFICIENTS (LNDATA)
43360 N=9
43361 A(0)=2
43362 A(1)=.66666672443#
43363 A(2)=.3999895288#
43364 A(3)=.286436047#
43365 A(4)=.197959107#
43366 A(5)=.628353
43367 A(6)=-4.54692
43368 A(7)=28.117
43369 A(8)=-86.42
43370 A(9)=106.1
43371 RETURN
43379 '   POWER OF E SERIES COEFFICIENTS (EXPDATA)
43380 N=8
43381 A(0)=1
43382 A(1)=.99999999668#
43383 A(2)=.49999995173#
43384 A(3)=.16666704243#
43385 A(4)=.04166685027#
43386 A(5)=.00832672635#
43387 A(6)=.00140836136#
43388 A(7)=.00017358267#
43389 A(8)=3.93168E-05
43390 RETURN
43399 '   POWER OF TEN SERIES COEFFICIENTS (TENDATA)
43400 N=9
43401 A(0)=1
43402 A(1)=1.1512925485#
43403 A(2)=.6627373050000001#
43404 A(3)=.2543345675#
43405 A(4)=.0732032741#
43406 A(5)=.0168603036#
43407 A(6)=.0032196227#
43408 A(7)=5.54766E-04
43409 A(8)=5.73305E-05
43410 A(9)=1.79419E-05
43411 RETURN
43449 '   POWER OF TEN SERIES SUBROUTINE (TENPOW)
43450 X1=1
43451 X3=X
43452 IF X<0 THEN X1=-1
43453 X=ABS(X)
43454 '   REDUCE RANGE
43455 X2=INT(X)
43456 X=X-X2
43457 '   GET COEFFICIENTS
43458 GOSUB 43400
43459 Z=X
43460 '   SUM SERIES
43461 GOSUB 43200
43462 Y=Y*Y
43463 IF X2<1 THEN GOTO 43466
43464 FOR I=1 TO X2:Y=Y*10
43465 NEXT I
43466 IF X1<0 THEN Y=1/Y
43467 X=X3
43468 RETURN
43469 '   EXPONENT SERIES SUBROUTINE (EXP(X))
43470 X1=1
43471 X3=X
43472 IF X<0 THEN X1=-1
43473 X=ABS(X)
43474 '   REDUCE RANGE
43475 X2=INT(X)
43476 X=X-X2
43477 '   GET COEFFICIENTS
43478 GOSUB 43380
43479 Z=X
43480 '   SUM SERIES
43481 GOSUB 43200
43482 IF X2<1 THEN GOTO 43485
43483 FOR I=1 TO X2:Y=Y*2.718281828459045#
43484 NEXT I
43485 IF X1<0 THEN Y=1/Y
43486 X=X3
43487 RETURN