Quadratic Formula Program, QUAD1

The web page quad.htm presents and describes a program, QUAD, that performs the "quadratic formula" for solving certain quadratic equations of the form

Ax2 + Bx + C = 0
where we are assuming that A, B, and C are integers, and that A is not 0. As noted at the end of that page, the output of the program is correct. However, for irrational answers the QUAD program only produces approximations to the correct answers. This page presents a listing of a new version of that program, called QUAD1, a version that produces nice looking output, even for irrational answers. The listings below are for the TI-83 version of the QUAD1 program, given in two parts, modified with the tracing lines on the left to help you identify the ranges of the the IF-THEN constructs in the program, along with the FOR structure.
QUAD1, part 1 QUAD1, part 2

A comparison of part 1 of the QUAD1 program with the QUAD program given on the earlier quad.htm page, should confirm that the main part of the program is unchanged from one version to the other. The extra lines in QUAD1 are used to format the output of the program so that it looks nicer. Also, notice that the QUAD program calls (makes reference to) the TOSTR program in order to acheive a nicer looking output. TOSTR must be available on the calculator. The listing for the TOSTR program, was given on the trifact2.htm page.

Naturally, one could enter the programs into a calculator. However, the TI-83 file for QUAD1 in is available at quad1.83p and the TI-83 file for TOSTR at tostr.83p. Similar files are available for the quad1.85p program on the TI-85, the tostr.85p program on the TI-85, the quad1 program on the TI-86, and the tostr.86p program on the TI-86 Depending upon your browser, you should be able to save the file to your disk and then transfer it via TI-Graphlink, assuming you have the program and the required cable.

We conclude this page with few sample runs of the TI-83 version of the QUAD1 program. We will be solving the following quadratic equations:

x2 + 6x + 9 = 0
x2 + 7x + 10 = 0
x2 + 3x - 10 = 0
12x2 - 19x - 18 = 0
91x2 - 32x - 48 = 0
x2 - 6x + 7 = 0
25x2 + 40x + 9 = 0

Figure 1
We open the PRGM menu by pressing the key and then moving, if need be, to find the QUAD1 program. On the calculator used here the QUAD1 program is in position 7. We can press the key to select that program and to move to Figure 2.
Figure 2
All that has been accomplished is to paste the command prgmQUAD1 onto the screen. We will have to press the key to actually start to run the program.
Figure 3
In Figure 3 the program has started. The calculator has asked for, and we have supplied, values for the coefficients A, B, and C. We have entered the value 1 for A, 6 for B and the value 9 for C. These are the coefficients for
X2 + 6X + 9 = 0
The calculator is waiting for us to press to accept the value for C and to move on with the program.
Figure 4
Figure 4 shows output from the calculator. It writes the word DISCRIMINANT followed, on the next line, by the value of the discriminant. Recall that the discriminant for
AX2 + BX + C = 0
is
B2 - 4 A C
In our case that is 0. Then, becuase the discriminant is zero, there will be exactly one solution to the quadratic equation. The calculator tells us that there is one solution, and then it gives us the value of that solution. In Figure 4 that value is -3.
Figure 5
The program was completed in Figure 4. To restart it, we press . Figure 5 gives the data entry for the problem
X2 + 7X + 10 = 0
Figure 6
To accept our final value and continue the program we press . Figure 6 gives the result. This time the discriminant has the value 9. Because the discriminant is positive there will be two solutions. The program goes on to show those solutions, namely,
-2 and -5.
After giving us the numeric value of the answers, the program announces that we have "RATIONAL" answers. Therefore, the answers given are the answers, not merely approximations to the answers. Again, the "Done" indicates that the program has completed.
Figure 7
In Figure 7 we have restarted the program by pressing the key. This time we are working on the problem
x2 + 3x - 10 = 0
We have entered the coefficients. Note the negative sign for the minus ten.
Figure 8
Pressing the key to accept our last input value, the program generates the information seen in Figure 8. In particular, we see that the value of the discriminant is 49, that there are two answers, that the two answers are 2 and -5, and that these are rational values. Again, the program is "Done" running.
Figure 9
In Figure 9 we have restarted the program by pressing the key. This time we are working on the problem
12x2 - 19x - 18 = 0
We have entered the coefficients.
Figure 10
Again, we press to contiue with the program. Figure 10 shows the discriminant to be 1225 (which is 352), that there are two answers, that the two answers are
9/4 and -2/3
and that these are RATIONAL answers.
Figure 11
In Figure 11 we have started the program again, this time to solve the problem
91x2 - 32x + 48 = 0
Figure 12
The program finds the discriminant, finds that there are two answers, gives those values, and points out that the answers are RATIONAL ANSWERS.
Figure 13
In Figure 13 we have started the program again, this time to solve the problem
x2 - 6x + 7 = 0
Figure 14
We press the key to leave Figure 13 and move to Figure 14. Here we see that the value of the discriminant is 8, and that there are two solutions, and we are given some approximations to the values of those answers. In this case, the discriminant is not a perfect square. Therefore, the solutions will not be rational, but rather they are IRRATIONAL ANSWERS. The program points this out, and then waits for us to press the key again to GO ON with the program.
Figure 15
In Figure 14 we found out that the value of the discriminant was 8. Thus, from the quadratic formula,we know that the solutions are
(-B+sqrt(B2-4AC)) / (2A) and
(-B-sqrt(B2-4AC)) / (2A)
For this particular problem, that becomes
(6+sqrt((-6)2-4*1*7)) / (2*1) and
(6-sqrt((-6)2-4*1*7)) / (2*1)
or
(6+sqrt(36-28)) / 2 and
(6-sqrt(36=28)) / 2
or
(6+sqrt(8)) / 2 and
(6-sqrt(8)) / 2
These are irrational values. In Figure 14 the program gave us numeric approximations to these values. Now, in Figure 15, the program gives us the exact solutions, namely,
(3+sqrt(2)) and (3-sqrt(2))
Figure 16
In Figure 16 we have started the program again, this time to solve the problem
25x2 + 40x + 9 = 0
Figure 17
We leave Figure 16 by accepting the final value with the key. Figure 17 shows the calculated value of 700 for the discriminant. With a positive discriminant the program declares that there are two solutions, and it presents the two approximations to the solutions, pointing out that the exact values are IRRATIONAL numbers. The program then waits for us to press the key again to "GO ON".
Figure 18
In Figure 18 we se the program display of the exact answers, namely,
(-4+sqrt(7)) / 5 and
(-4-sqrt(7)) / 5

©Roger M. Palay
Saline, MI 48176
August, 2010