# How to Create a Simple Quadratic Formula Program on the TI-89 and Voyage 200

Filed under Algebra, Calculator Program, Difficulty: Medium, TI-89, TI-92 Plus, Voyage 200.

Like the TI-83 Plus and TI-84 Plus, the TI-89, TI-92 Plus, and Voyage 200 graphing calculators all have their own integrated programming language, TI-BASIC. While this language is somewhat more complex on the TI-89/V200 series than the the TI-83 Plus and TI-84 Plus, it offers expanded functionality and is able to take advantage of the TI-89 and Voyage 200′s symbolic math capabilities. This tutorial, like our tutorial for the TI-83 Plus and TI-84 Plus, provides an introduction on how to create a simple program to solve the quadratic formula, which finds the zeros of a quadratic equation.

### Programming Basics on the TI-89 and Voyage 200

You can find your calculator’s program editor on the applications menu. On older calculators, this will be a drop-down menu reached by pressing the button. On newer calculators, the menu is made up of icons, and the program editor has an icon which is a stylized “:Prgm.”

Press to open the Program Editor once you select it. You will be prompted to name your new program. If you choose the name of an existing program, your calculator will give you an error, so choose a unique name. When typing in the name of the program, alpha lock is automatically entered, although you can also use numbers in your application name as long as they appear after the first character.

You will then be taken to the program editing screen. From here you can use any of your calculator’s functions to create a program, as well as the basic programming commands. Pressing enters the tools menu, which allows you to cut, copy, paste, and create copies of programs. Under Control, which is reached by pressing , you can find standard programming functions such as loops and conditional statements. Pressing opens the I/O menu, which lists functions for getting user input and outputting statements to the home screen. opens the Var menu, which contains functions for dealing with variables on the calculator, and also contains the Local function, which we will use later in this tutorial. opens the Find… feature, which lets you search your program for a specific string. This feature is especially useful when you are dealing with long programs. Finally, the button (reached on the TI-89 by pressing 2nd ) provides shortcuts to setting the calculator’s display and output modes.

### Creating the Quadratic Program on your Graphing Calculator

The name of the program and the Prgm and EndPrgm commands will already be entered into the editor. The body of the calculator program goes between these tags. For the first line of your quadratic program, enter ClrIO, which can be reached by pressing to get to the C menu and then using the arrow buttons to scroll down and find it. Press to paste the ClrIO function into your program. This function clears the program output screen every time the program runs so that data and graphics from previously run programs will not clutter the screen.

Next, set the mode for outputting results as complex numbers in case any quadratic equations you enter result in imaginary solutions. As you may have guessed, you can reach this by pressing 2nd to enter the menu, Mode, and selecting “Complex Format > Rectangular” from the list. Press to paste this to the program screen.

We now need to display some information about the program. It makes sense for this specific program to display the equation the program solves. We will use the Disp function, under the I/O menu, to output text to the home screen. A good suggestion for what to enter is Disp “ax^2+bx+c=0″ because this displays the type of equation we are solving. Feel free to enter more detailed instructions in this step. Note that we entered the quadratic equation between quotes. This tells the calculator that we want to output the information as a string of text on the screen, as opposed to a calculation.

The next part of the program is very important: we want to define the variables that the program is using as “Local,” so that the variables won’t affect anything outside of the program. Otherwise, after running the program, using the letter variables on the home screen might end up giving unusual results. For more info on what can go wrong if your variables are not correctly defined and how to fix it, check out this quick fix. We will be using the variables a, b, c, and d for this program, so enter Local a,b,c,d into the program. Remember that the Local function is on the Var menu, which can be reached by pressing .

Next we need to collect user input. One easy way to do this is by using the Prompt function, which allows the user to input data into variables. Enter Prompt a,b,c to prompt the user for values to the a, b, and c in the quadratic equation.

Now that we have the values of A, B, and C in our equation, we need to do something with them. You may recall that the quadratic formula is:

Since the calculator doesn’t have a ± key, we have to break this up into plus and minus cases. Luckily, this isn’t much more work, and we can break it up by calculating the value of everything under the square root first. Do this by entering √(B²-4AC) d. Now we can use the variable d in our equations.

Finally, we need to output the solutions to our equation, which can easily be combined with the remainder of the algebra into one step using the Disp function. Recall that expressions not in quotes will be evaluated, so we can enter this all in one line as below.

Now exit the program editor by pressing 2nd . Return to the home screen and test your program by entering its name followed by an opening and closing parenthesis and pressing . For example, if you named your program quad, you would enter quad(). If your program has any errors, you can select “GOTO” and your calculator will take you to where it encounters the error.

You can keep enhancing your quadratic formula program to include many other features, such as displaying the discriminant of the equation, factoring the expression if possible, or even taking input through the program line (entering quad(a,b,c) and getting an answer) as opposed to being prompted in-program. The skills in this tutorial aren’t just useful for making a quadratic solver either. If you’re looking for some more practice, try creating a program to convert temperatures between Celsius and Fahrenheit, find the area or volume of a geometric figure, finding the geometric mean of a series of numbers, or something else. The possibilities are endless.

You can download the source for this program here.

### 22 Responses to How to Create a Simple Quadratic Formula Program on the TI-89 and Voyage 200

