EasyManua.ls Logo

Texas Instruments TI-89

Texas Instruments TI-89
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
When passing just the function name DOES work:
Sometimes you can pass the function and variable, and it will work. For example, suppose we use the
call
t(f1(x),x)
with this program
t(fxx,xx)
Prgm
local xval,result
10xval
fxx|xx=xvalresult
EndPrgm
In this case, the calculator will try to evaluate f1(x) when t() is called. If x is undefined, f1() will be
symbolically evaluated (if possible) with the variable x. This expression is then passed as fxx. Later in
the line fxx|xx=..., the symbolic expression is evaluated. For example, suppose that f1(x) is defined as
f1(x)
Func
2*x-3
EndFunc
so, the first evaluation (when t() is called) results in fxx = 2*x-3, which is then correctly evaluated later.
However, if the function performs a conditional test on x, the program will fail. For example, if we have
f1(x)
Func
if x>0 then
2*x-3
else
2*x+3
endif
EndFunc
the value of x is not defined at the time of the t(fxx,xx) call, so the program fails with the error message
A test did not resolve to TRUE or FALSE.
(credit for indirection method to Eric Kobrin)
[7.24] Use a script for self-deleting set-up programs
In general, a TI Basic program or function cannot delete itself. However, scripts (text files) can delete
themselves, and this can be used to create a self-deleting set-up process. For example, suppose that
the set-up program is called setup(), and the set-up script is called setscrpt. setscrpt looks like this:
:Press [f2] [5] to run setup
C:setup()
C:Delvar setup()
C:Delvar setscrpt
7 - 23

Table of Contents

Other manuals for Texas Instruments TI-89

Related product manuals