Syntax peculiarity with TI-89


[Prev][Next][Index][Thread]

Syntax peculiarity with TI-89



I ran into an interesting syntactical peculiarity recently when working with my
TI-89, which I thought would would be worth sharing. I'm sure the same
consideration applies to the TI-92.

The topic is adding a single value (a "scalar") to a matrix. If one wanted to
increase every entry in a matrix M by 2, for example, one could create an array
of the same shape as M, but consisting solely of 2's, which one could then add
to M.

Alternatively, one might think about the command 2+M --> M .  Some languages
work this way, automatically extending the scalar argument of + to match the
shape of the array. However, on the TI-89 this syntax is valid only in the case
when M is a _square_ matrix, in which case 2 is added only to elements on the
_main diagonal_. In effect, 2 times an implied _identity matrix_ is added to M.

The TI-89 also includes an "element by element" command .+ (and some other
analogous special element-by-element commands). The manual shows an example
analogous to x.+M --> M, in which case the variable x (undefined) is added to
each element of the matrix in the example. I tried following this syntax to
construct commands like 2.+M --> M, where M is a non-square matrix, but kept
getting "dimension mismatch" errors.

After scratching my head a while, I finally realized that this command was
being parsed differently by the interpreter -- the period was being perceived
as belonging to the 2 to produce 2. (an approximate value of 2) and an attempt
was then being made to add this value to M. Since M was not square, an error
resulted. Easy solution: enter (2).+M --> M . Made a note in my manual.

Incidentally, why shouldn't the command x.+L --> L result in adding x
element-by-element to the values stored in a _list_ L? This is another
operation that is freqequently useful. Seems like a suggestion to TI might be
in order here, right?

RWW Taylor
National Technical Institute for the Deaf
Rochester Institute of Technology
Rochester NY 14623

>>>> The plural of mongoose begins with p. <<<<