Comparing list and matrix elements



RONALD F MODESITT <rmodesi at msn.com> writes:
> I have the following code I need help debugging. I would appreciate your
> review. I suspect that my comparrison statements are incorrect as noted below.
>
> load(descriptive)$
> L:read_matrix("e:\\spacetimemath\\data.txt",space)$
> ut: length(L)$
> s:zeromatrix(ut,1)$
> for i: 1 thru ut step 1 do
>     s[i,1]: lsum(j,j,L[i]);
> ub: mean(s) + std(s), numer;
> lb: mean(s) - std(s), numer;
> Lstd: matrix([0,0,0,0,0,0]);
> for i: 1 thru 10 step 1 do
>     (x0: s[i],

The last line above is incorrect.  s[i] yields a row of the matrix s,
which in this case is a list of length 1.  A list cannot be compared
using > or <.  The s[i] should be changed to s[i,1] to yield a scalar.

    Best,
     Mark


>     display(x0), - this line executes
>     if(x0 > lb) then display(lb), - this comparrison statement provides no
> output
>     if ((x0 > lb) and (x0 < ub)) then Lstd: addrow(Lstd, L[i])); - this
> comparrison also fails, Lstd has no additional rows.
>
> Many thanks in advance for the help.
>
> Ronald F. Modesitt