
Q=RotationMatrix[phi,{0,0,1}].RotationMatrix[theta,{1,0,0}].RotationMatrix[psi,{0,0,1}]
				

Q = Q/.{phi->phi[t],theta->theta[t],psi->psi[t]};
OmegaS = Simplify[Transpose[Q].D[Q,t]]
				
A={{Sin[theta[t]]*Sin[psi[t]],Cos[psi[t]],0},{Cos[psi[t]]*Sin[theta[t]],-Sin[psi[t]],0},{Cos[theta[t]],0,1}}
invA=Simplify[Inverse[A]]
