0

I am using Mathematica to solve a hw question. I have the following code:

R1 = {{1, 0, 0}, {0, Cos[ϕ], Sin[ϕ]}, {0, - Sin[ϕ], Cos[ϕ]}};
R2 = {{Cos[θ], 0, -Sin[θ]}, {0, 1, 0}, {Sin[θ], 0, Cos[θ]}};
R1R2 = R1.R2 // MatrixForm
R2R1 = R2.R1 // MatrixForm
(*For small angles, we know Sin[x] = x and Cos[x] = 1, so we use this substitution by using x = 1x10^-10*)
Ab = N[R1R2 /. {\[Theta] -> 1 10^-10, \[Phi] -> 1 10^-10, 
     Cos[\[Theta]] -> 1, Cos[\[Phi]] -> 1}] // MatrixForm
Bb = N[R2R1 /. {\[Theta] -> 1 10^-10, \[Phi] -> 1 10^-10, 
     Cos[\[Theta]] -> 1, Cos[\[Phi]] -> 1}] // MatrixForm
result = Ab - Bb;
result // MatrixForm

I am new to this community so I dont know how to paste the output. But essentially, what it looks like its doing is it shows Ab-Bb (the matrices on wither side of the minus sign), not the result of subtracting the two matrices.

Can someone help fix this?

  • 2
    This has been answered here: https://community.wolfram.com/groups/-/m/t/3029620 – lericr Oct 07 '23 at 18:11
  • 5
    If you want to retain the numeric/symbolic result and have a nice display, consider adding parentheses before // MatrixForm. For example: (R1R2 = R1 . R2) // MatrixForm. – JimB Oct 07 '23 at 18:28
  • What you are calculating has the structure: MatrixForm[...] - MatrixForm[...], hardly what you want. – Daniel Huber Oct 08 '23 at 18:40

0 Answers0