EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Tip List

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
Page #83 background imageLoading...
Page #83 background image
3.0 Data structure tips
[3.1] Using indirection and setFold() with matrix elements
Suppose you have a matrix M of folder names, stored as strings, and you want to set the current folder
in your program. This won't work:
setFold(#M[k,l]) (won't work!)
but this will:
setFold(#(M[k,l])) (note extra parentheses around #M[k,l])
and so will this:
M[k,l]fname
setfold(#fname)
(credit to Jordan Clifford for extra-parentheses method)
[3.2] Calculate table indices instead of searching
Many functions require searching a table by an index value, then returning the corresponding value, or
the two values that bracket an input value. Suppose we have this table:
0.441.14
0.330.93
0.220.72
0.110.51
yxindex
If x = 0.7, the search routine should return 0.22. If x = 0.6, then the search routine should return 0.22,
0.33, or both, depending on the purpose of the program. For example, an interpolation routine would
need 0.22 and 0.33.
In the most general case, the program searches the x-column data to bracket the desired x-value.
Even for short tables and a fast search routine, this is slow. But if the x-data is evenly spaced and the
first x-value is known, then it is faster just to calculate the index, like this:
index = int
xx1
dx
+ 1
where x1 is the first x-value, x is the search target, and dx is the x-data spacing. For the table above,
x1 = 0.5 and dx = 0.2. int is the 89/92+ int() function. To find the index for x = 0.8, the calculation is
index = int
0.80.5
0.2
+ 1 = 2
Note that this equation returns the index pointing to the x-value less than the target value.
If the x-data is in ascending order, dx is positive. If the x-data is in descending order, the formula works
correctly if dx is negative.
3 - 1

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals