--- title: "Math I" id: 58418 type: "computer_media" slug: "math-i" url: "http://localhost/computer_media/math-i/" markdown_url: "http://localhost/computer_media/math-i.md" published_at: "2024-11-17T12:58:54+00:00" modified_at: "2026-04-03T07:58:03+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/11/Plot.jpeg" excerpt: "A multi-program math toolkit covering matrix inversion, root finding, integration, base conversion, prime factoring, and a function plotter that compiles its own machine code." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Math%20I%20%28198x%29%28UNK%29%28TS1000%29%28US%29%28Cassette%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/11/Plot.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/BIS.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/BSCV.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/HEXD.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/LIN.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/LINv2.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/NM.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/PFD.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/PL.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/QUAD.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/SIM.jpeg" - url: "http://localhost/wp-content/uploads/2024/11/Tape-A.jpg" - url: "http://localhost/wp-content/uploads/2024/11/Tape-B.jpg" media_type_tags: "Mathematics" --- # Math I Math I is a collection of mathematical utility programs covering numerical methods, algebra, and number theory. The collection includes a Gauss-Jordan elimination routine that both solves simultaneous linear equations and inverts N×N matrices, a bisection method zero-finder (BIS), a Newton-Raphson zero-finder (NM), Simpson’s Rule numerical integrator (SIM), a quadratic solver handling complex roots, a function table printer (PL), a general base conversion utility (BSCV), a hex/decimal converter (HEXD), and a prime factor finder (PFD). The function plotter (Plot) is technically ambitious: it uses VAL of a string to evaluate user-entered expressions, compiles a 386-byte machine code routine at address 16514 during the first plot pass, and then allows the same function to be re-plotted at high speed via RAND USR 16514. The LIN program uses SCROLL extensively to manage screen real estate during data entry, and stores the augmented matrix (or identity extension for inversion) in a single two-dimensional array X(N,M). ##### Side A - LIN = Solves simultaneous linear equations - LINv2 = Solves simultaneous linear equations - QUAD = Computes roots and roots complex - SIM = Computes integral - BIS = Computes zero crossing - PL = Computes values of F(x) ##### Side B - Plot = Function Plotter, see 9999 REM for instructions - NM = Computes zero crossing - PFD = Prime Factor Finder - BSCV = Base conversion - HEXD = Hex / Decimal converter *** ## Program Analysis ### Program Structure The cassette holds over a dozen independent BASIC programs, each identified by a `REM` name token at line 5 or 10. They are stored as separate files and cover a broad range of numerical and algebraic topics. The programs share common idioms — notably `VAL F$` for runtime function evaluation and `FAST`/`SLOW` bracketing of computation loops — suggesting a single consistent authoring style. ### BIS — Bisection Root Finder Uses the classic bisection method. The user enters a function as a string and two bracket limits. The program evaluates `VAL F$` at each endpoint and checks that the signs differ (line 140: `IF M*N>0`). If the positive root is at `A` rather than `B`, the limits are swapped (lines 160–180) so that `B` always holds the positive side. The loop bisects until `MID` stops changing (line 192: `IF MID1=MID`), which is a convergence test exploiting the machine’s finite floating-point precision rather than an epsilon comparison. ### LIN — Simultaneous Equations / Matrix Inversion This is the most substantial program. It implements full Gauss-Jordan elimination with partial pivoting on an augmented matrix stored in `X(N,M)`. The mode flag `M` is repurposed: initially 1 (equations) or 2 (inversion), it is then overwritten with the actual column count — `N+1` for equation solving or `2*N` for inversion. The identity columns for matrix inversion are seeded at line 380 (`LET X(R,N+R)=1`). - **Forward elimination** (lines 610–820): sweeps columns left to right, swapping rows when a zero pivot is encountered. - **Backward elimination** (lines 900–980): sweeps columns right to left to fully diagonalize. - **Determinant** (lines 840–880): computed as the product of diagonal elements after forward elimination; zero determinant triggers the “SINGULAR” error path at line 1240. - **Results**: for equations, prints `X(I,M)/X(I,I)`; for inversion, prints `X(R,N+C)/X(R,R)`. Two versions of LIN appear on the tape (both labeled `REM "LIN"`). The second version omits line 330’s label misprint (the first version uses line 320 with an incorrect `PRINT`; the second version uses line 320 without it), and uses `GOTO 580` instead of `GOTO 590` at line 440, suggesting it is a corrected revision. Both versions use `SCROLL` before most `PRINT` statements to prevent the screen from halting on a full display. ### QUAD — Quadratic Solver Solves `Ax²+Bx+C=0`. At line 60, the discriminant is computed as `(ABS B)**2-4*A*C` — the `ABS` wrapper around `B` is redundant since squaring always yields a positive result, but causes no error. When `D<0`, the program prints the complex root in the form `F +/- G J` using engineering notation. ### SIM — Simpson’s Rule Integrator Implements Simpson’s composite rule. The user specifies the number of divisions `N`, which is immediately doubled at line 95 (`LET N=N*2`) to give the actual number of sub-intervals. The three sums — endpoint sum `Y`, odd-index sum `Y1` (weight 4), and even-index sum `Y2` (weight 2) — are accumulated in separate loops before being combined at line 205 and divided by `3*N`. ### NM — Newton-Raphson Zero Finder Accepts both the function and its derivative as separate string inputs, then iterates `I = X - F/F'` using `VAL F$` and `VAL G$`. Convergence is tested at line 100 with an absolute tolerance of `10E-9` (i.e., 1×10⁻⁸). The iteration count is tracked in `C` and reported alongside the result. The program runs in `FAST` mode during iteration. ### Plot — Function Plotter with Machine Code Compilation This is the most technically sophisticated program in the collection. On first run it compiles a 386-byte machine code routine into RAM starting at address 16514. The compilation loop (lines 130–150) uses `POKE N+SGN PI, I` and `POKE N+VAL "2", VAL "43-(H-VAL A$)/(H-L)*43"` to write both opcode bytes and computed plot-position values directly into memory. The data for the machine code is encoded in the block-graphic characters of the line 0 `REM` statement, which the loop reads via `CODE "RND"` and `CODE "Z"` as loop bounds. - Line 0’s `REM` holds the machine code byte stream encoded as character pairs. - Line 40 computes `DX=(A-X)/VAL "63"` — 63 steps to fill the 64-column display. - Lines 50–110 perform a first pass to find the function’s min (`L`) and max (`H`) for auto-scaling. - After plotting, `RAND USR 16514` re-executes the compiled routine at full machine-code speed without recompilation. - The variable `T` is set to `PI+PI` (≈2π) so the user can type `T` as a limit shorthand. - Line 500 uses `UNPLOT NOT USR VAL "16514", RND` as an indirect call idiom. - Lines 9900–9930 provide a self-listing/printing routine, and line 9999 holds a lengthy `REM` with usage instructions. ### PFD — Prime Factor Finder Factors integers up to 10⁹ into a pre-allocated array `B(50)`. Trial division starts with 2, then proceeds through odd candidates generated by `C=1+2*D`. The loop exits when `C>SQR A`, at which point any remaining `A>1` is itself prime and stored directly. Results accumulate across runs without reinitializing the factor array — lines 25–27 reset `K` and `D` to zero before each new number. ### BSCV — General Base Conversion Converts integers between arbitrary bases. The subroutine at line 480 computes a digit-position multiplier `V` using `INT(10**(1+INT(LN(U-1)/LN 10))+.5)`, which finds the next power of ten above the base. The conversion from a non-decimal source first converts to decimal (subroutine at line 390), then from decimal to the target base. When both source and target are non-decimal, an intermediate decimal value is also printed (line 360). ### HEXD — Hex/Decimal Converter Uses `GOTO 200*B` (line 80) to branch to either the hex-input section at line 200 or the decimal-input section at line 400, a compact dispatch idiom. Hex digits are mapped to/from their character codes via offset 28 (`CODE A$(L-I)-28`), which maps the ZX character set positions of digits and letters onto the values 0–15. Invalid hex input triggers `RUN` to restart. The output array `B$(10)` stores hex digit characters in reverse order, then prints them in reverse for correct significance ordering. ### PL — Function Table Printer A straightforward tabulator: accepts a function string, lower/upper limits, and a step increment, then prints `X` and `VAL A$` in two columns inside a `FAST`/`SLOW` bracket. After printing, the user presses 1 to re-enter limits or 2 to stop, using a polling loop at lines 190–200 rather than `INPUT`. ### Notable Techniques and Anomalies - `VAL F$` used as a runtime expression evaluator appears in BIS, NM, SIM, PL, and Plot — a standard technique for user-defined functions in the absence of `DEF FN` with string arguments. - `FAST`/`SLOW` bracketing is used consistently around computation loops to suppress display overhead. - In LIN, `M` is reused as both a mode selector and a column-count variable, which would cause `IF M=N+1 THEN PRINT...` at line 210 to behave incorrectly if `N+1` happened to equal the original mode value of 1 or 2. In practice this only arises for trivial 0×0 or 1×1 systems. - The PRIME program (a simple sieve listing odd primes to 999) appears to be a standalone bonus, with no `REM` name header beyond its `FOR` loop. - The CPO program (specific heat of nitrogen gas) is a single-purpose formula evaluator with no user input, computing Cp° across 300–3500 K using a polynomial fit. - INTP is a minimal linear interpolation utility, accepting five values and computing the interpolated result with no labels or prompts. ## Source Code ``` 100 REM "BIS" 105 PRINT "ENTER FUNCTION IN TERMS OF X" 110 INPUT F$ 115 PRINT "ENTER LIMITS" 120 INPUT A 125 LET MID1=A 130 INPUT B 131 FAST 132 LET X=A 134 LET M=VAL F$ 136 LET X=B 138 LET N=VAL F$ 140 IF M*N>0 THEN GOTO 260 150 IF N>0 THEN GOTO 190 160 LET C=A 170 LET A=B 180 LET B=C 190 LET MID=(B+A)/2 192 IF MID1=MID THEN GOTO 280 194 LET MID1=MID 205 LET X=MID 210 IF VAL F$>0 THEN GOTO 240 220 LET A=MID 230 GOTO 190 240 LET B=MID 250 GOTO 190 260 PRINT "LIMITS DO NOT STRATTLE A ZERO" 270 GOTO 120 280 CLS 290 PRINT "ZERO AT X= ";MID 300 SLOW 10 REM "BSCV" 20 CLS 30 PRINT "GENERAL BASE CONVERSION" 40 PRINT "ENTER ARGUMENT"; 50 INPUT C 60 PRINT C 70 IF C<>INT (ABS C) THEN GOTO 40 80 PRINT "ENTER OLD BASE?"; 90 INPUT D 100 PRINT D 110 IF D<>(ABS D) THEN GOTO 80 120 PRINT "ENTER NEW BASE?"; 130 INPUT E 140 PRINT E 150 IF E<>(ABS E) THEN GOTO 120 160 IF D<>10 THEN GOTO 190 170 LET N=C 180 GOTO 250 190 LET U=D 200 GOSUB 480 210 LET S=C 220 LET Q=D 230 LET R=V 240 GOSUB 390 250 IF E<>10 THEN GOTO 280 260 LET S=N 270 GOTO 340 280 LET U=E 290 GOSUB 480 300 LET S=N 310 LET Q=V 320 LET R=E 330 GOSUB 390 340 PRINT C;" TO BASE ";D 350 PRINT "=";N;" TO BASE ";E 360 IF D<>10 AND E<>10 THEN PRINT "=";S;" TO BASE 10" 370 PRINT " " 380 GOTO 40 390 LET M=0 400 LET N=0 410 LET P=S 420 LET T=P 430 LET P=INT (P/R) 440 LET N=N+INT ((T-P*R)*Q**M+.5) 450 IF P=0 THEN RETURN 460 LET M=M+1 470 GOTO 420 480 LET V=INT (10**(1+INT (LN (U-1)/LN 10))+.5) 490 RETURN 5 REM "CPO" 10 REM CPO SPECIFIC HEAT 20 REM FOR NITROGEN GAS 40 FOR T=300 TO 3500 STEP 100 50 LET S=T/100 60 LET C=39.06-512.79*S**-1.5+1072.7*S**-2-820.4*S**-3 65 LET C=C/28.013 70 PRINT T;" K ";"CPO= ";C;" KJ/KMOL K" 80 NEXT T 10 DIM B$(10) 20 CLS 30 PRINT 35 PRINT "HEX-TO-DECIMAL, ENTER 1" 40 PRINT "DECIMAL-TO-HEX, ENTER 2?"; 50 INPUT B 60 PRINT B 70 IF B<>1 AND B<>2 THEN GOTO 30 80 GOTO 200*B 200 PRINT "ENTER ARGUMENT IN HEX?"; 210 INPUT A$ 220 PRINT A$ 230 LET L=LEN A$ 240 LET N=0 250 FOR I=0 TO L-1 260 LET C=CODE A$(L-I)-28 270 IF C>=0 AND C<=16 THEN GOTO 310 280 PRINT "BAD ENTRY" 290 PAUSE 200 300 RUN 310 LET N=N+C*16**I 320 NEXT I 330 PRINT "=";N;" IN BASE 10" 340 GOTO 640 400 PRINT "ENTER ARGUMENT IN BASE 10?"; 410 INPUT D 420 PRINT D 430 IF D=INT (ABS D) THEN GOTO 470 440 PRINT "BAD ENTRY" 450 PAUSE 200 460 RUN 470 LET K=0 480 LET K=K+1 485 LET F=D 490 LET D=INT (D/16) 500 LET E=F-16*D 510 LET B$(K)=CHR$ (E+28) 580 IF F>0 THEN GOTO 480 590 PRINT "="; 600 FOR I=1 TO K-1 610 PRINT B$(K-I); 620 NEXT I 630 PRINT " IN BASE 16" 640 PRINT " " 650 GOTO 30 10 REM "INTP" 30 INPUT A 50 INPUT B 60 INPUT C 70 INPUT D 80 INPUT E 90 LET F=(B-A)*(E-D)/(C-A)+D 100 PRINT F 110 GOTO 70 5 REM "LIN" 10 PRINT "THIS PROGRAM SOLVES" 20 PRINT "SIMULTANEOUS LINEAR" 30 PRINT "EQUATIONS (E) OR" 40 PRINT "INVERTS AN N*N MATRIX (I)" 50 PRINT 60 PRINT "WHICH ONE,(E) OR (I)? "; 70 INPUT Q$ 80 PRINT Q$ 90 IF Q$="E" THEN LET M=1 100 IF Q$="I" THEN LET M=2 110 IF M<>1 AND M<>2 THEN GOTO 60 120 PRINT 130 PRINT "GIVE SIZE? "; 140 INPUT N 150 PRINT N 160 IF M=1 THEN LET M=N+1 170 IF M=2 THEN LET M=2*N 180 DIM X(N,M) 190 SCROLL 200 PRINT "ENTER COEFFICIENTS" 205 SCROLL 210 IF M=N+1 THEN PRINT "AND OUTPUT ARRAY" 220 SCROLL 230 PRINT "ROW COLUMN" 240 SCROLL 250 FOR R=1 TO N 260 FOR C=1 TO N 270 PRINT " ";R;TAB 6;C, 280 INPUT X(R,C) 290 PRINT X(R,C) 295 SCROLL 300 NEXT C 310 IF M<>N+1 THEN GOTO 380 330 PRINT " ";R;" OUT", 350 INPUT X(R,M) 360 PRINT X(R,M) 370 GOTO 390 380 LET X(R,N+R)=1 390 SCROLL 400 NEXT R 410 SCROLL 420 PRINT "ANY CORRECTIONS (Y)?" 430 INPUT Q$ 440 IF Q$<>"Y" THEN GOTO 590 450 SCROLL 460 PRINT "WHICH ROW?"; 470 INPUT R 480 PRINT R 490 SCROLL 500 PRINT "WHICH COLUMN (OUT IS N+1)?"; 510 INPUT C 520 PRINT C 530 SCROLL 540 PRINT "ENTER VALUE "; 550 INPUT X(R,C) 560 PRINT X(R,C) 580 GOTO 410 590 CLS 600 REM FOWARD ELIMINATION 610 FOR C=1 TO N-1 620 LET A=0 630 IF X(C,C)<>0 THEN GOTO 730 640 FOR R=C+1 TO N 650 IF X(R,C)=0 THEN GOTO 720 660 FOR I=1 TO M 670 LET T=-X(R,I) 680 LET X(R,I)=X(C,I) 690 LET X(C,I)=T 700 NEXT I 710 GOTO 730 720 NEXT R 730 LET A=X(C,C) 740 IF A=0 THEN GOTO 1240 750 FOR R=C+1 TO N 760 LET B=X(R,C)/A 770 IF B=0 THEN GOTO 810 780 FOR I=C TO M 790 LET X(R,I)=X(R,I)-B*X(C,I) 800 NEXT I 810 NEXT R 820 NEXT C 830 REM CHECK DETERMINATE 840 LET D=1 850 FOR I=1 TO N 860 LET D=D*X(I,I) 870 NEXT I 880 IF D=0 THEN GOTO 1240 890 REM BACKWARD ELIMINATION 900 FOR C=N TO 2 STEP -1 910 LET A=X(C,C) 920 FOR R=C-1 TO 1 STEP -1 930 LET B=X(R,C)/A 940 FOR I=C TO M 950 LET X(R,I)=X(R,I)-B*X(C,I) 960 NEXT I 970 NEXT R 980 NEXT C 990 REM PRINT RESULTS 1000 IF M=2*N THEN GOTO 1100 1010 PRINT "THE INPUT ARRAY IS:" 1020 PRINT 1030 FOR I=1 TO N 1040 PRINT "X-";I;" = ";X(I,M)/X(I,I) 1050 NEXT I 1060 GOTO 1180 1100 PRINT "THE INVERTED MATRIX IS:" 1110 PRINT 1120 PRINT "ROW COLUMN" 1130 FOR R=1 TO N 1135 PRINT 1140 FOR C=1 TO N 1150 PRINT " ";R;TAB 7;C,X(R,N+C)/X(R,R) 1160 NEXT C 1170 NEXT R 1180 PRINT 1190 PRINT "DETERMINATE IS:",D 1200 PRINT 1205 PRINT "RUN AGAIN (Y)?" 1210 INPUT Q$ 1215 CLS 1220 IF Q$="Y" THEN RUN 1230 STOP 1240 PRINT "SINGULAR COEFFICIENT MATRIX" 1250 PRINT "NO UNIQUE SOLUTION" 1260 GOTO 1200 5 REM "LIN" 10 PRINT "THIS PROGRAM SOLVES" 20 PRINT "SIMULTANEOUS LINEAR" 30 PRINT "EQUATIONS (E) OR" 40 PRINT "INVERTS AN N*N MATRIX (I)" 50 PRINT 60 PRINT "WHICH ONE, (E) OR (I)?"; 70 INPUT Q$ 80 PRINT Q$ 90 IF Q$="E" THEN LET M=1 100 IF Q$="I" THEN LET M=2 110 IF M<>1 AND M<>2 THEN GOTO 60 120 PRINT 130 PRINT "GIVE SIZE? "; 140 INPUT N 150 PRINT N 160 IF M=1 THEN LET M=N+1 170 IF M=2 THEN LET M=2*N 180 DIM X(N,M) 190 SCROLL 200 PRINT "ENTER COEFFICIENTS" 205 SCROLL 210 IF M=N+1 THEN PRINT "AND OUTPUT ARRAY" 220 SCROLL 230 PRINT "ROW COLUMN" 240 SCROLL 250 FOR R=1 TO N 260 FOR C=1 TO N 270 PRINT " ";R;TAB 6;C, 280 INPUT X(R,C) 290 PRINT X(R,C) 295 SCROLL 300 NEXT C 310 IF M<>N+1 THEN GOTO 380 320 PRINT " ";R;" OUT", 350 INPUT X(R,M) 360 PRINT X(R,M) 370 GOTO 390 380 LET X(R,N+R)=1 390 SCROLL 400 NEXT R 410 SCROLL 420 PRINT "ANY CORRECTIONS (Y)?" 430 INPUT Q$ 440 IF Q$<>"Y" THEN GOTO 580 450 SCROLL 460 PRINT "WHICH ROW? "; 470 INPUT R 480 PRINT R 490 SCROLL 10 REM "NM" 20 PRINT "ENTER FUNCTION IN TERMS OF X" 30 INPUT F$ 40 PRINT "ENTER DERIVITIVE IN TERMS OF X" 50 INPUT G$ 60 PRINT "ENTER GUESS" 70 INPUT X 80 FAST 85 LET C=0 90 LET I=X-VAL F$/VAL G$ 95 LET C=C+1 100 IF ABS (I-X)<10E-9 THEN GOTO 130 110 LET X=I 120 GOTO 90 130 SLOW 140 PRINT "ZERO AT X=";X 150 PRINT "AFTER ";C;" INTERATIONS" 10 REM "PFD" 20 CLS 25 LET K=0 27 LET D=0 30 DIM B(50) 40 PRINT "PRIME FACTOR FINDER" 50 PRINT "ENTER NUMBER?"; 60 INPUT A 70 PRINT A 80 LET F=A 90 IF A=INT A AND A>1 AND A<1E9 THEN GOTO 120 100 PRINT "ERROR, REENTER" 110 GOTO 50 120 LET E=A/2 130 LET C=2 140 IF E<>INT E OR 2*ESQR A THEN GOTO 250 200 LET E=A/C 210 IF E<>INT E OR E*C<>A THEN GOTO 170 220 LET D=D-1 230 GOSUB 320 240 GOTO 170 250 IF A<=1 THEN GOTO 280 260 LET K=K+1 270 LET B(K)=A 280 PRINT "NO. OF FACTORS=";K 290 FOR I=1 TO K 300 PRINT "FACTOR NO. ";I;"=";B(I) 310 NEXT I 312 PRINT " " 315 GOTO 25 320 IF K>=50 THEN RETURN 330 LET K=K+1 340 LET B(K)=C 350 LET A=E 360 RETURN 10 REM "PL" 20 PRINT "ENTER FUNCTION IN TERMS OF X" 30 INPUT A$ 40 PRINT "ENTER LOWER LIMIT" 50 INPUT B 60 PRINT "ENTER UPPER LIMIT" 70 INPUT C 80 PRINT "ENTER INCREMENT" 90 INPUT D 100 FAST 110 CLS 120 PRINT "X","F(X)" 130 PRINT "------------------------------" 140 FOR X=B TO C STEP D 150 PRINT X,VAL A$ 160 NEXT X 165 SLOW 170 PRINT "ENTER 1 TO CONTINUE, 2 TO STOP " 190 IF INKEY$="1" THEN GOTO 210 195 IF INKEY$="2" THEN STOP 200 GOTO 190 210 CLS 220 SLOW 230 GOTO 40 0 REM ' .LN %M"' ' .LN %M"' ',LN %M"' ''0LN %M"' . 1LN %M"' : /LN %M"' .',LN %M"' :'*LN %M"' ##3LN %M"' ,,-LN %M"' ~~4LN %M"' "1LN %M"' £=LN %M"' $/LN %M"' :4LN %M"' ?8LN %M"' (4LN %M"' );LN %M"' >LN %M"' 9?LN %M"' A£LN %M"' B,,LN %M"' C:'LN %M"' D: LN %M"' E''LN %M"' F 'LN %M"' G' LN %M"' H LN %M"' I LN %M"' J LN %M"' K LN %M"' L' LN %M"' M' LN %M"' N 'LN %M"' O''LN %M"' P. LN %M"' Q: LN %M"' R:'LN %M"' S##LN %M"' T~~LN %M"' U"LN %M"' V$LN %M"' W?LN %M"' X(LN %M"' Y>LN %M"' Z=LN %M"TAN AA 2 FAST 3 FOR L=SGN PI TO 44 4 PRINT "% % % % % % % % % % % % % % % % "; 5 NEXT L 6 SLOW 10 INPUT A$ 14 LET N=VAL "16514" 15 LET T=PI+PI 20 INPUT X 25 LET X1=X 30 INPUT A 35 FAST 40 LET DX=(A-X)/VAL "63" 50 LET H=VAL A$ 60 LET L=H 70 FOR I=SGN PI TO CODE "RND" 75 LET Z=VAL A$ 80 IF HZ THEN LET L=Z 100 LET X=X+DX 110 NEXT I 120 LET X=X1 130 FOR I=NOT PI TO CODE "Z" 132 POKE N+SGN PI,I 133 POKE N+VAL "2",VAL "43-(H-VAL A$)/(H-L)*43" 135 LET X=X+DX 140 LET N=N+VAL "6" 150 NEXT I 170 SLOW 500 UNPLOT NOT USR VAL "16514",RND 600 GOTO PI*PI 9900 FOR L=1 TO 20 9905 LPRINT " *** SUPER FN PLOT ***",,, 9910 LLIST 9920 LPRINT ,,,,,,,, 9930 NEXT L 9999 REM WELCOME TO SUPER FNPLOT. WHEN YOU RUN THE PROGRAM,THE COMPUTER WILL REQUEST THREEINPUTS. ANSWER THE FIRST WITH AFUNCTION, SUCH AS "SIN X" OR "X*X+5*X-3". THE NEXT TWO INPUTSARE THE LOWER AND UPPER LIMITS,RESPECTIVELY, ON "X" IN THEFUNCTION. IF YOU WERE USING"SIN X", THEN YOU MIGHT WANT TOUSE THE LIMITS OF 0 AND 2*PI. ASAN ADDED CONVEINANCE, THE LETTER"T" CAN BE SUBSTITUTED FOR 2*PI.AFTER PLOTTING THE FIRST FN, TRYTHIS: STOP THE PROGRAM AND TYPE"RAND USR 16514" AND THE SAME FNWILL BE RAPIDLY PLOTTED. THIS ISBECAUSE THE PROGRAM COMPILES AMACHINE CODE ROUTINE AT 16514THAT IS 386 BYTES LONG. THOSEOF YOU WHO HAVE EPROM/CMOS/64KMEMORIES MAY WANT TO RELOCATETHE MC TO WHERE IT CAN BE CALLED LATER. 5 REM "PRIME" 10 FOR A=3 TO 999 STEP 2 20 FOR B=3 TO A/2 STEP 2 30 IF A/B=INT (A/B) THEN GOTO 60 40 NEXT B 50 PRINT A;" "; 60 NEXT A 10 REM "QUAD" 20 PRINT "INPUT COEFFICIENTS" 30 INPUT A 40 INPUT B 50 INPUT C 60 LET D=(ABS B)**2-4*A*C 70 IF D<0 THEN GOTO 120 80 LET R1=(-B+SQR D)/(2*A) 90 LET R2=(-B-SQR D)/(2*A) 100 PRINT "ROOTS ARE ";R1;TAB 10;R2 110 STOP 120 PRINT "ROOTS COMPLEX" 130 LET D=ABS D 140 LET E=2*A 150 LET F=-B/E 160 LET G=SQR D/E 170 PRINT F;" +/- ";G;" J" 10 REM "SIM" 20 PRINT "ENTER FUNCTION" 30 INPUT F$ 40 PRINT "ENTER LOWER LIMIT" 50 INPUT A 60 PRINT "ENTER UPPER LIMIT" 70 INPUT B 80 PRINT "ENTER NUMBER OF DIVISIONS" 90 INPUT N 95 LET N=N*2 100 LET X=A 110 LET Y=VAL F$ 120 LET X=B 130 LET Y=VAL F$+Y 140 LET C=2*(B-A)/N 145 LET Y1=0 150 FOR X=A+C/2 TO B STEP C 160 LET Y1=VAL F$+Y1 170 NEXT X 175 LET Y2=0 180 FOR X=A+C TO B-C/2 STEP C 190 LET Y2=VAL F$+Y2 200 NEXT X 205 LET Y=Y+4*Y1+2*Y2 210 LET IN=Y*(B-A)/(3*N) 220 PRINT "INTEGRAL= ";IN ```