[7.21] Use Undef As An Argument; [7.22] Local Documentation For Functions And Programs; [7.23] Passing User Function Names As Program/Function Arguments - Texas Instruments TI-89 Tip List

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

expr("foofold\"&pname)
where "foofold" is the folder where the program in pname resides.
This is useful when you want to execute one or more programs from your program, but you don't know
in advance which program.

[7.21] Use undef as an argument

undef, which means 'undefined', can be used as an argument in some functions and commands. For
example, if this expression is entered in the Y= editor,
y1(x)=when(x<2,when(x<0,undef,x^2),undef)
then x^2 is plotted only for x>0 and x<2.
(Credit to Rick A. and Ray Kremer, submitted by Larry Fasnacht)

[7.22] Local documentation for functions and programs

As you collect more programs on your calculator, it can be difficult to remember what the program
does, or what arguments it takes, or what limitations it has. Frank Westlake shows a method to embed
the documentation as comments within the program itself, such that it can be displayed with the
'Contents...' command in Var-Link. Check here for more details:
http://members.web-o.net/westlake/ti/intdoc.html
The basic idea is to use char(10) and char(12) to format the text to make it easy to read.

[7.23] Passing user function names as program/function arguments

You cannot directly pass user functions as arguments to programs or functions, because the 89/92+
will try to evaluate them when the function is called. Many routines require a function as an input.
The general method is to pass the function name as a string. The called function then evaluates the
function using either expr() or indirection.
Using expr()
To pass a function successfully, pass the name and argument variables (or variables) as a string, like
this:
t("f1(x)","x")
where f1(x) is the function to be evaluated, and x is the function argument variable. To evaluate this
function in program t(), build a string and evaluate the string with expr(). We want a string of the form
f1(x)|x=xval
where xval is the value at with to evaluate the function. So, the complete program looks like this:
7 - 21

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents