Karla News

Program Your TI84, Lesson 6: Solving Quadratic Equation

If you want to save time on your high school math homework using this TI-84 Calculator Program to find vertex of a quadratic equation. You have found the right article. The double slash “//” is a comment mark and that tells you what the calculator is doing in the program. These comments are not meant to be placed in the program.

Here is how this article works:

1. All BOLD type is what is meant to be typed into your calculator inside the program
2. // Introduce comments, these are not meant to be put into the calculator and are only there to explain what is going on.
3. // *** Program Start *** // & // *** Program End *** // Tell you when to start entering code and when to stop. The program name is included.
a. Try to use the same program names that way you can just copy my code without having to worry about changing all the names to work
4. The code will show up twice, once with the comments in them to show you how it works and again at the end without the comments so you can just copy the code into your calculator.
5. At the end of the Article you will find a tutorial guide on where to find certain calculator key strokes as well as other functions that I have created.
a. If I have created another function for another tutorial I will not retype it here, I will simply link to my other article and you can copy it from that one.
6. If you input a problem and it does not work out correctly please message me so I can update or change the code.
7. Just a note about naming conventions, I use my own naming conventions that make sense to me to keep things organized. It would be much easier if you used the same function names but it is not necessary.

// *** FQuadSol Start *** //
// FQuadSol accepts user input in the form of the coefficients of a quadratic formula
// Using the discriminant the calculator will then print out the solutions
// the quadratic equation will have as if it were completely solved.
// Most of the calculator out put will be on the graph screen where the pixels are smaller
// so more text can be fit, AxesOff turns of the x and y axes, the ClrDraw erases anything
// Left there from previous programs and ClrHome clears the regular calc screen

AxesOff
ClrDraw
Text( 1, 1, “Input the Coefficients” )

// This is a pause moment, the user will need to hit a key to move on
prgmZGetKey

// The calculator then asks the user for the coefficients stored in the same variable as the
// Quadratic equation
ClrHome
Input “A: “, A
Input “B: “, B
Input “C: “, C
ClrDraw
0 => N

// This portion will print out the quadratic equation so one does not forget which equation
// They put into the calculator, not necessary, but a nice feature
// Negative signs must be done separately because of space concerns. The N variable is
// the Horizontal spacer, most characters are 3 pixels plus 1 for a space, we increment
// N so we can place the next character in line with out overlaying the first one.

Text( 1, N, “Y=”)
(N + 8) => N

// The next three if statements do the same thing. First checking if the Coefficient is
// Negative, if it is it places a negative sign, then puts the number using the absolute
// value function to make sure no stray negatives mess up spacing and then the
// Program calls FSIZE which counts the number of digits in the value and spaces
// according to that, so if A is a 3 digit number it would space 12 not just 4.

If ( A < 0 )
Then
Text( 1, N, “-” )
(N + 4) => N
End

Text( 1, N, abs(A) )

If ( A = 0 )
Then
(N+ 4) => N
Else
abs(A) => H
prgmFSIZE
End

Text( 1, N, “X2“)
(N + 8) => N

If ( B < 0 )
Then
Text(1, N, “-“)
Else
Text( 1, N, “+”)
End
(N+4) => N
Text( 1, N, abs(B) )

If ( B = 0 )
Then
(N+ 4) => N
Else
abs(B) => H
prgmFSIZE
End

Text( 1, N, “X”)
(N + 4) => N

If ( C < 0 )
Then
Text(1, N, “-“)
Else
Text( 1, N, “+”)
End
(N+4) => N
Text( 1, N, abs(C) )

0 = > N

Text( 37, 1, “This Quadratic Equation’s Solutions are: “)

// E is the discriminant used to evaluate what type of solution there is, 1 real, 2 real or 2
// Imaginary depending on the type of value E is, there may also be radicals, or I’s for
// Imaginary solutions
// W is a flag, since we don’t want to mess with negative numbers, if W = 1, that means
// E was negative and there for there are imaginary solutions
(B2 – 4AC ) => E
0 => W

// If E is 0 there is just one solution
If ( E = 0 )
Then
abs(K) => K
(2A) => L

