Janek Kozicki a ?crit :
> Hi,
>
> I don't know how to multiply two quaternions. Let's say that I want
> to multiply two quaternions:
>
> (1,2,3,4)*(5,6,7,8)
>
> How do I do that?
>
The quaternions i,j,k are v[1],v[2] and v[1] . v[2] (note the blank
around the dot, important when using subst).
So you may try this :
(%i2) load(atensor)$
(%i3) init_atensor(quaternion)$
(%i4) q(a,b,c,d):=a+b.v[1]+c.v[2]+d.v[1].v[2]$
p:expand(atensimp(q(1,2,3,4).q(5,6,7,8)));
(%o5) (%i5) 24*v[1] . v[2]+30*v[2]+12*v[1]-60
(%i6) conj(x):=subst([v[1]=-v[1],v[2]=-v[2],v[1] . v[2]=-v[1] . v[2]] , x)$
(%i7) conj(p);
(%o7) -24*v[1] . v[2]-30*v[2]-12*v[1]-60
Note that if you try
(%i8) p:expand(atensimp(q(a,b,c,d).q(e,f,g,h)));
you get an awful answer. Remember first to
(%i9) declare([a,b,c,d,e,f,g,h],scalar);
then the answer is better (but the terms in v[1], v[2] and v[1] . v[2]
are not yet collected).
Eric
> >From reading help I only know that I should start with:
>
> load(atensor);
> init_atensor(quaternion);
>
> But then it starts talking about matrices, but quaternions are not
> matrices, just a real number and three imaginary numbers. So I cannot
> make any sense out of this.
>
> How do I define a quaternion variable, how do I multiply two of those?
>
> How do I conjugate, invert, logarithm, etc... a quaternion?
>
>
> please help
>