Orthogonal Matrix Test

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Orthogonal Matrix Test (/thread-7168.html)



Orthogonal Matrix Test - Eddie W. Shore - 11-04-2016 01:31 PM

For the square matrix M, it is orthogonal when either of the following conditions are met:

(I) M * M^T = M^T * M = I
(II) M^-1 = M^T

The program presented on this blog entry will use the first test. Since matrices, unfortunately, cannot be directly compared on the Casio graphing calculators, a work around with two FOR loops is implemented.

HP Prime Program ORTHOG

Code:
EXPORT ORTHOG(m)
BEGIN
// 2016-11-01 EWS
// orthogonal test
LOCAL n,p,s;
s:=SIZE(m);
s:=s(1);
n:=TRN(m)*m;
p:=IDENMAT(s);
IF n==p THEN
RETURN 1;
ELSE
RETURN 0;
END;
END;