Saturday, October 5, 2019

Fun with the TI-81: Part I

Fun with the TI-81:  Part I

Before there there was the TI-82, TI-83 and its family, and the TI-84 Plus and its family, there was the Texas Instrument's original calculator from the 1990, the TI-81!

Translating TI-81 to TI-84 Plus (and Back) 

Most of the commands can be copied directly.  Some caveats to keep in mind:

Disp

The TI-81's Disp (Display command) can only display either a variable's value or a string.  The command can only display one item per line.

The TI-84 Plus' Disp command can list any combination of strings and variable values, separated by a comma.  Each argument will be placed on one line.

Input

The TI-81's Input command can ask for one variable.  There is no prompt string option.  A prompt string will require an extra Disp command.  Also, there is no colon character.

Disp "VAR="
Input A

The TI-84 Plus' Input command can have an optional prompt string.

Input "VAR=", A

Lists 

The TI-81 has two lists that are used for statistical calculations, {x} and {y}.  To recall an element of either {x} or {y}, press [ 2nd ] [ 0 ] or [ 2nd ] [ 1 ], respectively.  The dimensions of the stat lists can be found by pressing [VARS], and selecting Dim{x} under the DIM menu.  Stat lists can't be resized by storing a value to it.

All of the lists for the TI-84 Plus start with a lower case bold "L".  Lists 1-6 can be pressed by [ 2nd ] [ 1 ] through [ 6 ].  There are many lists commands and functions for the TI-84 Plus.

Linear Regression Options

Running linear regression is the LinReg command on the TI-81.  The equation will always be a + bx.

Running linear regression for the TI-84 Plus will need you to designate the x-list and y-list.  There are also various options: a + bx, ax + b, or Med-Med

The If Command and Loops

The TI-81 only has a singular If command, no Then or Else.  The syntax is:

If condition
do if condition is true
skip to here if condition is false

Loops will require the extensive use of Lbl (label), Goto, DS<(, and IS>(.   Lbl and Goto are self-explanatory. 

DS<(var, target).   The value of var is decreased by 1.  The next command is skipped when value < target.

IS>(var, target).  The value of var is increased by 1.  The next command is skipped when value > target. 

In addition to If (which can still do the two-line structure), Lbl, Goto, DS<(, and IS>(, the TI-84 Plus has Then, Else, For, While, and Repeat.

The STO> Button

The TI-81 turns on the ALPHA keyboard when pressing [STO>].

The TI-84 Plus doesn't.

On to the programming...

TI-81 Decimal to Binary Conversion:  BINTODEC
(75 bytes)

Input the binary integer at the prompt.  Use only 1s and 0s. 

Variables:
B = binary representation
D = decimal representation
N, M:  used

Program:
Disp "BIN>DEC"
Input B
0 → D
0 → N
B → M
Lbl 0
2^N * 10 * FPart(M/10) + D → D
IPart(M/10) → M
IS>(N, IPart(log B) + 1)
Goto 0
Disp D

Example:
Input:  B:  1001010
Result:  D:  74

TI-81 Binary to Decimal Conversion:  DECTOBIN
(99 bytes)

Input the decimal integer at the prompt.  The integer needs to be in between 1 and 1024.  Only positive integers are allowed.

Variables:
B = binary representation
D = decimal representation
N, M:  used

Program:
Disp "DEC>BIN"
Disp "1≤D≤1024"
Input D
0 → B
D → M
IPart( log D / log 2 ) → N
Lbl 2
If 2^N ≤ M
B + 1 → B
If 2^N ≤ M
M - 2^N → M
If N ≠ 0 
10 * B → B
DS<(N, 0)
Goto 2
Disp B

Example:
Input:  D:  516
Result:  B:  1000000100

TI-81 Roots of a Quadratic Equation:  QUADEQN
(121 bytes)

This program solves the equation A*X^2 + B*X + C = 0, which allows for real or complex roots.

Variables:
A, B, C:  coefficients
X, Y:  roots

If the discriminant is zero or positive, the roots are real, and are stored in X and Y.

If the discriminant is negative, we have complex roots in the form of X ± Yi, X is the real part, Y is the imaginary part.

Program:
Disp "AX²+BX+C=0"
Input A
Input B
Input C
-B / (2A) → X
(B² - 4AC) / (4A²) → Y
If Y<0 font="">
Goto 0
√Y → Y
X + Y → Y
2X - Y → X
Disp "ROOTS"
Goto 2
Lbl 0
√(abs Y) → Y
Disp "X+YI, X-YI"
Lbl 2
Disp X
Disp Y

Examples:

x^2 + 4x + 5 = 0,  Roots:  2 ± i
Input:  A: 1, B: 4, C: 5
Results:  "X+YI, X-YI", X: -2, Y: 1

x^2 + 5x + 4 = 0,  Roots:  -4, -1
Input:  A: 1, B: 5, C: 1
Results: "ROOTS", X: -4, Y: -1

Tomorrow will be Part 2. Until then,

Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

TI-30Xa and HP 12C: Linear Interpolation

TI-30Xa and HP 12C: Linear Interpolation Introduction Given two points (x0, y0) and (x1, y1), and a point, x, we can easily estim...