1. Clay robbins

This method didn’t work for me and the program I made that i found that worked was

Prgm
ClrIO
Prompt a,b,c
Disp (-b+? (b^2-4*a*c))/(2*a)
Disp (-b-? (b^2-4*a*c))/(2*a)
EndPrgm

• calcblog

Thanks for the input! Both programs look fine, maybe you have a different OS version? What error did you get?

2. Matthew

That was amazing! I have created my first ti89 program. Thank you so much

3. Anna

I have made the program several different ways, and none of them work. I cant find my “quad” program after I made it. I also am not sure how to type in my a,b,c points once I am at the HOME screen.

Inside parenthesis what do I write? I’ve tried just the numbers with a comma in between and I’ve tried “quad(a=#,b=#,c=#). None of these have worked.

Any suggestions?

• calcblog

If you made this specific version of the program, you shouldn’t have to enter anything in the parentheses, the program should prompt you. (Hence the “prompt” command).

You can also modify the program to work by inputting quad(a,b,c) by making that the first line of the program and removing the “prompt” line.

4. regina

It worked for me. Gee, thanks!

5. Amber

Thank you thank you thank you!! that was a huge help for my physics class!! lol

6. ninan

How do you type in “?” ?

7. chrisR

A much simpler function that uses a single input line without prompts and returns the answer to the home screen instead of program/io

How to use: type “qa(a,b,c)” into the home screen command line where a b and c are the respective coefficients after you have created the function below.

Function:

qa(x,y,z)
Func
If y^2-4*x*z<0 then
"Non-real result."
Else
(-y+{-1,1}*(y^2-4*x*z)^(1/2))/(2*x)
Endif
Endfunc

8. Mike

This was a very helpful step-by-step instruction for those who are writing their first few TI-89 programs. Thank you very much for the clarity of the instructions.

9. Michael

Thanks, I think I may teach the quadratic formula both ways. First is the traditional way. Alternatively , I will show the (-b+d)/(2a), (-b-d)/(2a).
Michael

10. Nick

Thanks, this was very helpful. The instructions were very clear. I tested it out and it turned out just fine.

NIck

11. Kelly

Hello -

I have other programs where the answer appears off the TI-89 screen and I can’t scroll to see it. Would you have a line of code that would always show the whole answer, or be able to scroll?

Thank you so much!

12. derar

If I write longer program, I can’t see all the results (I can see only the last two or three lines). i.e, I can’t scroll up to see all the results. any suggestions?

13. Don

I wrote this program (for a ti 89) while at college. I upgraded it recently to show the scalar (Greatest Common Factor for all three terms ) and show the discriminant if it isn’t taken out at the beginning. It will also show the the approximate values of the roots if the quadratic isn’t factorable over the digits.

I didn’t know how to show the store symbol or the square root symbol so you will have to edit those while typing it in or downloading it. Missed a couple words here and there, no edit function so reposting. Mistypes SetMode as GetMode, so I fixed that.

ENJOY

prgm
ClrIO
SetMode(“Complex Format’, “RECTANGULAR”)
getMode(“Exact/Approx”) [STO]>m
0 [STO]> e
@Inout “a “, a
@Input “b “, b
@Input “c “, c
b^2-4*a*c [STO]>f
gcd(gcd(a,b),c) [STO]>g
a/g [STO]>a
b/g [STO]>b
c/g [STO]>c
b^2-4*a*c [STO]>d
(-b-Sqrt(d))/(2*a) [STO]>l
(-b+Sqrt(d))/(2*a) [STO]>r
Lbl p
if e=0
setMode(“Exact/Approx” “EXACT”)
if e=1
setMode(“Exact/Approx” “APPROXIMATE”)
if g?1
Disp “Scalar “&string(g)
Disp “Root 1 “&string(l)
Disp “Root 2 “&string(r)
Disp “discriminant “&string(d)
if g?1
Disp “discriminant scalar”&string(f)
e+1 [STO]>e
if e=2
goto y
Pause
ClrIO
Goto P
Lbl y
setMode(“Exact/Approx”, m)
Pause
DispHome
EndPrgm

• Don

You could also add the line

Local a,b,c,d,e,f,g,l,m,r

just after the first ClrIO to make the variables local not accessible outside the program.

14. Muff Potter

Good tutorial for the most part. One suggestion though? Enlarge those screen shots of the actual TI-89 screens used, it would make it much easier for us old dogs to check and see if we’ve got the program lines exactly right.
Also, on the line with the isp “Solutions: x=”, command? I couldn’t find ‘:’ (colon character) immediately following ‘Solutions’ for love or money. Any suggestions?

15. Brickelle

This helped me, thank you SO MUCH!

16. Dez holden

Two things:

1. Great job on instructing me through my first program on the TI 89. Very clear and easy to follow
2. How may I display my answers in a decimal form?

17. Louis Clements

My question is when you write a program on the ti89, how do you space between words when needed?

18. Gjerome

I got the error “Variable name is limited to 8 characters” I don’t know what to fix

19. Fiona

How would you be able to pick up the solutions after calculated? I don’t just need to know the x value, but I need it ready to copy and paste for the rest of my calculations. It won’t let me do anything with them once displayed and also leaves it in exact form.