Ask Your Question
0

How do I multiply quaternion and vector?

asked 2015-07-31 03:33:17 +0100

uutzinger gravatar image

updated 2015-07-31 03:48:37 +0100

I started with this

N.<c,d,a1,a2,a3,a4,b1,b2,b3,b4,s> = QQ[]
H.<i,j,k> = QuaternionAlgebra(c,d)
a = a1 + a2 * i + a3 * j + a4 * k
b = b1 + b2 * i + b3 * j + b4 * k
a+b
a*b

but the next step does not work

gravity = vector([0, 0, 1])
a * gravity * a.conjugate()
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-31 08:21:34 +0100

rws gravatar image

Not sure but maybe you need to convert to matrix beforehand? If I append zero to the gravity vector I get

sage: gravity = vector([0, 0, 1, 0])
sage: a.matrix() * gravity * a.conjugate().matrix()
(-c^2*d*a2*a4 - c^2*a2*a4 - d*a1*a3 + a1*a3, c*d*a2*a3 + c*a1*a4 + d*a1*a4 - a2*a3, -c^2*a2^2 - c^2*a4^2 + a1^2 - a3^2, -c*a1*a2 - c*a3*a4 + a1*a2 - a3*a4)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-31 03:33:17 +0100

Seen: 320 times

Last updated: Jul 31 '15