TI-74 Basic Commands

And

Statistical Features Summary

By Namir Shammas

 

This is a table that summarizes most of the commands for the TI-74.

 

Command

Purpose

Syntax

Example

ABS

Absolute value

ABS(value)

X = ABS(-1)

ACOS

Arccosine value

ACOS(value)

X = ACOS(.5)

ACOSH

Inverse hyperbolic cosine value

ACOSH(value)

X = ACOSH(1.5)

ADDMEM

Add memory from RAM module

CALL ADDMEM

 

ASC

The ASCII code of the first  character in a string

ASC(string)

X = ASC(“A”)

Y = ASC(“AB”)

ASIN

Arcsine value

ASIN(value)

X = ASIN(.5)

ASINH

Inverse hyperbolic sine value

ASINH(value)

X = ASINH(1.5)

ATANH

Inverse hyperbolic tangent

ATANH(value)

X = ATANH(0.5)

ATAN

Inverse tangent

ATAN(value)

X = 4 * ATAN(1)

BREAK

Causes a break at the statement

BREAK

100 BREAK

BREAK

Causes a break before the specified lines

BREAK <list Of Line Numbers>

BREAK 120

BREAK 120, 500

CALL

Calls a subprogram

CALL subName

CALL Calc

CALL

Note arrays are passed by reference. All other variables are passed by value

CALL subName( paramList )

CALL Calc (A, B, C())

CHR$

The character that corresponds to a specified ASCII code

CHR$(integer)

A$ = CHR$(65)

CLOSE

Closes a file

CLOSE #fileNum

CLOSE #fileNum, DELETE

CLOSE #1

CLOSE #2, DELETE

CONTINUE

Continue execution after breakpoint

CONTINUE

CONTINUE lineNum

CONTINUE 100

COS

Cosine value

COS(value)

X = COS(2)

COSH

Hyperbolic cosine value

COSH(value)

X = COSH(2)

DATA

A comma-delimited data list

DATA list

DATA 1,2,3,4

DATA “me”, “you”

DEG

Sets the angle mode to degrees

DEG

DEG

X = SIN(45)

DELETE

Delete lines

DELETE [line1]-[line2]

DELETE 100-

DELETE -500

DELETE 100-200

DELETE 100

DELETE

Delete a device

DELETE “device.filename”

DELETE “8.data”

DIM

Sets the dimensions of arrays. First index is 0. The DIM statement specifies the number of dimensions and high index for each dimension.

DIM variable(highIndex)

DIM X(20)

DIM B(12,12)

DIM C$(3)

END

Ends execution. Must appear before subprograms

END

END

EOF

End of file

EOF(fileNumber)

IF EOF(3) THEN

CALL ERR

Obtains runtime error information

CALL ERR(errorCode, errorType, [,fileNum][,lineNum])

CALL ERR(EC, ET)

EXP

Exponential value

EXP(value)

X = EXP(1.1)

FOR

For loop

FOR variable = first TO last [STEP step]

FOR I = 1 to 5 STEP 2

FRE

Free memory available

FRE(0) returns memory available for program and data.

FRE(1) returns memory used by program and data.

PRINT FRE(0)

GOSUB

Invokes a subroutine

COSUB line

100 GOSUB 600

200 PRINT X

599 END

600 REM sub

610 X = 1

699 RETURN

GOTO

Jumps to a line

GOTO line

100 GOTO 333

GRAD

Sets the angle mode to grads

GRAD

GRAD

X = TAN(10)

IF THEN ELSE

Decision making. The entire IF statement resides in one line

IF condition THEN stmt1 ELSE stmt2

IF X = 0 THEN Y = 1 ELSE Y = 0

IMAGE

Specifies the format used by PRINT USING

IMAGE stringformat

100 IMAGE “##.##”

110 PRINT USING 100, X : PAUSE

INPUT

Input from the keyboard

INPUT [prompt,] varList

INPUT “X?”; X

INPUT

Input from files

