For the TS 2068 or the TS1000/ZX81
From the book “Small User’s Math“
The famous quadratic formula allows an easy and direct solution of any quadratic equation in the standard form ax² + bx + c = 0. The formula computes the two roots of this equation in terms of the coefficients a, b, and c:

THE PROGRAM
The program uses equation (1) above to compute the roots of the equation ax² + bx + c = 0. Provisions are made to allow complex and double root as well as real, distinct root computation, with a message indicating which category a particular problem falls into.
In order to use the program, the “RUN” mode is entered. Immediately, the program prompts “INPUT A”, “INPUT B”, and “INPUT C”, corresponding to the a, b, and c of the quadratic equation in standard form, respectively. Once these are entered, the program executes and prints out the answer(s).
10 REM QUADRTC
20 REM THIS PROGRAM SOLVES
30 REM A QUADRATIC EQUATION
40 PRINT "INPUT A"
50 INPUT A
60 PRINT "INPUT B"
70 INPUT B
80 PRINT "INPUT C"
90 INPUT C
95 CLS
100 LET D=-B/(2*A)
110 REM COMPUTE DISCRIMINANT
120 LET DSCRM=B*B-4*A*C
130 IF DSCRM>=0 THEN GOTO 180
135 PRINT "THE ROOTS ARE COMPLEX:"
140 LET DSCRM=-DSCRM
145 LET R=(SQR (DSCRM))/(2*A)
150 PRINT D;"+";R;"*I"
155 PRINT D;"-";R;"*I"
160 GOTO 300
180 IF DSCRM>0 THEN GOTO 205
185 PRINT "THERE IS A DOUBLE ROOT"
190 PRINT D
200 GOTO 300
205 PRINT "THERE ARE TWO REAL ROOTS"
210 LET R=((SQR DSCRM))/(2*A)
220 PRINT D+R;" ";D-R
300 STOP
EXAMPLE
Find the roots of 3x² – 4x + 1 = 0. Enter the “RUN” mode. The prompt “INPUT A” is responded to by entering 3. The next prompt “INPUT B” is answered by putting in -4. The final prompt “INPUT C” is responded to by entering 1. The answer then appears:
THERE ARE TWO REAL ROOTS 1 0.3333333
EXAMPLE
Find the roots of x² – x + 4 = 0. Enter the “RUN” mode. Here, A = 1, B = -1, and C = 4. These values are entered in their turn. The answer appears:
THE ROOTS ARE COMPLEX: 0.5 + 1.9365*I 0.5 - 1.9365*I
[Ed. Note: This article is an excerpt from the book “Small User’s Math” or “S.U.M.” by Ken Lewis, former TS Horizons author. S.U.M. includes several curve-fitting programs, some powerful matrix programs, programs for solving differential equations, and more.]
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.