[3.22] Create lists with logarithmic element spacing
Lists with logarithmic element spacing are useful for creating function plots with logarithmic x-axis
scaling, and for making tables of functions which change rapidly for small values of the indpendent
variable, but less rapidly for larger values. This program creates such a list.
loglist(l,h,n)
Func
©(xl,xh,n) make list of n+
1
elements from xl to xh with log-spacing
©
1
9apr00/dburkett@infinet.com
local l
1
,d
log(l)
→
l
1
(log(h)-l
1
)/n
→
d
seq(
1
0^(l
1
+k*d),k,0,n)
EndFunc
loglist() creates a list of n+1 elements which range from l to h. For example, if l = 20, h = 20,000 and n
= 10, then the returned list is
{20, 39.91, 79.62, 158.87, 316.99, 632.46, 1261.9, 2517.9, 5023.8, 10023.7, 20000}
Note that the difference between the first two elements is about 20, and the difference between the last
two elements is about 10,000. This is the desired effect of logarithmic spacing.
The function works by logarithmically mapping the original interval [l,h] onto the interval of [log(l),
log(h)].
To make a logarithmic plot of some function f(x), use loglist() to make a list of elements over the
required range of x, and save it as variable list1. Next, use
seq(k,k,0,n)
→
xlist
f(list
1
)
→
ylist
to make lists of x-coordinate plot values and function values, respectively. Finally, set up a data plot
(not a function plot) in the Y= Editor, using xlist and ylist as the variables to plot.
[3.23] Use single bits as flags to save status information
Sometimes a program needs to save and change the status of several conditions. For example, we
may need to keep track of which operations the user has performed. If each of these operations
requires a lengthy calculation and the user has already performed the operation, we want to skip the
calculation. A typical method to accomplish this record-keeping is to use variables with boolean values
true and false. This is effective if there are only a few status items we need to modify and record, but it
becomes unwieldy if there are many items. If we had 30 status items, we would need to create and
initialize 30 separate variables. Each boolean variable requires three bytes of RAM storage, so our 30
status items would use 90 bytes.
A variable that is used to indicate the status of a condition is called a flag. We can use RAM more
efficiently if we save each status flag as a single bit in an integer. Since we will use the and, or, and xor
operators to manipulate the flags, we can have, at most, 32 flags in a single integer. If you need more
3 - 21
Summary of Contents for TI-92+
Page 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Page 53: ...LCD connector detail PCB switch side 1 42...
Page 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Page 55: ...Key cap detail 1 44...
Page 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Page 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...