INPUT #fileNum [, REC recNum], varList

INPUT #3, Z, B, C

INT

Returns the largest integer

INT(value)

X = INT(1.9)

KEY$

Reads input from the keyboard

KEY$

A$ = KEY$

IF A$ = “Y” THEN

LEN

The length of a string

LEN(string)

X = LEN(“123”)

LET

Assignment (optional)

LET variable = expression

LET A$ = “AA”

Let X = Y + 1

LINPUT

Input a whole line from the keyboard

LINPUT [prompt,] varList

LINPUT “Name?”; N$

LINPUT

Input from files

LINPUT #fileNum [, REC recNum], varList

LINPUT #3, Z$

LIST

List program lines

LIST [[line1]-[line2]]

LIST

LIST 100-

LIST -999

List 333-444

LIST 555

LN

Natural logarithm

LN(positiveValue)

X = LN(9)

LOG

Common logarithm

LOG(positiveValue)

X = LOG(9)

NEW

Start a new program

NEW

NEW ALL

NEW

NEXT

End a FOR loop

NEXT variable

FOR I = 1 to 3

  PRINT I

NEXT I

NUMBER

Numbers the program lines

NUMBER [initial][,increment]

NUMBER 100

NUMBER 100, 10

NUMERIC

Determines if a string is an image of a number

NUMERIC(string)

IF NUMERIC(“1.1”) THEN

ON BREAK

Handles the BREAK statement. STOP clause will cause execution to stop. NEXT clause makes the breakpoint to be ignored. ERROR clause makes breakpoint to be treated as an error

ON BREAK STOP

ON BREAK NEXT

ON BREAK ERROR

 

ON ERROR

Handle error

ON ERROR STOP

ON ERROR line

ON ERROR 999

OPEN

Opens a file.

 

fileOrganization is RELATIVE for random-access files. If omitted, sequential mode is assumed.

 

fileType can be DISPLAY (text format) or INTERNAL (binary).

 

recordLength uses VARIABLE followed by the maximum record length.

 

openMode is APPEND, UPDATE, INPUT, and OUTPUT

OPEN #fileNum, “device_name”[,fileOrganization][,fileType][,recordLength][,openMode]

 

PAUSE

Pauses execution. The ALL clause requires user to press [ENTER]

PAUSE

PAUSE seconds

PAUSE ALL

PRINT 3 : PAUSE

PI

Returns the value of PI

PI

E = PI – 355/113

POS

Returns the position of a substring in a string

POS(string, substring, offset)

I = POS(“Mine”, “in”, 2)

PRINT

Displays output

PRINT [USING line][output]

PRINT [USING formatString][output]

 

PRINT USING ”##.##”; X

PRINT

Write to a file

PRINT #fileNum [,REC numericExpr] [,USING line] [,printList]

 

PRINT #fileNum [,REC numericExpr] [,USING stringFormat] [,printList]

 

PRINT #2, X

RAD

Sets the angle mode to radians

RAD

RAD

P = 4  * ATAN(1)

RANDOMIZE

Seeds the random number generator

RANDOMIZE seed

RANDOMIZE 5

READ

Read from a DATA list

READ varList

READ X, Y, Z

DATA 1, 2, 3

REM

Remark

REM text

REM this is a test

RENUMBER

Renumbers a listing

RENUMBER [initial][,increment]

RENUMBER 100,10

RESTORE

Restore the pointer to a DATA statement. An optional line specifies a target DATA statement.

RESTORE [line]

10 DATA 1,2,3

20 DATA 4,5,6

90 RESTORE 20

 

RETURN

Return from a subroutine

RETURN

 

RND

Generates a random number is >= 0 and < 1

RND

RANDOMIZE

X = RND

RPT$

Creates a string by repeating s substring

RPT$(string, integer)

A$ = RPT$(“AB”, 3)

RUN

Executes a program in RAM or ROM

RUN [line]

RUN “prog_name”

RUN

RUN 200

RUN “MAT”

SEG$

