HP Forums
Comparing Matrices (in CAS Mode?) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Comparing Matrices (in CAS Mode?) (/thread-7153.html)



Comparing Matrices (in CAS Mode?) - Eddie W. Shore - 11-02-2016 03:48 AM

I am trying create a matrix program in CAS mode, isorthogonal, to test whether a matrix is orthogonal:

#cas
isorthogonal(m):=
BEGIN
LOCAL s,n,p;
s:=SIZE(m);
s:=s(1);
n:=IDENMAT(s);
p:=simplify(TRN(m)*m));
IF n==p THEN
RETURN 1;
ELSE
RETURN 0;
END;
END;
#end

Testing [[2,0][0,2]] and [[2*x,0][0,2*x]] I get the error

"For: Unable to check test Error: Bad Argument Value"

Are we not able to compare matrices in CAS mode? Thanks,

Eddie


RE: Comparing Matrices (in CAS Mode?) - roadrunner - 11-02-2016 11:33 AM

You have an extra ")" in this line:

p:=simplify(TRN(m)*m));

I changed it to:

p:=simplify(TRN(m)*m);

and your program seems to work correctly for me.

-road