// K and L will be sent to Reduce and be reduced as a fraction should
prgmFREDUCE

Text( 43, N, “X=”)
(N + 8) => N

// This checks to see if the solution is positive or negative, remember we place
// Negatives on purpose because if we didn’t they would mess up the spacing
If (( (-B) / (2A)) < 0 )
Then
Text( 43, N, “-“)
(N +4) => N
End

Text( 43, N, K )
If ( K = 0 )
Then
(N + 4) => N
Else

// This will count the digits in K as to get the correct spacing
K => H
prgmFSIZE
End

// If L > 1 that means the solution is a fraction, so we need to display it as so
If ( abs(L) > 1 )
Then
Text( 43, N, “/” )
(N + 4) => N
Text( 43, N, abs(L) )
If ( L = 0 )
Then
( N + 4 ) => N
Else
L => H
prgmFSIZE
End

Else

// If E is negative we check it out, set our flag and then make E positive to make it easier
// to work with
If ( E < 0 )
Then
1 => W
abs(E) => E
End
prgmFSQRT

// If W is 0 that means E was positive and there are two real solutions, there are however
// two possibilities, first, the solutions could be non radical and simplify to a fraction or
// integer value, OR the radical might be there, both of these are taken into account.
// G is the radicand and there for the value under the radical, if G is one that means
// E was a perfect square and can be reduced with no radical left over.
If ( W = 0 )
Then

If ( G = 1 )
Then
43 => U

// There are minor changes in the two solutions of a quadratic, namely one is plus and the
// Other minus. By using a while loop we do not have to copy the entire set of Code twice
// U is the vertical spacing position and also serves as the loop trigger, when the first loop
// Is done and the first solution displayed it will cycle back through increment the vertical
// Spacer ( U ) and display the second solution
While ( U LTE 0 )
0 => N

// The first time U will = 43, meaning that the solution is the positive, then it will cycle
// back through and make it the negative
If ( U = 43 )
Then
( -B + F ) => K
Else
( -B – F ) => K
End
(2A) => L

// Checking to see if the solution needs to be negative, Z is the flag this time
If ( (K/L) < 0 )
Then
1 => Z
End
prgmFREDUCE

// The output portion, displaying on the screen
Text( U, N, “X=”)
(N + 8) => N

If ( Z = 1 )
Then
Text( U, N, “-” )
(N + 4) => N
End
0 => Z

Text( U, N, K )
K => H
prgmFSIZE

If ( abs(L) > 1 )
Then
Text( U, N, “/” )
(N + 4) => N
Text( U, N, abs(L) )
L => H
prgmFSIZE
End

( N + 4 ) => N
( U + 6 ) => U
End

Else
// This is the other half of the 2 real solutions. If there is supposed to be a radical in the
// Answer the only thing that can be done is the fraction reduced and that is done
// By finding the GCF here with the gcd function, and then displaying the different parts
gcd(abs(B), F) => K
(2A) => L
43 => U

// This takes the GCF from the top of the Quadratic formula, and reduces it with the
// 2A from the bottom, if there are any numbers to be distributed back in, the
// Multiplication after the FREDUCE function will make sure of that.
If ( K > 1 )
Then
(B/K) => B
(F/K) => F
prgmFREDUCE
(B*K) => B
(F*K) => F
End

// Now that everything else is figured out, its just a matter of displaying, this while loop
// is the same, its starts out at the 43 vertical pixel, checks to make sure if anything is
// Negative, and outputs the quadratic formula in radical form with simplified radicals
// and reduced fractions
While ( U LTE 0 )
0 => N

Text( U, N, “X=” )
(N + 8) => N

If (( (-B) / (2A)) < 0 )
Then
Text( U, N, “-” )
(N + 4) => N
End

Text( U, N, abs(B) )
B => H
prgmFSIZE

If ( U = 43 )
Then
Text( U, N, “+” )
Else
Text( U, N, “-” )
End
(N + 4) => N

If ( F > 1 )
Then
Text( U, N, F )
F => H
prgmFSIZE
End

Text( U, N, “sqrt(” )
(N + 7) => N
Text( U, N, G )
(N + 4) => N
G => H
prgmFSIZE
Text( U, N, “)” )
(N + 4) => N

