Simplification rules for angular velocity calculations
Subject: Simplification rules for angular velocity calculations
From: Paweł Cesar Sanjuan Szklarz
Date: Wed, 30 May 2012 17:45:46 +0200
Hello.
I would like to make some performance optimization to custom angular
velocities calculations. The direct calculation may be done in the
following way:
rot_x(a):=matrix([1,0,0],[0,cos(a),-sin(a)],[0,sin(a),cos(a)])$
rot_y(a):=matrix([cos(a),0,-sin(a)],[0,1,0],[sin(a),0,cos(a)])$
rot_z(a):=matrix([cos(a),-sin(a),0],[sin(a),cos(a),0],[0,0,1])$
T : rot_z(phi).rot_x(ksi).rot_y(theta);
T_inverse : rot_y(-theta).rot_x(-ksi).rot_z(-phi);
M : diff(T,t) . T_inverse ;
omega : trigsimp( [ M[3][2], M[1][3], M[2][1] ] ) ;
The problem is that when transformation T is much more complicated the
trigsimp operation time is really big :
T_b_g_E : rot_x(wx).rot_y(wy).rot_z(wz) ;
T_g_b_E : rot_z(-wz).rot_y(-wy).rot_x(-wx);
T_b_w1 : rot_z(alpha1).rot_y(beta1).rot_z(-alpha1).rot_z(phi1);
T_w1_b : rot_z(-phi1).rot_z(alpha1).rot_y(-beta1).rot_z(-alpha1);
T : T_w1_b . T_b_g$
T_inverse : T_g_b . T_b_w1$
With this matrices it takes some 30 min to calculate omega.
First, I would like to change this calculation to a more abstract
level, to make the simplifications on the matrix level. The idea is to
have some function/macro to explicitly differentiate the rotation
matrix, assume that gradef(phi,t,phi_t) then
rotDiff(rot_z(phi))
may give as result
rot_z_prime(phi,phi_t)
it means: rot_X(Y) -> rot_X_prime(Y,Y_t)
in this way it may be possible to calculate
rotDiff( T1 . T2 ) -> rotDiff( T1 ) . T2 + T1 . rotDiff( T2 )
and finally
rotDiff( T1 . T2 ) . T2_inverse . T1_inverse
= rotDiff( T1 ) . T2 . T2_inverse . T1_inverse + T1 . rotDiff( T2 )
. T2_inverse . T1_inverse
Now the second step may be a custom simplification rule for the
previous expression, something like
defrule(matchInverse, T . T_inverse , 1)
I have tried by me own, but this is to beyond my capabilities in
maxima. Could you please give me some references or tips on how to
implement this.
Best regards.
Pawe? Cesar Sanjuan Szklarz.