Is like MID$ in GW-BASIC

SEG$(string, position, length)

A$ = SEG$(“123456789”, 2, 4)

SGN

Sign value

SGN(value)

IF SGN(X) > 0 THEN

SIN

Sine value

SIN(value)

X = SIN(45)

SINH

Hyperbolic sine value

SINH(value)

X = SINH(0.5)

SQR

Square root

SQR(value)

X = SQR(25)

STOP

Stops execution

STOP

STOP

STR$

Converts a number into a string.

STR$(value)

A$ = STR$(23.3)

SUB

Declares a subprogram

SUB name [(paramList)]

SUB Calc(A, B)

SUBEND

Declares the end of a subprogram

SUBEND

 

SUBEXIT

Exits a subprogram

SUBEXIT

IF A > 0 THEN SUBEXIT

TAB

Sets a tab position

TAB(expression)

PRINT 1, TAB(11);”Me”, TAB(22);X

TAN

Tangent value

TAN(value)

X = TAN(45)

TANH

Hyperbolic tangent value

TANH(value)

X = TANH(0.5)

UNBREAK

Clears current BREAK

UNBREAK

UNBREAK

USING

Directs PRINT statement to use output format

USING line

PRINT USING 100; X

VAL

Converts string to a value

VAL(string)

X = VAL(“12.3”)

           

Sample Programs

Here is a set of sample programs:

 

Newton’s method

Linear regression

Linear regression with a menu

Multiple linear regression with a menu

Sort and search strings

Hi-Lo guessing game

Newton’s Method

This program uses Newton’s method to solve for the root of a function. The program shows a trick how to return a value when calling a SUB subprogram. The trick uses a single-element array, created using with a statement like Dim variable(0), as shown in line 100.

 

100 DIM F1(0), F2(0), F3(0)

110 INPUT “Enter guess? “;X

120 I = 0

200 H = 0.01

210 IF ABS(X) > 1 THEN H = H * X

220 CALL FX(X+H, F1())

230 CALL FX(X-H, F2())

240 CALL FX(X, F3())

250 D = 2 * H * F3(0)/(F1(0) – F2(0))

260 X = X - D

270 I = I + 1

280 IF I > 55 THEN GOTO 300

290 IF ABS(D) > 1.0E-8 THEN GOTO 200

300 PRINT “Root = “; X; “ Iters = “;I : PAUSE

399 END

400 SUB FX(X, FX())

405 REM adapt next line to your function

410 FX(0) = EXP(X) – 3 * X ^ 2

420 SUBEND

 

Linear Regression

This program performs simple linear regression. The program allows you specify the number of observations, enter the X and Y data, and obtain the linear regression statistics. Lines 153 and 155 are place holders for transforming the X and/or Y data. As the program stands, the X and Y data are not transformed.

 

100 INPUT “Enter number of data pairs? “; N

102 IF N = 0 THEN GOTO 450

105 IF N < 2 THEN GOTO 100

110 SX = 0 : SXX = 0

120 SY = 0 : SYY = 0 : SXY = 0

130 FOR I = 1 TO N

140     PRINT “X(”;I;”)? “; : INPUT X

150     PRINT “Y(”;I;”)? “; : INPUT Y

151     REM Optional transformations

152     REM X = function of X

153     X = X

154     REM Y = function of Y

155     Y = Y

160     SX = SX + X

170     SXX = SXX + X * X

180     SY = SY + Y

190     SYY = SYY + Y * Y

200     SXY = SXY + X * Y

210 NEXT I

300 MX = SX / N

310 MY = SY / N

320 SDX = SQR(SXX – MX * SX)/(N - 1))

330 SDY = SQR(SYY – MY * SY)/(N - 1))

340 B = (N * SXY – SX * SY) / (N * SXX – SX^2)

350 A = MY – B * MX

360 R2 = (B * SDX / SDY)^ 2

400 PRINT “A = “; A : PAUSE

410 PRINT “B = “; B : PAUSE