If ( abs(L) > 1 )
Then
Text( U, N, “/”)
(N + 4) => N
Text( U, N, abs(L) )
L => H
prgmFSIZE
End
( U + 6 ) => U

End
End

Else
// This is the same as the 2 real solutions with radicals as above. Because in no instance
// Can a real and imaginary number be combined, so this loop takes care of both solutions
// Whether there is a radical or not. The only difference is that W = 1, which means the
// Solutions are imaginary, and you will see a little further down where I stuck the i.
// in addition, below the I, is the sqrt with the radicand. If G is 1, nothing is printed
// But if a radical must be used, then it is output with the rest of the problem.
// again, The radical is reduced and the fraction simplified.
gcd( abs(B), F) => K
(2A) => L
43 => U

If ( K > 1 )
Then
(B/K) => B
(F/K) => F
prgmFREDUCE
(B*K) => B
(F*K) => F
End

While ( ULTE 0 )
0 => N

Text( U, N, “X=” )
(N + 8) => N

// Checks if the solution is positive or negative, this also takes into account a -A
If (( (-B) / (2A)) < 0 )
Then
Text( U, N, “-” )
(N + 4) => N
End

Text( U, N, abs(B) )
B => H
prgmFSIZE

// This is the PLUS MINUS portion of the quadratic formula
If ( U = 43 )
Then
Text( U, N, “+” )
Else
Text( U, N, “-” )
End
(N + 4) => N

// if the radical could be simplified F is the number outside, showing only if it is not 1
If ( F > 1 )
Then
Text( U, N, F )
F => H
prgmFSIZE
End

// All these solutions in this part of the program are imaginary so the I must be shown
Text( U, N, “i” )
(N + 4) => N

// If E wasn’t a perfect square then a G should be left as a radicand, only if it is not 1 will
// it out put to the computer screen
If ( G > 1 )
Then
Text( U, N, “sqrt(” )
(N + 7) => N
Text( U, N, G )
G => H
prgmFSIZE
Text( U, N, “)” )
( N + 4 ) => N
End

// Displaying a fraction answer if the denominator is not 1
If ( abs(L) > 1 )
Then
Text( U, N, “/”)
(N + 4) => N
Text( U, N, abs(L) )
L => H
prgmFSIZE
End
( U + 6 ) => U

End
End
End

// *** FQuadSol End *** //

This program is complete, further on you will find the code so it is not messed with comments so you may find it easier to read and to copy.

// *** FQuadSol Start *** //
AxesOff
ClrDraw
Text( 1, 1, “Input the Coefficients” )

prgmZGetKey

ClrHome
Input “A: “, A
Input “B: “, B
Input “C: “, C
ClrDraw
0 => N

Text( 1, N, “Y=”)
(N + 8) => N

If ( A < 0 )
Then
Text( 1, N, “-” )
(N + 4) => N
End

Text( 1, N, abs(A) )

If ( A = 0 )
Then
(N+ 4) => N
Else
abs(A) => H
prgmFSIZE
End

Text( 1, N, “X2“)
(N + 8) => N

If ( B < 0 )
Then
Text(1, N, “-“)
Else
Text( 1, N, “+”)
End
(N+4) => N
Text( 1, N, abs(B) )

If ( B = 0 )
Then
(N+ 4) => N
Else
abs(B) => H
prgmFSIZE
End

Text( 1, N, “X”)
(N + 4) => N

If ( C < 0 )
Then
Text(1, N, “-“)
Else
Text( 1, N, “+”)
End
(N+4) => N
Text( 1, N, abs(C) )

0 = > N

Text( 37, 1, “This Quadratic Equation’s Solutions are: “)

(B2 – 4AC ) => E
0 => W

If ( E = 0 )
Then
abs(K) => K
(2A) => L
prgmFREDUCE

Text( 43, N, “X=”)
(N + 8) => N

If (( (-B) / (2A)) < 0 )
Then
Text( 43, N, “-“)
(N +4) => N
End

Text( 43, N, K )
If ( K = 0 )
Then
(N + 4) => N
Else
K => H
prgmFSIZE
End

