
3.3. MATRICES 121
R :=
⎡
⎣
cosψ cosφ −sinψ cosθ sinφ, cosψ sinφ +sinψ cosθ cosφ, sinψ sinθ
−sinψ cosφ −cosψ cosθ sinφ, −sinψ sinφ +cosψ cosθ cosφ, cosψ sinθ
sinθ sinφ, −sinθ cosφ, cosθ
⎤
⎦
The inverse rotation matrix Rinv for rotating from the primed coordinates to
the unprimed ones is obtained by applying the MatrixInverse command to R
and simplifying with the trigonometric option.
>
Rinv:=simplify(MatrixInverse(R),trig);
Rinv :=
⎡
⎣
cosψ cosφ −sinψ cosθ sinφ, −sinψ cosφ −cosψ cosθ sinφ, sinθ sinφ
cosψ sinφ +sinψ cosθ cosφ, −sinψ sinφ +cosψ cosθ cosφ, −sinθ cosφ
sinψ sinθ, cosψ sinθ, cosθ
⎤
⎦
To illustrate vector rotation (the inverse of coordinate rotation), let’s evaluate
Rinv for φ =π/3, θ= π/4, and ψ = π/6 radians.
>
Rinv:=eval(Rinv,{p=Pi/3,t=Pi/4,s=Pi/6});
Rinv :=
⎡
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎣
√
3
4
−
√
2
√
3
8
−
1
4
−
3
√
2
8
√
2
√
3
4
3
4
+
√
2
8
−
√
3
4
+
√
2
√
3
8
−
√
2
4
√
2
4
√
2
√
3
4
√
2
2
⎤
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦
The following column vectors, each of length 8 units, are entered.
>
v1:=<8,0,0>: v2:=<0,8,0>: v3:=<0,0,8>:
Then the inverse rotation matrix Rinv is applied to each vector.
>
w1:=Rinv . v1; w2:=Rinv . v2; w3:=Rinv . v3;
w1 :=
⎡
⎣
2
√
3 −
√
2
√
3
6+
√
2
2
√
2
⎤
⎦
w2 :=
⎡
⎣
−2 − 3
√
2
−2
√
3+
√
2
√
3
2
√
2
√
3
⎤
⎦
w3 :=
⎡
⎣
2
√
2
√
3
−2
√
2
4
√
2
⎤
⎦
The rotated vectors will be of exactly the same length as the original vectors.
For example, it is confirmed in the following command line, using the Norm
command, that w1 is 8 units long.
>
simplify(Norm(w1,2));
8
To plot the original and rotated vectors, an arrow operator F is formed to plot
an arbitrary vector v as a cylindrical arrow with its tail at the origin. The color
c of the arrow must be specified. Using F,thenv1 , v2 ,andv3 are plotted as
red arrows, and w1 , w2 ,andw3 as blue arrows.
>
F:=(v,c)->arrow(<0,0,0>,v,shape=cylindrical arrow,color=c,
width=0.15,head
width=0.4,head length=0.5):
>
a[1]:=F(v1,red): a[2]:=F(v2,red): a[3]:=F(v3,red):
>
a[4]:=F(w1,blue): a[5]:=F(w2,blue): a[6]:=F(w3,blue):