420 PRINT “R^2 = “; R2 : PAUSE

450 END

 

Linear Regression with a Menu

This program performs linear regression with a one-line main menu. You can customize the statements in lines 610 and 710 to perform data transformations for X and Y, respectively. These statements are in two separate subroutines called by the data addition and deletion parts of the program.

 

10 REM Linear regression with a menu

20 REM init stat sums

100 GOSUB 500

110 INPUT “1) Add  2) Delete 3) Calc 4) New  5)Quit  Choice=>”;C

120 IF C = 1 THEN GOSUB 200

130 IF C = 2 THEN GOSUB 300

140 IF C = 3 THEN GOSUB 400

150 IF C = 4 THEN GOSUB 500

160 IF C = 5 THEN GOTO 180

170 GOTO 110

180 PRINT “BYE!” : PAUSE 3

190 END

200 REM Add observations

205 INPUT “Number of observations to add? “;M

207 IF M < 1 THEN GOTO 290

210 FOR I = 1 TO M

215     INPUT “X?”;X

220     INPUT “Y?”;Y

221     REM Optional transformations

222     GOSUB 600

223     GOSUB 700

230     N = N + 1

240     SX = SX + X

250     SXX = SXX + X * X

260     SY = SY + Y

270     SYY = SYY + Y * Y

280     SXY = SXY + X * Y

285 NEXT I

290 RETURN

300 REM Remove an observation

305 IF N < 1 THEN PRINT “No data to delete” : PAUSE : GOTO 390

310 INPUT “X?”;X

320 INPUT “Y?”;Y

321 REM Transformation

322 GOSUB 600

325 GOSUB 700

330 N = N - 1

340 SX = SX - X

350 SXX = SXX - X * X

360 SY = SY - Y

370 SYY = SYY - Y * Y

380 SXY = SXY - X * Y

390 RETURN

400 REM Calc stats

401 IF N < 2 THEN PRINT “Not enough data” : PAUSE : GOTO 490

405 MX = SX / N

410 MY = SY / N

420 SDX = SQR(SXX – MX * SX)/(N - 1))

430 SDY = SQR(SYY – MY * SY)/(N - 1))

440 B = (N * SXY – SX * SY) / (N * SXX – SX^2)

450 A = MY – B * MX

460 R2 = (B * SDX / SDY)^ 2

470 PRINT “A = ”; A : PAUSE

480 PRINT “B = ”; B : PAUSE

485 PRINT “R^2 = ”; R2 : PAUSE

490 RETURN

500 REM New data

510 SX = 0 : SXX = 0 : N = 0

520 SY = 0 : SYY = 0 : SXY = 0

530 PRINT “Stat sums reset” : PAUSE 3

540 RETURN

600 REM X=f(X)

610 X = X

620 RETURN

700 REM Y=f(Y)

710 Y = Y

720 RETURN

 

Multiple Linear Regression with a Menu

This program performs linear regression with a one-line main menu. You can customize the statements in lines 610 and 710 to perform data transformations for X, Y, and Z, respectively. These statements are in two separate subroutines called by the data addition and deletion parts of the program. The program fits data to the following model:

 

                        Z = A + B X + C Y

 

10 REM Multiple Linear regression with a menu

20 REM init stat sums

100 GOSUB 500

110 INPUT “1) Add  2) Delete 3) Calc 4) New  5)Quit  Choice=>”;C

120 IF C = 1 THEN GOSUB 200

130 IF C = 2 THEN GOSUB 300

140 IF C = 3 THEN GOSUB 400

150 IF C = 4 THEN GOSUB 500

160 IF C = 5 THEN GOTO 180

170 GOTO 110

180 PRINT “BYE!” : PAUSE 3

190 END

200 REM Add observations

205 INPUT “Number of observations to add? “;M

207 IF M < 1 THEN GOTO 290

210 FOR I = 1 TO M

212     INPUT “X?”;X

215     INPUT “Y?”;Y

220     INPUT “Z?”;Z

