Introduction: Intro to Programming (Using a Calculator)

This Instructable will give you basic skills to program simple equations into your calculator.  I am going to be using a TI-84 Plus calculator and I know this will transfer straight over to the TI-83.  Some calculators may use a slightly different language so I can't guarantee anything I show will work for other calculators without adjustments.

If you want to make more complex programs or want to learn more about mathematical programming, I would suggest getting software like MATLAB 2011a, as it is cheap (Student version is only $100) and learning the language Fortran.  Fortran is a programming language that's strength is in mathematical programs.

ALSO!  I am going to include PROGRAMS on the LAST 2 STEPS!  Not step by step instructions, just the code for them.  The last step is a SYSTEM OF EQUATIONS SOLVER, you should read the WHOLE bit about that one before you get into it as it has some oddities to it.  It isn't exactly like the other programs.  I will update the programs when I make more that I think are useful to people and if you post some in the comments that work good and I think are good I will post them there as well and your name for recognition!  :D

EDIT:  Now, I realized that somewhere in this Instructable I said Texas Instrument calculators use Fortran.  Well I realized that they don't use a modified version of Fortran, its a modified version of BASIC, called TI-BASIC.  BASIC is another programming language, I have used it, not as much as Fortran, but I always noticed that they are quite similar, so I got them mixed up.  Oops!

Step 1: A Little Bit About Calculators

First off, the calculators that can be programmed are not your normal dollar store calculator.  If you do a lot of math its good to invest $100 into a graphing and programmable calculator.  You will get a lot you probably don't use or won't, but you will get something that is usually easier to use and its harder to make mistakes on them, with there large, multi-line screens.  As well, as time goes on and the longer you have it you will start to use other functions of the calculator that make work easier.  One of my pet peeves, I especially hate cheap calculators that don't have square root buttons.  I can handle not have square root functions really, but if I get to cube roots and forth roots, there is no way I can do those in my head and a cheap calculator is only a paper weight then.  Put another way, cheap calculators can usually get the job done, but it takes 10x as long and its like using a toothbrush to clean the White House.

Now, about how the calculator works.  Your calculator may look intimidating at first, but think of it like a small computer built only for math.  Everything is does has a use, whether use it or not is up to you.  If this is the first time using this type of calculator, take some time to work your way around it.  The next step also points out some buttons you should look for as well as they are important for programming.  If you are new, you will notice all the buttons have a

Step 2: Buttons

You should locate some buttons on your calculator and memorize where they are as it will make programming faster.  Buttons you will need a lot will be;

ALPHA - Green button usually, hard to miss.
2ND - Another button with a fairly unique color.
PRGM - This access everything you will need for programming.
, - The comma button is important as well.
STO (-> or >  or STO>) - This you will need for sure.
Catalog - This is the zero on my calculator.  You have to hit 2ND then the zero to access the catalog.  This will be used more if you go
                 further into programming.
( and ) - These get used a lot, especially the longer your equation.

Step 3: Create a Program

The first program we are going to create is the Quadratic Equation as every kid in school uses this for a few years of math class.  This will look tedious and long and more difficult then should be for your first program, however, you are putting in 2 equations because part of the quadratic equation has a +/-.

Ok, so lets look at the Quadratic equation:
                 ______
x = -b+/- √(b²-4ac)
               2a

Notice the + or - between the -b and the square root, that is the reason why this program will look long, you put it in twice, once with a + and once with a -.  So lets get to it!

Turn on your calculator, from here on out, I will only list the buttons you need to press, and because we are programming, I will show notes by starting them with a %;

PRGM
% At the top on of screen it should say EXEC EDIT NEW
>
>
% NEW should be highlighted
ENTER
% You should now have a screen that asks for a name.  Your calculator automatically goes into ALPHA mode now.  That means
     that all the writing above the keys is active, NOT what is written right on the keys.  Also, it will only be the writing that is the same
     color as your alpha button.  Most of the buttons with ALPHA mode functions are letters of the alphabet, for writing.
Q
U
A
D
% On my calculator Q is the 9 button, U is 5, A is the MATH button (right below the ALPHA button), D is invX button (below the MATH
     button)
ENTER
% Your screen should display PROGRAM:QUAD at the top of the screen.  We are going to start programming now.
PRGM
% This brings up a menu with commands.
>
% I/O should be highlighted
2
% You can use the ^ and v buttons to select what you need as well, but its faster if you know the number.  Prompt should be
    displayed.
ALPHA
A
,
ALPHA
B
,
ALPHA
C
ENTER
%  Congrats, you have completed your first line.  On to the rest.
(
(-)
%  I will note the negative button with brackets and the subtraction sign simply as -.
ALPHA
B
+
2nd

%  The X² buttons second function is the square root.
ALPHA
B

%  X² could also have be denoted as ^2 on some calculators.
-
4
ALPHA
A
ALPHA
C
)
)
/
%  I am using the / to denote divide.
(
2
ALPHA
A
)
STO>
%  Think of  the STO> like the equal sign.  It doesn't actually mean that, what it does is tells the calculator to store the answer from
      the equation we just wrote.  But we haven't denoted what to store our answer as, so;
