DEV Community

asharbloch
asharbloch

Posted on

Write Your First TI-BASIC Program: A Quadratic Solver in 10 Minutes

TI-BASIC is the built-in language on every TI-84 Plus, and it is the friendliest way to learn what a program actually is: no setup, no install, just the calculator in your hand (or a free one in your browser).

1. Open the program editor

Press PRGM, arrow right to NEW, press ENTER. Name it QUAD and press ENTER again. You are now in the editor.

2. Ask for the coefficients

A quadratic is ax^2 + bx + c = 0. We need a, b and c from the user:

:Prompt A,B,C
Enter fullscreen mode Exit fullscreen mode

Prompt lives under PRGM → I/O → 2:Prompt. Type A,B,C after it.

3. Compute the discriminant

The discriminant B^2 - 4AC decides how many real roots there are:

:B^2-4AC→D
Enter fullscreen mode Exit fullscreen mode

→ is the STO> key. Store it in D.

4. Branch on the result

:If D<0
:Then
:Disp "NO REAL ROOTS"
:Stop
:End
Enter fullscreen mode Exit fullscreen mode

If/Then/End are under PRGM → CTL. Disp is under PRGM → I/O.

5. Print the roots

:(-B+√(D))/(2A)→X
:(-B-√(D))/(2A)→Y
:Disp "ROOTS ARE",X,Y
Enter fullscreen mode Exit fullscreen mode

√( is 2ND → x^2. Run it with PRGM, select QUAD, press ENTER twice. Try A=1, B=-3, C=2 — you should get 2 and 1.

No calculator at home?

You can test every step above on a free graphing calculator online for students — a free online calculators portal with step-by-step tutorials, no download and no signup. It runs on Chromebooks and phones, which makes it handy for homework when the physical calculator is in your locker.

Top comments (0)