Texas Instruments TI-80 Calculator User Manual


 
11-16 Applications
This program generates a function in the form A
×
SIN(BX) with random integer
coefficients between 1 and 10. Seven data points from the function are plotted.
You are prompted to guess the coefficients, which are plotted as C
×
SIN(DX). The
program continues until your guess is correct. It can be modified for other
functions.
PROGRAM:GUESS
:FUNC:RADIAN
:-31(
p
/12)
"
XMIN
:31(
p
/12)
"
XMAX
:
p
/2
"
XSCL
:-10
"
YMIN
:10
"
YMAX
:1
"
YSCL
Set viewing window.
:"A
×
SIN (BX)"
"
Y1
:RANDINT(1,10)
"
A
:RANDINT(1,10)
"
B
Initialize
coefficients.
:PLOTSOFF: FNOFF
:DISPGRAPH
:SEQ(XMIN+I
×∆
X,I,0,62,9)
"
L1
:Y1(L1)
"
L2
:PLOT1(
¼
,L1,L2,
)
:DISPGRAPH
Display data points.
:PAUSE
:"C
×
SIN (DX)"
"
Y2
:LBL W
:CLRHOME
:DISP "C
×
SIN (DX)"
:INPUT "C=",C
:INPUT "D=",D
Prompt for guesses.
:DISPGRAPH
:PAUSE
:IF C=A
:DISP "C IS OK"
:IF C
>
A
:DISP "C IS TOO HIGH"
:IF C
<
A
:DISP "C IS TOO LOW"
:IF D=B
:DISP "D IS OK"
:IF D
>
B
:DISP "D IS TOO HIGH"
:IF D
<
B
:DISP "D IS TOO LOW"
:PAUSE
Display
results.
:IF((C=A)
×
(D=B))=1
:STOP
:GOTO W
Quit if guesses are
correct.
Program: Guess the Coefficients
Program