ALPHA
D
%  Now we have told the calculator to store our answer as "D".
ENTER
%  On to the next line.  Its ALMOST identical to the last one, but we have to change 2 parts.
(
(-)
ALPHA
B
-
%  First change, last time that - sign was a +.
2nd

ALPHA
B

-
4
ALPHA
A
ALPHA
C
)
)
/
(
2
ALPHA
A
)
STO>
E
%  Second change, store this answer as E because it is a separate and unique answer from the one we stored as D.
ENTER
%  Ok, almost down, now we need to tell the calculator to display both our answers.
PRGM
>
3
(
ALPHA
D
,
ALPHA
E
)
%  Done.  To exit hit;
2nd
QUIT
%  Quit is the 2nd function on my MODE button.

You are done.  On to the next step.

Step 4: Finished Product

Your program before you exit the editing screen should look like this (You may have to scroll up or down to see all of it as it may not fit all on the screen);

PROGRAM:QUAD
:Prompt A,B,C
:(-B+√(B-4AC))/(2A)->D
:(-B-√(B-4AC))/(2A)->E
:Disp (D,E)


The equations will each take up 2 lines because they are long.

Step 5: Executing a Program

To execute a program when you are back at the main screen (If you turn your calculator off using the off button and back on you will be there.  Don't remove the batteries!) press;

PRGM
%  Use ^ and v to select the program you want to run, you will only have one right now though.
ENTER
%  prgmQUAD will be displayed at the top of your screen.
ENTER
%  It will now ask for your value of A, so plug it in then;
ENTER
%  Now B value, then;
ENTER
%  C value;
ENTER
%  It will now display 2 values shifted to the right side of the screen.  These are the two answers you get from the quadratic
      equation.  If it says ERROR, either you entered values that have no solution or your program is incorrect.  Make sure you are
      using values that have solutions for your test.  If it still does not work, feel free to comment and I will help because there are
      lots that can go wrong.

To test, I would suggest entering 2 as A, 5 as B, and -3 as C.  The 2 answers you should get should be 0.5 and -3 (They may be reversed, that isn't a problem).

Step 6: Next Steps

Now that you have the basics, try making your own programs, Google some info on programming your calculator if you need, or need to learn how to use more commands. 

I believe there is already an Instructable posted for some other programs.  Try them out!

Again, I would like to point out that calculators use a language called Fortran (Or a slightly altered version of it).  You can get cheap software to learn this language on your computer.  The student version of MATLAB 2011a is great for $100 and there are many programs online you can download and use made by other people.

Step 7: Programs

I will add programs here that you just have to type into you calculator starting with the one we just made!

Quadratic Equation:

PROGRAM:QUAD
:Prompt A,B,C
:(-B+√(B-4AC))/(2A)->D
:(-B-√(B-4AC))/(2A)->E
:Disp D,E


Cross Product:  I use this quite a bit so I thought I would put it up.  I don't know why but it only worked if I put down Disp "letter" individually, It didn't like me trying to display 3 in one line.

PROGRAM:CROSS
:Prompt A,B,C,X,Y,Z
:BZ-CY->D
:CX-AZ->E
:AY-BX->F
:Disp D
:Disp E
:Disp F


Heron's Formula: I decided to put up my version of Heron's Formula.  This is the way I learnt it, but there is about 4 or 5 ways it can be written as well as it can be modified for objects with 4 sides.  As well, in my method, you also get an angle (radians and degrees will depend on what your calculator is set to) and that angle is always the angle opposite from the side you put in as C, so if you put a different side in for C you get another angle.

PROGRAM:HERON
:Prompt A,B,C
:√(((A+B+C)(-A+B+C)(A-B+C)(A+B-C))/16)->D
:arccos((A²+B²-C²)/(2AB))->E
:Disp D,E

Step 8: System of Equations Solver

I have tested this with 5 equations and 5 variables and it only takes the calculator 2 seconds to solve.  Its a every simple program to.  Requires some input before running the program as I am unsure if you can use the Prompt command for matrices.  I tried it and if you enter a number/numbers and hit enter it gets mad at you.  I will show the program below and explain underneath how to use it.

PROGRAM:SYSOFEQN
:([A]^-1)*[B]^T->[C]
:Disp ([C])

Looks simple.  There are a few things you need to do when programming this one though;

You can't separately enter the square brackets and the letter for the matrices, they have to be from the Matrix Menu.  Hit 2nd and the X^-1 button, now you can either hit enter for Matrix A, press down once for Matrix B or down twice for Matrix C.  Select the matrix you need and hit enter.  the whole [A] (brackets with the letter) should all appear at once when you do this.

When it says matrix B ([B]) to the power T, what you have to do is actually hit the 2nd button then the X^-1 button and then hit right once and down once and a little T should be highlighted, now hit enter.  This T means transpose, this makes life easier.   It will show up next to the [B] like an exponent.

Ok, assuming you have gotten it programmed, the next thing to do is how to actually enter your data and run the program so that it works.  Look at how many variables you have.  Make matrix A a square matrix of the number of variables you have (2 variables, 2x2, 3 variables, 3x3, 4 variables, 4x4...etc).  Make B a matrix that is 1xthe number of variables (2 variables, 1x2, 3 variables, 1x3...etc).  Leave C alone, preferable you want it all zeros or the be completely blank.

Matrix A you fill with the coefficients of the variables.  They variables have to be in the same order in each equation for this to work, so reorder them as needed.

Matrix B is (Its actually a vector, but don't worry about terminology right now) will have the values that the equations equal put into it.

Here is an example;

3u+1.5v+w+0.5x+4y = -11.75
-2u+v+4w-3.5x+2y = 19
6u-3v+2w+2.5x+y = -23
u+4v-3w+0.5x-2y = -1.5
3u+2v-w+1.5x-3y = -3.5

Because there are 5 variables, make matrices A, 5x5 and make B 1x5.  The numbers you put into A are the coefficients and it should look like below.   Notice that the first column is the coefficients of all the u variables, the second column is all the v variables, third column is w variables?  That is how you want it.  Also you want the first ROW to be only the first equation, second row the second equation only...etc.  If you put parts from an equation in different lines you get the wrong answer.  If you have more then one variable coefficients in a column, you get the wrong answer, so it is important you line it up properly, but it doesn't take much more time to reorder some of the equations variables if you need to.  So this is what matrix A should look like;

3     1.5     1     0.5     4
-2     1       4    -3.5     2
6      -3      2     2.5     1
1       4      -3    0.5     -2
3       2      -1    1.5     -3

And B should look like this;

-11.75       19       -23       -1.5       -3.5

Now run your program and you should get something on the left side of your screen after a few seconds that looks like this;

[[  -4  ]
 [ 2.5 ]
 [  4   ]
 [  1   ]
 [  -2  ]]

This is your answer.  The way you read it is if your first COLUMN was your u variable coefficients then u = -4.  If your second column was v variable coefficients then v = 2.5 and then  w = 4,  x = 1  and  y = -2.  Because of how you read the answer you can see why you have to make sure your order when entering the coefficients is correct.

This should work for more equations with more variable I believe, although it will take the calculator more time.  If you start getting 10 equations and 10 variables you could be waiting a minute for your answers, although it is still a huge time saver.

Comments

author
Livingstrong (author)2012-02-13

Very nice Instructable! I have made programs that make Stoichiometry in Chemistry class super easy. It calculates number of moles, grams, liters of gas, change in energy, and some other things as well with only a few basic values. My Calc teacher and I, also sat down and wrote out a quadratic equation program that tells what kind of solutions are produced (real, complex, etc.) in addition to the answers generated. A triangle program that I built also will tell all of the angles and sides of a triangle with by having any 3 values at the start.

author
Wesley666 (author)Livingstrong2012-02-14

Yes, I used to have a modified system of equation solver for balancing equations using matrices, although it was only faster then doing it by hand for combustion reactions that used hydrocarbons with lots of C's and H's and what have you because those were the only questions were you couldn't just look at what you were balancing and know the coefficients immediately.

The quadratic one sounds great, if you have the code for it, post it in a comment and I will add that one to the second last page. I assume it checks the...the, uh, the thing which I forgot its name...the discriminant? Well anyhow, I assume it checks the answer from the square root portion of the quadratic equation then with an if, elseif, else statement will display what type of solution. Am I close?

author
Livingstrong (author)Wesley6662012-02-17

Yes, the beginning few line of the code sort it out to decide how to dissect the numbers. I'll have an instructable up soon for the program.

author
Livingstrong (author)2012-02-13

The calculators that we use are TI-84 Plus Silver.

author
Wesley666 (author)Livingstrong2012-02-14

The ti84 and 84 silver are very similar, the only two differences I remember they have is the silver has interchangeable faceplates and it has 3x the memory, well actually 3x the blocks, because I believe most TI calculators use blocks except for the most expensive models, but I imagine if you have 3x the blocks it's still 3x the memory.

TI makes great calculators, but I have always questioned one thing, the screens. We have 3D TVs but we still have to use the black and white, heavily pixelated screens on our calculators? It would be nice to have a higher pixel density, mostly for graphs and such. I read a comic one time that said that TI still uses the same engineer that they used from 1970 and he is the only person that still bows how to use those screens! Hehe.