I would like to build a program in a TI-83+ that will prompt f开发者_StackOverflow社区or the variables x, y, and z, and then prompt for an expression on the terms x, y, and z. Is it possible to prompt for that expression and then evaluate it? If so, how?
TI-Basic has an expr(
command that lets you evaluate strings as expressions.
There is some information about the command here: http://tibasicdev.wikidot.com/expr
By using the expr(
command along with the store command (the arrow key), your program should be fairly straight forward to write.
TI-Basic provides you with a set of variables referred to as Y-VARS
. Any string can be stored to a Y-VARS
variable, after witch, any time the variable is used it will be evaluated as an expression (as if you called expr
on the original string). the Y-VARS
menu is found by pressing VARS
followed by the right arrow key.
One example of a Y-VARS
variable is Y1
, found under the FUNCTION
sub-menu of the Y-VARS
menu.
Your particular situation could be resolved using Y-VARS
like this:
Prompt Y1,X,Y,Z
Disp Y1
A sample run of the program could look like this:
prgmTEST
Y1=?"Y(X+Z
X=?2
Y=?3
Z=?1
9
Done
In this case, the expresion "Y(X+Z"
has been evaluated as 3(2+1
and the result was found to be 9
.
精彩评论