If ( abs(L) > 1 )
Then
Text( 43, N, “/” )
(N + 4) => N
Text( 43, N, abs(L) )
If ( L = 0 )
Then
( N + 4 ) => N
Else
L => H
prgmFSIZE
End

Else

If ( E < 0 )
Then
1 => W
abs(E) => E
End
prgmFSQRT

If ( W = 0 )
Then

If ( G = 1 )
Then
43 => U

While ( U LTE 0 )
0 => N

If ( U = 43 )
Then
( -B + F ) => K
Else
( -B – F ) => K
End
(2A) => L

If ( (K/L) < 0 )
Then
1 => Z
End
prgmFREDUCE

Text( U, N, “X=”)
(N + 8) => N

If ( Z = 1 )
Then
Text( U, N, “-” )
(N + 4) => N
End
0 => Z

Text( U, N, K )
K => H
prgmFSIZE

If ( abs(L) > 1 )
Then
Text( U, N, “/” )
(N + 4) => N
Text( U, N, abs(L) )
L => H
prgmFSIZE
End

( N + 4 ) => N
( U + 6 ) => U
End

Else

gcd(abs(B), F) => K
(2A) => L
43 => U

If ( K > 1 )
Then
(B/K) => B
(F/K) => F
prgmFREDUCE
(B*K) => B
(F*K) => F
End

While ( U LTE 0 )
0 => N

Text( U, N, “X=” )
(N + 8) => N

If (( (-B) / (2A)) < 0 )
Then
Text( U, N, “-” )
(N + 4) => N
End

Text( U, N, abs(B) )
B => H
prgmFSIZE

If ( U = 43 )
Then
Text( U, N, “+” )
Else
Text( U, N, “-” )
End
(N + 4) => N

If ( F > 1 )
Then
Text( U, N, F )
F => H
prgmFSIZE
End

Text( U, N, “sqrt(” )
(N + 7) => N
Text( U, N, G )
(N + 4) => N
G => H
prgmFSIZE
Text( U, N, “)” )
(N + 4) => N

If ( abs(L) > 1 )
Then
Text( U, N, “/”)
(N + 4) => N
Text( U, N, abs(L) )
L => H
prgmFSIZE
End
( U + 6 ) => U

End
End

Else

gcd( abs(B), F) => K
(2A) => L
43 => U

If ( K > 1 )
Then
(B/K) => B
(F/K) => F
prgmFREDUCE
(B*K) => B
(F*K) => F
End

While ( U LTE 0 )
0 => N

Text( U, N, “X=” )
(N + 8) => N

If (( (-B) / (2A)) < 0 )
Then
Text( U, N, “-” )
(N + 4) => N
End

Text( U, N, abs(B) )
B => H
prgmFSIZE

If ( U = 43 )
Then
Text( U, N, “+” )
Else
Text( U, N, “-” )
End
(N + 4) => N

If ( F > 1 )
Then
Text( U, N, F )
F => H
prgmFSIZE
End

Text( U, N, “i” )
(N + 4) => N

If ( G > 1 )
Then
Text( U, N, “sqrt(” )
(N + 7) => N
Text( U, N, G )
G => H
prgmFSIZE
Text( U, N, “)” )
( N + 4 ) => N
End

If ( abs(L) > 1 )
Then
Text( U, N, “/”)
(N + 4) => N
Text( U, N, abs(L) )
L => H
prgmFSIZE
End
( U + 6 ) => U

End
End
End

// *** FQuadSol End *** //

All the functions that are required for the number of solutions of a quadratic formula have been given to you.

If you are unsure how to get how to reach a certain function in the calculator then you will find out how to do that here. There are also other notes because some of the syntax has to be changed due to what is allowed in an article positing.

sqrt( is actually not the function at all, but I can’t use the actual symbol. To get this to work right on the calculator you must Hit the 2nd key and the X2 to get the actual function.

i the imaginary lower case i is located on the decimal key. Hit 2nd and decimal and the lower case i will be displayed on your screen.

LTE is short for Less Than or Equal too. that sign won’t work in any of the While loops that I try to post, so I changed it to LTE, you can find those and all the other signs under 2nd Math.

Reference: