I will explain step by step how to write a program that will do the quadratic formula. This is how I became familiar with programming and got used to the commands. I will then explain the theory behind several other programs (like games!)
In this instructable, I will be using a TI 84+ Silver Edition. There are only a few differences between the 83 and 84, so my instructable should still work with a TI 83.
Answers for the Make to Learn contest:
What did I make?
I wrote a program for Texas Instruments graphing calculators that will use the quadratic formula to solve quadratic equations.
How did I make it?
My math teacher gave every student some calculator programs a while ago. I was intrigued that you could program a calculator, and decided to look at how they were written. Using them to learn from, I began to write programs of my own. When I didn't know how to do something, I would sometimes look it up on the Internet, but mostly I used trial and error, and solved problems during spare class time.
Where did I make it?
I usually write programs at school, when I have time after a test or finishing an assignment. Most teachers have figured out that calculators can be used to play games, so I can't program while a teacher is teaching. (I suppose that's a good thing.) When I get a good idea and am excited about it, I will work on it in my free time at home.
What did you learn?
I learned how precise a computer will carry out you actions. One missing quotation mark or parentheses, or a negative sign instead of a minus sign will cause me endless trouble... and endless error messages. It can be irritating at times, but it is also nice, because it can do methodical calculations quickly and accurately.
Step 1: Formating
For operations that require the 2nd key, I will write 2nd followed by the name of the secondary button. For example, I will write off as 2nd [OFF] , not 2nd [ON]
Almost all the features on the calculator can be found in the catalog (2nd [CATALOG]), but there is usually an easier way involving a menu, which I will try to explain.
Step 2: Making a New Program
Next, type in whatever you want to name the program. I chose QUADFORM.
Press enter again, and a colon will show up. This is where you will write your first line.
Whenever you need to get out of the edit window for a program, don't press CLEAR. That will clear whatever you had written on that line, and won't get you out the the edit window. To get out, press 2nd [QUIT]
Step 3: The Quadratic Formula
For the calculator to solve this equation, A, B, and C all need to be entered. The calculator will plug the numbers into the formula, the display the answers.
Step 4: The Input
For the user to know what to input, the calculator asks for each variable, one at a time.
Before asking for the variables, the home screen must be cleared. To do this, the ClrHome command is used. It is found by pressing PRGM, then scrolling right to I/O and pressing 8.
Press enter for a new line.
Next, we will ask for the variable A. This is done by pressing PRGM, then scrolling right to I/O and pressing 2. This brings up the Prompt command. Next, type an A by pressing Alpha and then MATH, using Alpha like the 2nd key.
Press enter again and do the same thing, only asking for the variables B and C
Step 5: The Discriminant
Since the discriminant has such an impact on what kind of answers we get, we want to solve in by itself first.
Get a new line (press enter) and type in the discriminant: B^2-4*A*C
This number can be stored by pressing STO>and then the variable we want to store it as, D.
Step 6: How Many Answers?
This can be done with a few If-Then commands.
Type If by pressing PRGM and then Enter. Then enter D, because D is the value in question. Type = by pressing 2nd [TEST]. Then type 0. If the discriminant equals 0, we need to tell the calculator what to do next. Do this by pressing PRGM 2. If the discriminant is 0, the the formula becomes -B/2A, and we only have one answer. We want the calculator to go to a part of the program that does this. I'll call that label 1, which will be created later. To send the calculator there, use the Goto command. On a new line, type Goto by pressing PRGM 0. Then press 1 for label 1.
If the discriminant isn't 0, the calculator needs to know where to go. Do this by typing Else (PRGM 3), then on a new line type Goto (PRGM 0) 2 for label 2.
Now type End (PRGM 7) so the calculator knows the If-Then statement is done.
Step 7: Label One
When the discriminant is 0, the formula simplifies to -B/(2*A), so type this in. Use the STO> key to save this as E.
E is the solution to the quadratic. Before displaying the answer, the home screen needs to be cleared again. This is done by pressing PRGM, the right arrow, then 8. To show E to the user, we will use the Disp (display) command. Disp si found by pressing PRGM, scrolling over to I/O, and pressing 3. Using the alpha key, type a quotation mark. Then type whatever you want to tell the user, for example: ONE SOLUTION. Then type a closing quotation mark. Next, we want to display the actual answer, so put in a comma, then E. This is all the program needs to do, so end it by pressing PRGM and scrolling down to Stop and selecting it.
Step 8: Label 2
Step 9: Tips
If you are getting an error, check your program against the screenshots of my program.
Step 10: Guessing Game
You can make a program that will generate a random number and store it as a variable. Then require the user to input a guess. Using the greater or less then functions (same menu as the equal sign, 2nd [TEST]) you can see if the guess is too low or too high. You can display guess higher or guess lower, along with a prompt for another guess. You can do this until the user's guess is right. It's not the best game, but if it's all you have in class...
Step 11: Date
Remembering the formatting is a pain, as is typing it out, so I wrote is as a program that asks for the day, week, and year as 3 variables. It gets the current date from the getDate command.