Create a symbolic orthonormal matrix in mathematics

I need to create 3 ~ 3 real orthonormal symbolic matrix in Mathematica. How can i do this?

+6
source share
5 answers

Not that I recommend this, but ...

m = Array[a, {3, 3}]; {q, r} = QRDecomposition[m]; q2 = Simplify[q /. Conjugate -> Identity] 

So q2 is a symbolic orthogonal matrix (assuming we are working on actions).

+11
source

It seems you need some kind of parameterization of the SO(3) group in Mathematica, I think. You will have only 3 independent symbols (variables), since you have 6 restrictions on the mutual orthogonality of vectors and norms equal to 1. One way is to build independent rotations around three axes and multiply these matrices. Here's the (possibly too complicated) code for this:

 makeOrthogonalMatrix[p_Symbol, q_Symbol, t_Symbol] := Module[{permute, matrixGeneratingFunctions}, permute = Function[perm, Permute[Transpose[Permute[#, perm]], perm] &]; matrixGeneratingFunctions = Function /@ FoldList[ permute[#2][#1] &, {{Cos[#], 0, Sin[#]}, {0, 1, 0}, {-Sin[#], 0, Cos[#]}}, {{2, 1, 3}, {3, 2, 1}}]; #1.#2.#3 & @@ MapThread[Compose, {matrixGeneratingFunctions, {p, q, t}}]]; 

Here's how it works:

 In[62]:= makeOrthogonalMatrix[x,y,z] Out[62]= {{Cos[x] Cos[z]+Sin[x] Sin[y] Sin[z],Cos[z] Sin[x] Sin[y]-Cos[x] Sin[z],Cos[y] Sin[x]}, {Cos[y] Sin[z],Cos[y] Cos[z],-Sin[y]}, {-Cos[z] Sin[x]+Cos[x] Sin[y] Sin[z],Cos[x] Cos[z] Sin[y]+Sin[x] Sin[z],Cos[x] Cos[y]}} 

You can verify that the matrix is โ€‹โ€‹orthonormalized using Simplify for various point products of columns (or rows).

+4
source

I found a โ€œdirectโ€ way to impose special orthogonality. See below.

 (*DEFINITION OF ORTHOGONALITY AND SELF ADJUNCTNESS CONDITIONS:*) MinorMatrix[m_List?MatrixQ] := Map[Reverse, Minors[m], {0, 1}] CofactorMatrix[m_List?MatrixQ] := MapIndexed[#1 (-1)^(Plus @@ #2) &, MinorMatrix[m], {2}] UpperTriangle[ m_List?MatrixQ] := {m[[1, 1 ;; 3]], {0, m[[2, 2]], m[[2, 3]]}, {0, 0, m[[3, 3]]}}; FlatUpperTriangle[m_List?MatrixQ] := Flatten[{m[[1, 1 ;; 3]], m[[2, 2 ;; 3]], m[[3, 3]]}]; Orthogonalityconditions[m_List?MatrixQ] := Thread[FlatUpperTriangle[m.Transpose[m]] == FlatUpperTriangle[IdentityMatrix[3]]]; Selfadjunctconditions[m_List?MatrixQ] := Thread[FlatUpperTriangle[CofactorMatrix[m]] == FlatUpperTriangle[Transpose[m]]]; SO3conditions[m_List?MatrixQ] := Flatten[{Selfadjunctconditions[m], Orthogonalityconditions[m]}]; (*Building of an SO(3) matrix*) mat = Table[Subscript[m, i, j], {i, 3}, {j, 3}]; $Assumptions = SO3conditions[mat] 

Then

 Simplify[Det[mat]] 

gives 1; ... and

 MatrixForm[Simplify[mat.Transpose[mat]] 

gives the identity matrix; ... at last

 MatrixForm[Simplify[CofactorMatrix[mat] - Transpose[mat]]] 

gives a zero matrix.

==================================================== ========================

This is what I was looking for when I asked my question! However, let me know your thoughts on this method.

Marcellus

+4
source

Marcellus, you need to use some parameterization of SO (3), since your general matrix should reflect RP 3 group topologies . No parameterization will cover the entire group without any ambiguity or special points. Wikipedia has a nice page about various diagrams on SO (3) .

Perhaps one of the conceptually simple is the exponential map from the Lie algebra so (3). We define an antisymmetric real A (which embraces in this way (3))

 A = {{0, a, -c}, {-a, 0, b}, {c, -b, 0}}; 

Then MatrixExp[A] is an element from SO(3) . We can verify that this is so using

 Transpose[MatrixExp[A]].MatrixExp[A] == IdentityMatrix[3] // Simplify 

If we write t^2 = a^2 + b^2 + c^2 , we can simplify the matrix exponent to

 {{ b^2 + (a^2 + c^2) Cos[t] , bc (1 - Cos[t]) + at Sin[t], ab (1 - Cos[t]) - ct Sin[t]}, {bc (1 - Cos[t]) - at Sin[t], c^2 + (a^2 + b^2) Cos[t] , ac (1 - Cos[t]) + bt Sin[t]}, {ab (1 - Cos[t]) + ct Sin[t], ac (1 - Cos[t]) - bt Sin[t], a^2 + (b^2 + c^2) Cos[t]}} / t^2 

Note that this is basically the same parameterization as RotationMatrix . Compare with exit

 RotationMatrix[s, {b, c, a}] // ComplexExpand // Simplify[#, Trig -> False] &; % /. a^2 + b^2 + c^2 -> 1 
+3
source

Although I really like the idea of โ€‹โ€‹Marcellus answering his own question, this is not entirely correct. Unfortunately, the conditions in which he comes also lead to

 Simplify[Transpose[mat] - mat] 

estimating the zero matrix! This is clearly not the case. Here's an approach that is correct and more direct:

 OrthogonalityConditions[m_List?MatrixQ] := Thread[Flatten[m.Transpose[m]] == Flatten[IdentityMatrix[3]]]; SO3Conditions[m_List?MatrixQ] := Flatten[{OrthogonalityConditions[m], Det[m] == 1}]; 

i.e. multiplying the rotation matrix by its transposition leads to the identity matrix, and the determinant of the rotation matrix is โ€‹โ€‹1.

+2
source

Source: https://habr.com/ru/post/903380/


All Articles