221     REM Optional transformations

222     GOSUB 600

223     GOSUB 700

225  GOSUB 800

230     N = N + 1

240     SX = SX + X

235     SXX = SXX + X * X

240     SY = SY + Y

245     SYY = SYY + Y * Y

250     SXY = SXY + X * Y

255     SZ = SZ + Z

260     SZZ = SZZ + Z * Z

265     SZX = SZX + X * Z

270     SZY = SZY + Y * Z

280 NEXT I

290 RETURN

300 REM Remove an observation

305 IF N < 1 THEN PRINT “No data to delete” : PAUSE : GOTO 390

310 INPUT “X?”;X

315 INPUT “Y?”;Y

320 INPUT “Z?”;Z

321 REM Transformation

322 GOSUB 600

325 GOSUB 700

327 GOSUB 800

330 N = N - 1

335 SX = SX - X

340 SXX = SXX - X * X

345 SY = SY - Y

350 SYY = SYY - Y * Y

355 SXY = SXY - X * Y

360 SZ = SZ - Z

365 SZZ = SZZ - Z * Z

370 SZX = SZX - X * Z

375 SZY = SZY - Y * Z

390 RETURN

400 REM Calc stats

401 IF N < 2 THEN PRINT “Not enough data” : PAUSE : GOTO 490

405 PXX = N * SXX – SX^2

410 PYY = N * SYY – SY^2

415 PXY = N * SXY – SX * SY

420 PZX = N * SZX – SZ * SX

430 PZY = N * SZY – SZ* SY

440 C = (PXX * PZY – PXY * PZX) / (PXX * PYY – PXY^2)

445 B = (PZX – C * PXY) / PXX

450 A = (SZ – C * SY – B * SX) / N

455 R2 = (A * SZ + B * SZX + C * SZY – SZ^2 / N) / (SZZ – SZ^2 / N)

470 PRINT “A = “; A : PAUSE

475 PRINT “B = “; B : PAUSE

480 PRINT “C = “; C : PAUSE

485 PRINT “R^2 = “; R2 : PAUSE

490 RETURN

500 REM New data

510 SX = 0 : SXX = 0 : N = 0

515 SY = 0 : SYY = 0 : SXY = 0

520 SZ = 0: SZZ = 0 : SZX = 0 : SZY = 0

530 PRINT “Stat sums reset” : PAUSE 3

540 RETURN

600 REM X=f(X)

610 X = X

620 RETURN

700 REM Y=f(Y)

710 Y = Y

720 RETURN

800 REM Z=f(Z)

810 Z = Z

820 RETURN

 

Sort and Search Strings

This program allows you to enter strings then sort them and search for matching text.

 

100 MAX = 20

110 DIM A$(MAX)

120 GOSUB 400

200 INPUT “1)Add 2)Clear 3)Sort 4)Search 5)Quit Choice=>”;C

210 IF C = 1 THEN GOSUB 300

220 IF C = 2 THEN GOSUB 400

230 IF C = 3 THEN GOSUB 500

240 IF C = 4 THEN GOSUB 800

250 IF C = 5 THEN GOTO 290

260 GOTO 200

290 PRINT “BYE!” : PAUSE 3

299 END

300 REM Add

305 IF N = M THEN GOTO 350

310 N = N + 1

320 INPUT “Enter string? “; A$(N)

330 IF A$(N) <> “” THEN GOTO 310

340 N = N – 1

350 RETURN

400 REM Clear

410 FOR I = 1 TO M : A$(I)=”” : NEXT I

420 N = 0

430 RETURN

500 REM Sort

510 FOR I = 1 TO N – 1

520 FOR J = I TO N

530 IF A$(I) <= A$(J) THEN GOTO 550

540 S = A$(I) : A$(I) = A$(J) : A$(J) = S

550 NEXT J

560 NEXT I

570 FOR I = 1 TO N

580 PRINT A$(I) : PAUSE 3

590 NEXT I

600 RETURN

