Texas Instruments TI-89 Tip List page 377

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

Advertisement

[9.14] Use keyboard programs to quickly change mode settings
The mode settings (shown with the [MODE] key) control fundamental aspects of calculator operation.
Many of the tips in this list show that the proper mode setting is important for getting the right result. If
you use your calculator for a variety problem types you will switch modes quite often, and this is
tedious because several steps are needed to change a setting: press the [MODE] key, scroll down to
the mode category, open the mode submenu, scroll to the right setting, change it, and press [ENTER]
to finally make the change. One solution to this problem is to use the built-in keyboard program feature
to change modes quickly with a few keystrokes. This is particularly useful with mode settings shown in
the status line: angle units, auto/exact/approx and graph type. Since these are shown in the status line,
you can quickly see that the correct mode is set. The keyboard programs are executed with
[DIAMOND] [1] for kbdprgm1(), [DIAMOND] [2] for kbdprgm2(), and so on. You can have up to nine
kbdprgm() programs.
In general, we will use a [DIAMOND] key combination to toggle each mode setting. For example, if I set
up kbdprgm1() to cycle through the Auto/Exact/ mode, then repeatedly pressing [DIAMOND] [1]
changes the setting through Auto, Exact, Approx, Auto and so on. If I use kbdprgm2() to change the
angle mode, then pressing [DIAMOND] [2] changes the setting through RAD, DEG, RAD and so on.
We use getMode() to find the current mode, then setMode() to change the setting to the next option.
The forms of getMode() and setMode() which we need are
getMode(modeString)
setMode(modeString,setString)
where modeString specifies the mode to get or set, and setString specifies the new setting. modeString
and setString can be specified in one of two ways: either as text strings in the current language, or as
numeric strings. I use numeric strings because this makes the programs independent of the current
language, and it is easy to calculate the next mode setting.
We could used repeated If ... then ... elseif ... structures to change the mode, but any mode setting
change can be done with one line of code:
setMode( modeString ,string(exact(mod(expr(getMode( modeString )), n )+1)))
where n is the number of setting options. For example, if we want to change the Auto/Exact setting,
then modeString = "14" and n = 3, since there are three choices. This statement changes the mode like
this, working from the inside out:
Get the current mode as a string:
getMode( modeString )
Convert the mode string to a number:
expr(getMode( modeString ))
Calculate the next mode setting number:
mod(expr(getMode( modeString )), n )+1
Use exact() to remove any decimal points or exponent characters:
exact(mod(expr(getMode( modeString )), n )+1)
Convert the next mode number to a string:
string(exact(mod(expr(getMode( modeString )), n )+1))
9 - 18

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents