Nathan Korth's writing

TI Basic Tutorial

March 2012

TI Basic is a programming language used by Texas Instruments graphing calculators, most notably the TI-83. Although it is an incredibly inefficient programming language, learning it is a great way to learn all the various features of your calculator, and to make many math assignments significantly easier :)

This tutorial does not require any previous knowledge of programming, but it does assume at least basic knowledge of algebra.

Getting started: Math formulas

Programs that help with mathematical formulas are very easy to create. For example, here's how to make a program that calculates sector area.

  1. Press the PRGM button, scroll to the NEW tab, and select Create New.
  2. Type a name. It's limited to 8 characters, so use a concise name like "SECTOR". Press ENTER.
  3. Now you're at the program entry screen. Each line of code has a ":" at the beginning. Right now, there's only one and it's empty.
  4. You can press the PRGM button when editing a program to see programming commands. The first command you need is Prompt, in the I/O tab. Select it and press ENTER.
  5. Prompt is used to input values for variables. Sector area uses the values R and θ, so type "R,θ" after Prompt. (Use the ALPHA key to type letters. Theta is on the 3 key.) When you're done, the line should look like "Prompt R,θ". Don't forget the comma!
  6. Press Enter to add a new line. Each separate instruction in the program needs to be on its own line.
  7. Open the PRGM menu and get a Disp command from the I/O tab. Disp displays values on the screen.
  8. After the Disp command, type what you want displayed, which in this case is a formula: ".5R²θ". The formula will be evaluated just like in normal use of your calculator (with the variables R and θ replaced with their values), and the result will be printed on the screen.
  9. Press 2ND→QUIT to exit programming mode. To use the program, press the PRGM button to list your programs, press ENTER to select the program, and press ENTER again to execute it. Enter R and θ when prompted, and it will display the result.

The finished program looks like this:

:Prompt R,θ
:Disp .5R²θ

Using more variables: Heron's formula

Heron's formula for calculating the area of triangles is slightly more complex than most formulas – it uses a value S (half the perimeter), which is then used in the main formula. Here's how this looks in code:

:Prompt A,B,C
:(A+B+C)/2→S
:Disp √(S(S-A)(S-B)(S-C))

This program uses the → operator (the STO› key) to assign the value of (A+B+C)/2 to the variable S. You can also use variables and the → operator outside of programs, to save typing when reusing large numbers. (It's just like using π, except for other values.) For example,

3*10^8→C

Introducing control structures: The quadratic formula

You've probably already used a quadratic formula program, either preinstalled on the calculator or provided by your teacher. Its code is yet more complex, because the quadratic formula can have between 0 and 2 solutions to any given input. Here's my version, line by line:

:Prompt A,B,C

This collects the input needed for the quadratic formula, just like in the previous examples.

:B²-4AC→D

This line calculates the discriminant, and stores it in the variable D.

:If D≥0
:Then

This is an if statement, an important concept in programming. (If and its associated commands are in the PRGM menu.) This one uses the "greater than or equal to" logic operator (found in the 2ND→TEST menu, on the MATH key) to test the value of D. If D is, in fact, greater than or equal to 0, then the code after Then is executed. The Then, Else and End commands are related to If, denoting where the code controlled by it starts and ends. These code "blocks" are more clearly visible in other programming languages, like C:

if(d >= 0){
    // do
    // something
} else{
    // do
    // something
    // else
}

With brackets and indentation, you can see how each of the two blocks is contained by a control structure. If the expression is true, the first block ("something") is executed. If it is false, the second block ("something else") is executed.

:Disp "SOLUTION 1:"
:Disp (-B+√(D))/(2A)
:Disp "SOLUTION 2:"
:Disp (-B-√(D))/(2A)

This code is inside the If block. It displays four lines on the screen: the solutions and labels for them. The quotation marks (on the + key) tell the calculator to just display the letters, rather than the product of the variables S, O, L, U, and so forth. (There's also a space and a colon, which are on the 0 and . keys respectively.)

:Else

The Else command both signifies the end of an If block, and begins an Else block of its own (which runs only if the If statement is false). If you didn't need the program to do anything when the If statement is false, you could just end the If block with End. Here, however, we should display a message if there are no solutions.

:Disp "NO SOLUTION"

Another Disp command, again using quotation marks to display text.

:End

This ends the Else block, and is the last line in the program.

Here's the entire program. When you look at it as a whole, it's easier to see how the logic works:

~~~ :Prompt A,B,C :B²-4AC→D :If D≥0 :Then :Disp "SOLUTION 1:" :Disp (-B+√(D))/(2A) :Disp "SOLUTION 2:" :Disp (-B-√(D))/(2A) :Else :Disp "NO SOLUTION" :End ~~~

Useful tips

Deleting a program

Press 2ND→MEM (on the + key), choose "Mem Mgmt/Del...", choose "Prgm..." (item 7 in the menu), select a program, and press DEL. The calculator will ask you if you're sure you want to delete it.

Renaming a program

You can't directly rename a program, but you can create a new one and copy over the contents. Create the new program, then in the editor press 2ND→RCL. Press PRGM and select the program you want to copy from the EXEC tab. After pressing ENTER, the bottom of the screen should say "Rcl prgmSTUFF". Press ENTER and the contents of the program will be dumped into the new one. When you're done, follow the above instructions to delete the old copy.