1
$\begingroup$

Not sure if this question belongs in this form but I don't know where else to go. I'm trying to index a matrix and do a < comparison on it. Every time I try something like A[1] it says:

Error, a Vector is not valid lhs to < or <=.

Can anyone help?

EXAMPLE:

A:=<1,2,3>:

b:=A[2]:

if b < 2 then .....

  • 0
    Adding to Henning's comment, you need to properly define < on vectors. For example, you can compare the n^th norms of vectors by _norm(A, n)_. Or you could compare the two vectors component-wise as follow. _C := zip((x,y) -> evalb(x < y), A, B);_ and then _andmap(\`=\`, C, true);_2011-10-01

1 Answers 1

1

Which version of Maple are you using? For me, using Maple 12, the following works just fine:

A := <1,2,3>; 

$A := \begin{bmatrix}1 \\ 2 \\ 3\end{bmatrix}$

b := A[2]; 

$b := 2$

is(b < 2); 

$false$

is(b <= 2); 

$true$

  • 0
    yea well thats what i was trying to do but for for some reason my if statement wouldn't work. give you credit anyways2011-10-04