800 REM Search

810 INPUT “Search for ?”; S

820 IF S = “” THEN GOTO 890

830 FOR I = 1 TO N

840 IF S = A$(I) THEN GOTO 870

850 NEXT I

860 PRINT S; “ was not found!” : PAUSE

865 GOTO 810

870 PRINT “Found “;S; “ at index “;I : PAUSE

880 GOTO 810

890 RETURN

 

Hi-Lo Guessing Game

This is a number guessing game. The program selects a secret number between 1 and 1000 and prompts you to guess that number. With each guess, the program gives you a hint if your guess is high or low. You have 10 guesses. You can change the number of guesses by assigning a different value to variable M. You can also change the range of numbers used to select the secret number by editing the statement in line 110. If you enter a guess of 0, the program stops the guessing part and displays the secret number.

 

100 RANDOMIZE

110 S = INT(1000 * RND) + 1

120 M = 10 : N = 0

125 INPUT “Play?”; C$

130 A$ = SEG$(C$, 1, 1)

140 IF A$ = “Y” OR A$ = “y” THEN GOTO 200

150 PRINT “BYE!” : PAUSE 3

160 END

200 IF N > M THEN GOTO 400

210 INPUT “Enter guess? “; G

215 IF G <= 0 THEN GOTO 400

217 N = N + 1

220 IF G = S THEN GOTO 300

230 IF G > S THEN PRINT “Too high” : PAUSE 3

240 IF G < S THEN PRINT “Too low” : PAUSE 3

250 GOTO 200

300 PRINT “You guess it!” : PAUSE

310 GOTO 100

400 PRINT “Out of guesses! Number was”; S : PAUSE

410 IF G > 0 THEN GOTO 100 ELSE GOTO 150

 

 

Built-in Statistics

The TI-74 supports statistics for single and double variables, with and without frequency data. These features make the TI-74 a very good tool to perform statistics that involve the mean, standard deviation, and linear regression.

 

Task

Keystroke Sequence

Example/Comment

Clear statistical registers

[STAT][CSR]

[STAT][CSR]

Add single-variable data

x [S+]

1.1[S+]

Add single-variable data with frequency

x [Frq] freq [S+]

2.1 [Frq] 5 [S+]

Add paired data

x [(x,y)] y [S+]

3 [(x,y)] 5 [S+]

Add paired data with frequency

x [(x,y)] y [Frq] freq [S+]

3 [(x,y)] 5 [Frq] 10 [S+]

Delete single-variable data

x [INV][S+]

1.1 [INV] [S+]

Delete single-variable data with frequency

x [Frq] freq [INV] [S+]

2.1 [Frq] 5 [INV] [S+]

Delete paired data

x [(x,y)] y [INV] [S+]

3 [(x,y)] 5 [INV] [S+]

Delete paired data with frequency

x [(x,y)] y [Frq] freq [INV] [S+]

3 [(x,y)] 5 [Frq] 10 [INV] [S+]

Get the mean of x

[STAT][x]

Note [x] means the x-bar key

Get the mean of y

[STAT][y]

Note [y] means the x-bar key

Get the standard deviation of x

[STAT][sx]

 

Get the standard deviation of y

[STAT][sy]

 

Get the sum of x

[STAT][ Sx]

 

Get the sum of y

[STAT][ Sy]

 

Get the sum of x squared

[STAT] [Sx2]

 

Get the sum of y squared

[STAT] [Sy2]

 

Get the sum of x times y

[STAT] [Sxy]

 

Get the number of observations

[STAT][n]

 

Get the linear regression intercept

[STAT][a]

 

Get the linear regression slope

[STAT][b]

 

Get the linear regression correlation coefficient

[STAT][r]

 

Project X onto Y

x[STAT][y’]

2[STAT][y’]

Project Y onto X

Y[STAT][x’]

4[STAT][y’]

 

BACK

 

TI-74 is a trademark of Texas Instruments.

 

Copyright ©  by Namir Shammas