RodriguesRotationFormular
- Subject: RodriguesRotationFormular
- From: 古谷剛生
- Date: Tue, 14 Nov 2006 12:27:41 +0900
hi all
I rewrite yogen.mac ,named quaternion.mac.
maybe it will increase usability,i think.
please put it share/contrib/quaternion.mac.
RodriguesRotationFormular is OK.
(%i1) load("quaternion.mac");
(%o1) quaternion.mac
(%i2) declare([_e,_f,_g,t],scalar)$
(%i3) declare([_a,_b,_c],scalar)$
(%i4) x:_e*i+_f*j+_g*k$
(%i5) y:_a*i+_b*j+_c*k$
(%i6) expand4((cos(t)+x*sin(t)).conj4(cos(t)+x*sin(t)))$
(%i7) load("coeflist.lisp")$
(%i8) load("format.lisp")$
(%i9) format(%o6,%poly('sin(t)^2,'cos(t)^2),factor);
2 2 2 2 2
(%o9) sin (t) (_g + _f + _e ) + cos (t)
(%i10) expand4((cos(t/2)+x*sin(t/2)).y.(cos(t/2)-x*sin(t/2)))$
(%i11) format(%,%poly(i,j,k),factor)$
(%i12) coefmatrix([coeff(%,i),coeff(%,j),coeff(%,k)],[_a,_b,_c])$
(%i13) trigsimp(subst([_g^2=1-_f^2-_e^2],%))$
(%i14) trigreduce(%)$
(%i15) format(%,%poly(_g,_f,_e),factor);
[ 2 ]
[ cos(t) - (cos(t) - 1) _e ]
(%o15) Col 1 = [ ]
[ sin(t) _g - (cos(t) - 1) _e _f ]
[ ]
[ - (cos(t) - 1) _e _g - sin(t) _f ]
[ - sin(t) _g - (cos(t) - 1) _e _f ]
[ ]
Col 2 = [ 2 ]
[ cos(t) - (cos(t) - 1) _f ]
[ ]
[ sin(t) _e - (cos(t) - 1) _f _g ]
[ sin(t) _f - (cos(t) - 1) _e _g ]
[ ]
Col 3 = [ - (cos(t) - 1) _f _g - sin(t) _e ]
[ ]
[ 2 2 ]
[ (cos(t) - 1) _f + (cos(t) - 1) _e + 1 ]
basematrix1 and basematrix2 are defined in this file.
basematrix1:[matrix([0,-%i],[-%i,0]),matrix([0,-1],[1,0]),matrix([-%i,0],[0,%i])];
this means ,basematrix1 is representing [i,j,k] with matrix.
(%i16) matcoeff4(matrix([1,-2*%i-3],[3-2*%i,1]),basematrix1);
[ 1 0 ] [ 2 0 ] [ 3 0 ] [ 0 0 ]
(%o16) [[ ], [ ], [ ], [ ]]
[ 0 1 ] [ 0 2 ] [ 0 3 ] [ 0 0 ]
this means ,matrix([1,-2*%i-3],[3-2*%i,1])is representing [1+2*i+3*j] with
basematrix
(%i17) matcoeff4(matrix([1,0],[0,1]),basematrix1);
[ 1 0 ] [ 0 0 ] [ 0 0 ] [ 0 0 ]
(%o17) [[ ], [ ], [ ], [ ]]
[ 0 1 ] [ 0 0 ] [ 0 0 ] [ 0 0 ]
so matrix([1,0],[0,1])is 1
(%i18) matcoeff4(matrix([0,%i],[%i,0]),basematrix1);
[ 0 0 ] [ - 1 0 ] [ 0 0 ] [ 0 0 ]
(%o18) [[ ], [ ], [ ], [ ]]
[ 0 0 ] [ 0 - 1 ] [ 0 0 ] [ 0 0 ]
so matrix([0,%i],[%i,0]) is -i
but next example matrix([1,-2],[3,1]) can not be represent by quaternion
(%i19) matcoeff4(matrix([1,-2],[3,1]),basematrix1);
[ %i ] [ 5 ]
[ -- 0 ] [ - 0 ]
[ 1 0 ] [ 2 ] [ 2 ] [ 0 0 ]
(%o19) [[ ], [ ], [ ], [ ]]
[ 0 1 ] [ %i ] [ 5 ] [ 0 0 ]
[ 0 -- ] [ 0 - ]
[ 2 ] [ 2 ]
if to represent this is possible,it 1+(%i/2)*i+5/2*j,do you think?
last you may set matrix_element_mult to "*"
(%i20) matrix_element_mult:"*";
(%o20) *
thanks
Gosei Furuya
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quaternion.mac
Type: application/octet-stream
Size: 2783 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20061114/47b6c205/attachment-0001.obj