Hello,

I'm new to sympy so please excuse me if this question is obvious to
the experienced.

In multibody kinematics there is a classic relationship between a
rotating body's angular velocity and the rotation matrices
representing the configuration at a given point in time. Basically, if
I am using a roll/pitch/yaw representation of the rotation then I have
three rotation matrices that comprise the full instantaneous rotation,

R =  rotx(gamma) * roty(beta) * rotz(alpha)

Meaning, if I rotate the body by 'alpha' about a body fixed 'Z' axis,
followed by a rotation 'beta' about the once rotated body fixed 'Y'
axis, followed by a rotation 'gamma' about the twice rotated body
fixed 'X' axis... I now have a complete instantaneous rotation matrix
R.

The relationship of the angular velocity of the body is,

skew(w) = Rdot * R.transpose

so, a new skew symmetric matrix is created from the matrix product
between the time derivative of R and the transpose of R. (Since alpha,
beta, and gamma are all functions of time then R is a function of
time.)

Completing the above described equations in Mathematica does in fact
give me a skew-symmetric matrix. However, my first attempt in SYMPY
did not produce a skew-symmetric matrix. So, I'm including the code
below and asking the group if there is a simple newbie user error I
may have performed causing the problem. Or, is this simply a
limitation of SYMPY?  By the way, TRIGSIMP() did not help...

<snip>
from sympy import *

t = Symbol('t')
a = Symbol('a')
b = Symbol('b')
g = Symbol('g')

rotX = Matrix([ [1,  0,         0],
                [0,  cos(g(t)), sin(g(t))],
                [0, -sin(g(t)), cos(g(t))] ])
rotY = Matrix([ [cos(b(t)),  0,         -sin(b(t))],
                [0,          1,          0],
                [sin(b(t)), 0,           cos(b(t))] ])
rotZ = Matrix([ [cos(a(t)),  sin(a(t)),  0],
                [-sin(a(t)),  cos(a(t)),  0],
                [0,          0,          1] ])

R = rotX * rotY * rotZ
Rdot = R.diff(t)
skew = Rdot * R.T

print ''
print 'skew = '
print skew

# 'skew' should result in a skew-symmetic matrix.
# or, of the form,
#  [[ 0,   -w_z,   w_y ],
#   [ w_z,  0,    -w_x],
#   [-w_y,  w_x,   0] ]
#
# where w = [w_x, w_y, w_z]^T
#
# looks like SYMPY fails to produce this results, yet, this same code
in
# Mathematica works as expected...
#
# is this a result of a "newbie" mistake? Or, a limitation of sympy?

print ''
print 'trigsimp(skew[0,0]) = '
print trigsimp(skew[0,0])
</snip>

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to