quaternion norm

26 views
Skip to first unread message

Ben P

unread,
Jun 16, 2015, 6:54:14 PM6/16/15
to sage-s...@googlegroups.com
I am tracking rotation of an object using quaternions by accumulating each successive rotation using quaternion composition.
I notice that probably due to rounding errors, the norm of each successive quaternion is drifting from being 1, which means I need to normalize the quaternion.
Is there an in-build function that would let me do this? 
Otherwise, I can divide the quaternion by its norm. Is there a method I can call on the quaternion to extract its norm?

I looked at the Quaternion documentation page but did not find anything there Here is the page I am referring to: http://doc.sagemath.org/html/en/reference/quat_algebras/sage/algebras/quatalg/quaternion_algebra.html


Thanks
Ben

Dima Pasechnik

unread,
Jun 17, 2015, 7:49:19 AM6/17/15
to sage-s...@googlegroups.com


On Tuesday, 16 June 2015 23:54:14 UTC+1, Ben P wrote:
I am tracking rotation of an object using quaternions by accumulating each successive rotation using quaternion composition.
I notice that probably due to rounding errors, the norm of each successive quaternion is drifting from being 1, which means I need to normalize the quaternion.
Is there an in-build function that would let me do this? 
Otherwise, I can divide the quaternion by its norm. Is there a method I can call on the quaternion to extract its norm?

for r an element of your quaternion algebra Q, you can do something like

 vector(r.coefficient_tuple())*Q.inner_product_matrix()* vector(r.coefficient_tuple())

to get some kind of norm (probably you'd need to scale it)


Reply all
Reply to author
Forward
0 new messages