%mathpiper,def="IsOrthogonal"

IsOrthogonal(A_IsMatrix) <-- (Transpose(A)*A=Identity(Length(A)));

%/mathpiper



%mathpiper_docs,name="IsOrthogonal",categories="User Functions;Matrices (Predicates);Predicates"
*CMD IsOrthogonal --- test for an orthogonal matrix
*STD
*CALL
	IsOrthogonal(A)

*PARMS

{A} -- square matrix

*DESC

{IsOrthogonal(A)} returns {True} if {A} is orthogonal and {False} 
otherwise. $A$ is orthogonal iff $A$*Transpose($A$) = Identity, or
equivalently Inverse($A$) = Transpose($A$).

*E.G.

In> A := {{1,2,2},{2,1,-2},{-2,2,-1}};
Result: {{1,2,2},{2,1,-2},{-2,2,-1}};
In> PrettyForm(A/3)

	/                      \
	| / 1 \  / 2 \ / 2 \   |
	| | - |  | - | | - |   |
	| \ 3 /  \ 3 / \ 3 /   |
	|                      |
	| / 2 \  / 1 \ / -2 \  |
	| | - |  | - | | -- |  |
	| \ 3 /  \ 3 / \ 3  /  |
	|                      |
	| / -2 \ / 2 \ / -1 \  |
	| | -- | | - | | -- |  |
	| \ 3  / \ 3 / \ 3  /  |
	\                      /
Result: True;
In> IsOrthogonal(A/3)
Result: True;
%/mathpiper_docs