Identification de matrices orthogonales
> restart:with(linalg):
Warning, the protected names norm and trace have been redefined and unprotected
> A:=matrix([[2/3, -2/3, -1/3], [1/3, 2/3, -2/3], [2/3, 1/3, 2/3]]):B:=matrix([[1/3, 2/3, -2/3], [2/3, 1/3, 2/3], [-2/3, 2/3, 1/3]]):
Rotations
> evalm(A&*transpose(A));
> orthog(A);
> det(A);
C'est donc une matrice de rotation. L'axe est l'ensemble des vecteurs invariants, c'est-à-dire le noyau de A-Id. Le cosinus de l'angle est donné avec la trace. Pour le sinus, ...
> kernel(A-Matrix(3,3,shape=identity));
> arccos((trace(A)-1)/2);
> n:=vector([1,1,1]):u:=vector([1,1,0]):dotprod(crossprod(n,u),A&*u);
Le sinus est >0, donc si on oriente l'axe par le vecteur N, alors l'angle est Pi/3.
>
analyse_rotation:=proc(A)
local v0,theta,w:
if not(orthog(A)) or det(A)<>1 then RETURN(false) fi;
v0:=op(kernel(A-Matrix(3,shape=identity))):
theta:=arccos((trace(A)-1)/2);
if v0[1]=0 then w:=vector([1,0,0]) else w:=vector([v0[2],-v0[1],0]) fi:
if evalf(dotprod(A&*w,crossprod(v0,w)))>0 then RETURN(evalm(v0),theta) else RETURN(evalm(-v0),theta) fi
end:
> analyse_rotation(A);
> analyse_rotation(B);
Réflexions
> orthog(B),det(B);
> evalm(B^2);
Il s'agit donc d'une matrice de réflexion : le plan de la réflexion est l'ensemble des vecteurs invariants. Son orthogonal est l'ensemble des vecteurs envoyés sur leur opposé.
> kernel(B-Matrix(3,3,shape=identity));
> kernel(B+Matrix(3,3,shape=identity));
> nops(colspan(evalm(A^2-Matrix(3,3,shape=identity))));
> nops(colspan(evalm(B^2-Matrix(3,3,shape=identity))));
Peu glorieux : pour tester la condition M^2=I, ce n'est pas si simple !
>
analyse_reflexion:=A->
if not(orthog(A)) or det(A)<>-1 or nops(colspan(evalm(A^2-Matrix(3,3,shape=identity))))>0 then false
else op(kernel(A+Matrix(3,3,shape=identity))) fi:
> analyse_reflexion(A),analyse_reflexion(B);
Identifications
> C:=matrix([[-2/3, -2/3, 1/3], [-2/3, 1/3, -2/3], [1/3, -2/3, -2/3]]):DD:=matrix([[7/9, 4/9, -4/9], [4/9, 1/9, 8/9], [-4/9, 8/9, 1/9]]):E:=matrix([[-26/27, -2/27, -7/27], [-2/27, -23/27, 14/27], [7/27, -14/27, -22/27]]):
> analyse_rotation(C),analyse_reflexion(C);
> analyse_rotation(DD),analyse_reflexion(DD);
> analyse_rotation(E),analyse_reflexion(E);