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)



> 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to