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));

matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])

> orthog(A);

true

> det(A);

1

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));

{vector([1, -1, 1])}

> arccos((trace(A)-1)/2);

1/3*Pi

> n:=vector([1,1,1]):u:=vector([1,1,0]):dotprod(crossprod(n,u),A&*u);

1

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);

vector([1, -1, 1]), 1/3*Pi

> analyse_rotation(B);

false

Réflexions

> orthog(B),det(B);

true, -1

> evalm(B^2);

matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])

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));

{vector([1, 1, 0]), vector([-1, 0, 1])}

> kernel(B+Matrix(3,3,shape=identity));

{vector([1, -1, 1])}

> nops(colspan(evalm(A^2-Matrix(3,3,shape=identity))));

2

> nops(colspan(evalm(B^2-Matrix(3,3,shape=identity))));

0

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);

false, vector([1, -1, 1])

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);

vector([-1, 2, -1]), Pi, false

> analyse_rotation(DD),analyse_reflexion(DD);

false, vector([1, -2, 2])

> analyse_rotation(E),analyse_reflexion(E);

false, false