# Question:How to obtain accurate rotation matrices?

## Question:How to obtain accurate rotation matrices?

Maple 2016

Hey guys,

I'm trying to build up some program to manage my composites data. But I am struggling with my compliance/stiffness in the global coordinates:

-Basically, I have the lamina's properties in local coordinates.

-When I make walls out of them with 30degress fibers orientation, I need to rotate the local stiffness several times to get the the stiffness of that particular wall.

-While I do understand the concept and manage to get the final rotation matrix correctly, I often find myself making mistakes regarding the sense of rotation of my local axis relatively to the global one.

I try to stick with one direction of rotation but if Maple has a smart way whereas I can plug in the initial configuration of the local coords relatively to the global one, show the final configuration (local aligned to the global), and get the rotation matrix that made it happen, it would be more helpful.

Thank you

Update:

I enclosed an example of the kind of operations I do:

And here is the kind of code I'm using:

 > restart:
 > with(LinearAlgebra):
 > Stiffness:=Matrix(6,6): Stiffness:=Matrix(6, 6, {(1, 1) = 20.4, (1, 2) = .537, (1, 3) = 1.01, (1, 4) = 0., (1, 5) = 0., (1, 6) = -0., (2, 1) = .537, (2, 2) = 1.59, (2, 3) = .73, (2, 4) = 0., (2, 5) = 0., (2, 6) = -0., (3, 1) = 1.01, (3, 2) = .73, (3, 3) = 2.86, (3, 4) = 0., (3, 5) = 0., (3, 6) = -0., (4, 1) = 0., (4, 2) = 0., (4, 3) = 0., (4, 4) = 1.5, (4, 5) = 0., (4, 6) = -0., (5, 1) = 0., (5, 2) = 0., (5, 3) = 0., (5, 4) = 0., (5, 5) = 2., (5, 6) = -0., (6, 1) = 0., (6, 2) = 0., (6, 3) = 0., (6, 4) = 0., (6, 5) = 0., (6, 6) = .8});
 (1)
 > Q1:=Matrix(3,3): Q1[1,1]:=sin(Pi/4); Q1[1,2]:=0; Q1[1,3]:=cos(Pi/4); Q1[2,1]:=cos(Pi/4); Q1[2,2]:=0; Q1[2,3]:=-sin(Pi/4); Q1[3,1]:=0; Q1[3,2]:=1; Q1[3,3]:=0;
 (2)
 > Q1;
 (3)
 > Q2:=Matrix(3,3): Q2[1,1]:=0; Q2[1,2]:=0; Q2[1,3]:=1; Q2[2,1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5[2,2]; R[5,3]:=S5[3,3]*S5[2,3]; R[5,4]:=S5[3,2]*S5[2,3]+S5[3,3]*S5[2,2]; R[5,5]:=S5[3,1]*S5[2,3]+S5[3,3]*S5[2,1]; R[5,6]:=S5[3,1]*S5[2,2]+S5[3,2]*S5[2,1];R[6,1]:=S5[3,1]^2; R[6,2]:=S5[3,2]^2; R[6,3]:=S5[3,3]^2; R[6,4]:=2*S5[3,3]*S5[3,2]; R[6,5]:=2*S5[3,1]*S5[3,3]; R[6,6]:=2*S5[3,1]*S5[3,2];
 (11)
 > print(R);
 (12)
 > RTrans:=Transpose(R);
 (13)
 > Stiff1:=Matrix(6,6): Stiff1:=Multiply(Stiffness, RTrans);
 (14)
 > StiffnessW1:=Matrix(6,6): StiffnessW1:=Multiply(R,Stiff1); evalf(StiffnessW1,3);
 (15)
 >

It is decent enough to get results if human mistakes don't happen when it comes to rotation orientation (which tends to happen more often than not).

I am aware though that it is not written with wits or in an efficient format. If you have a suggestion, Im all ears.

Thanks again

﻿