Re: Boolean data on TI-89


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

Re: Boolean data on TI-89



At 12:27 PM -0500 10/20/98, RWW Taylor wrote:
>Working with the TI-83 or TI-86, the result of a comparison is a
>_numeric_ boolean value, 0 or 1 for "true" or "false", respectively.
>Such results can be calculated with in interesting ways (for example,
>one can find the _sum_ of a list of 1's and 0's to count the number of
>"successes").
>
>On the TI-89 (and the TI-92, of course), the boolean result returned is
>an _actual value_ of "true" or "false".  It is easy enough to convert an
>array of numeric booleans tto this form -- for example, if L is a list
>of 1's and 0's, one can generate a list of "true" and "false" values by
>the command L = (1+newList(dim(L)).
>
>But you can't _calculate_ with such a value (at least as far as I know).
>Does anyone know an easy way to turn an array of booleans back into an
>array of 0's and 1's?

Here's how I did it on a TI-92 (this works for matrices as less as lists).
Define the function bool(x) as follows:

Func bool(x)
If getType(x)="LIST" Then
  Return seq(bool(x[i]),i,1,dim(x),1)
ElseIf getType(x)="MAT" Then
  Return list mat(bool(mat list(x)),colDim(x))
ElseIf x Then
  Return 1
Else
  Return 0
EndIf
EndFunc

Darryl K. Nester                E-mail: mailto:nesterd@bluffton.edu
Assoc. Prof. of Mathematics        WWW: http://www.bluffton.edu/~nesterd
Bluffton College                 Phone: 419-358-3483
Bluffton, OH  45817-1704           Fax: 419-358-3232


References: