--- title: "Inductive Formulas" id: 71773 type: "computer_media" slug: "inductive-formulas" url: "http://localhost/computer_media/inductive-formulas/" markdown_url: "http://localhost/computer_media/inductive-formulas.md" published_at: "2026-10-06T09:04:21+00:00" modified_at: "2026-10-06T09:04:22+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/inductive-formulas.png" excerpt: "A seven-function inductive electronics calculator covering coil Q, XL, impedance, and resonance — complete with a hand-coded iterative square-root routine." 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 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Bob Swoger (K9WVY)" slug: "bob-swoger" taxonomy: "indiv" url: "http://localhost/indiv/bob-swoger/" genre: - name: "Engineering" slug: "engineering" taxonomy: "genre" url: "http://localhost/type/engineering/" media_type: "Program" programmers: - name: "Bob Swoger (K9WVY)" slug: "bob-swoger" taxonomy: "indiv" url: "http://localhost/indiv/bob-swoger/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Inductive%20Formulas%20(198x)(Swoger%2C%20Bob)(TS2068)(US)(Program).zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/10/inductive-formulas.png" media_type_tags: "Engineering" --- # Inductive Formulas This program calculates seven inductive formulas useful in electronics design, covering instantaneous voltage, single-layer coil inductance, L/R time constants, series and parallel inductors, coil Q factor, inductive reactance (XL), and the impedance of inductive/resistive circuits. Menu selection is stored in variable F but the branch logic erroneously tests variable U (which is never assigned), meaning formula dispatch never works as intended. A custom iterative square-root subroutine at line 3030 uses Newton’s method, converging by checking when successive corrections W equal zero or repeat, since the platform lacks a built-in SQR function. Unit conversions between millihenries and henries (dividing by 1E3) and microfarads and farads (dividing by 1E6) are handled inline throughout the calculation routines. ### Program Structure The program presents a numbered menu (lines 10–90) for seven inductive formulas, accepts a selection via `INPUT` at line 100, and then is supposed to branch to the appropriate calculation routine. The calculation blocks are spread across lines 120–590, followed by a standalone square-root subroutine at lines 3010–3090. Line 9992 provides a `SAVE` with auto-run, and line 9999 loops back to line 80 (the last menu item print) via `GO TO VAL "80"`. ### Critical Bug: Variable Mismatch in Dispatch The user’s menu choice is read into variable `F` at line 100, but the branch conditions at lines 120–150 all test variable `U`, which is never assigned anywhere in the program. As a result, `U` will always be zero, none of the `IF U=...` branches will trigger, and execution falls through unconditionally to line 170 — the resonant frequency calculation block — regardless of which formula the user selects. All seven formula paths are effectively unreachable except that one. The correct variable in each condition should be `F`. ### Incomplete Dispatch Table Even if the variable were corrected, the dispatch logic is incomplete. The menu advertises seven formulas (#1 through #7), but the branch table only covers cases 3, 4, 5, and 6 (lines 120–150). There are no branches for selections 1, 2, or 7, and line 110 carries only a `REM` comment reading “LEFT OFF HERE,” suggesting the program was never finished. The blocks starting at lines 520–590 (labeled in the code for formula #7, impedance) are present but unreachable via any corrected dispatch. ### Square-Root Subroutine Because the platform lacks a native `SQR` function, a Newton’s-method iterative square-root routine occupies lines 3010–3090. It takes input in `X` and returns the result in `Y`, using `W` and `Z` as internal working variables. 1. Line 3030 short-circuits for `X=0`, returning `Y=0` immediately. 2. Line 3040–3050 guards against negative inputs, printing an error and halting. 3. Line 3060 seeds the initial estimate as `Y = X * 0.5`. 4. Line 3070 computes the Newton correction: `W = (X/Y - Y) * 0.5`. 5. Line 3080 terminates when `W=0` (converged) or `W=Z` (oscillating between two values), then returns. 6. Line 3090 updates `Y` and saves the previous correction in `Z` before looping. Note that line 3030 uses the literal character `O` (letter O) rather than the digit `0` for the zero comparisons and assignment. On this platform, an uninitialized string variable named `O` would cause an error, but if `O` is treated as a numeric variable it defaults to zero — so the routine works accidentally but is technically a coding error. ### Unit Handling All electrical unit conversions are performed inline. Inductance values entered in millihenries are converted to henries by dividing by `1E3`, and capacitance values in microfarads are converted to farads by dividing by `1E6`. Results are scaled back to display units before printing (e.g., `L*1E3`, `C*1E6`). ### Notable Idioms and Observations - `GO TO VAL "80"` at line 9999 is a memory-saving idiom substituting a string literal for a numeric constant in the branch target. - The resonant frequency formula at line 230 uses the constant 159 (approximation of 1/(2π) × 1000, accounting for the mH/µF unit scaling) rather than computing `1/(2*PI*SQR(LC))` explicitly, leveraging the custom subroutine output `Y`. - Lines 235, 275, 315, 350, 430, 470, 510, 590, 3000, and 9989 all use `STOP` to terminate execution after each formula, preventing fall-through between blocks. - The Q-of-circuit section (lines 360–510) uses `INPUT` with a prompt asking the user to type `Q`, `F`, or `B` as a letter, then compares the input to the BASIC variables `Q`, `F`, and `B` — a creative but fragile technique that depends on those variables being zero (their default) so the comparison resolves correctly only when the user enters `0`. ## Source Code ``` 1 REM \{20}\{1}INDUCTIVE FORMULAS BY ROY BABYLON POPULAR ELECTRONICS AUG 1979 PAGE 47\{20}\{0} 5 CLS 10 PRINT "AFTER EACH SOLUTION, PRESS R, ENTER TO BEGIN." 20 PRINT "ENTER THE NUMBER NEXT TO THE DESIRED FUNCTION" 30 PRINT "INSTANTANEOUS VOLTAGE #1" 40 PRINT "INDUCTANCE OF A SINGLE LAYER COIL #2" 50 PRINT "INDUCTIVE/RESISTIVE TIME CONSTANT #3" 60 PRINT "SERIES AND PARALLEL INDUCTORS #4" 70 PRINT "Q OF A COIL #5" 80 PRINT "INDUCTIVE REACTANCE(XL) #6" 90 PRINT "IMPEDANCE OF INDUCTIVE/RESISTIVE CIRCUIT #7" 100 INPUT "FORMULA DESIRED";F 110 REM ****LEFT OFF HERE 120 IF U=3 THEN GO TO 280 130 IF U=4 THEN GO TO 320 140 IF U=5 THEN GO TO 360 150 IF U=6 THEN GO TO 520 170 INPUT "ENTER VALUE OF INDUCTOR IN MILLIHENRIES";L 180 INPUT "ENTER VALUE OF CAPACITOR IN MICROFARADS";C 210 LET X=(L/1E3)*(C/1E6) 220 GO SUB 3030 230 PRINT "THE RESONANT FREQUENCY IS";159/Y;"HERTZ" 235 STOP 240 INPUT "ENTER RESONANT FREQUENCY(FO)DESIRED";F 250 INPUT "ENTER CAPACITOR VALUE IN MICROFARADS";C 260 LET L=.0254/(F*F)*(C/1E6) 270 PRINT "THE INDUCTOR NEEDED IS ";L*1E3;"MILLIHENRIES" 275 STOP 280 INPUT "ENTER RESONANT FREQUENCY(FO)DESIRED";F 290 INPUT "ENTER INDUCTOR VALUE IN MILLIHENRIES";L 300 LET C=.0254/(F*F)*(L/1E3) 310 PRINT "THE CAPACITOR NEEDED IS ";C*1E6;"MICROFARADS" 315 STOP 320 PRINT "ENTER THE REACTANCE(XC OR XL)IN OHMS";X 330 PRINT "ENTER THE SERIES RESISTANCE IN OHMS";R 340 PRINT "THE Q OF THE CIRCUIT IS";X/R;"UNITS" 350 STOP 360 INPUT "ENTER UNKNOWN, Q=Q, FO=F,BW=B";X 370 IF X=Q THEN GO TO 400 380 IF X=F THEN GO TO 440 390 IF X=B THEN GO TO 480 400 INPUT "ENTER FO IN HERTZ";F 410 INPUT "ENTER BW(F2-F1)IN HERTZ";B 420 PRINT "THE Q IS EQUAL TO ";F/B;"UNITS" 430 STOP 440 INPUT "ENTER THE Q OF THE CIRCUIT";Q 450 INPUT "ENTER BW(F2-F1)IN HERTZ";B 460 PRINT "THE RESONANT FREQUENCY(FO)IS";Q*B;"HERTZ" 470 STOP 480 INPUT "ENTER RESONANT FREQUENCY(FO)IN HERTZ";F 490 INPUT "ENTER THE Q VALUE";Q 500 PRINT "THE BANDWIDTH IS";F/Q;"HERTZ" 510 STOP 520 INPUT "ENTER VALUE OF INDUCTOR IN MILLIHENRIES";L 530 INPUT "ENTER FREQUENCY(FO)IN HERTZ";F 540 INPUT "ENTER RESISTOR VALUE IN OHMS";R 550 PRINT "AT SERIES RESONANCE,XL AND XC CANCEL THEREFORE Z=";R 560 LET P=(2* PI)*(F)*(L/1E3) 570 LET Q=P/R 580 PRINT "THE PARALLEL IMPEDANCE IS EQUAL TO";P*Q;"OHMS" 590 STOP 3000 STOP 3010 REM *SQUARE ROOT*INPUT X,OUTPUT Y 3020 REM ALSO USES W&Z INTERNALLY 3030 IF X=O THEN LET Y=O:RETURN 3040 IF X>O THEN GO TO 3060 3050 PRINT "ROOT OF NEGATIVE NUMBER?":STOP 3060 LET Y=X*.5:LET Z=O 3070 LET W=(X/Y-Y)*.5 3080 IF (W=O)+(W=Z) THEN RETURN 3090 LET Y=Y+W:LET Z=W:GO TO 3070 9989 STOP 9992 SAVE "INDUCT.B1" LINE SGN PI 9998 REM 9999 GO TO VAL "80" ```