Quaternion Function Reference

part

Component of a quaternion or octonion

Syntax

p = part(q, n)

Description

This function extracts one of the four components of a quaternion or one of the eight components of an octonion. The result is a real (or a complex value if the quaternion/octonion has complex components). The parameter must be an integer in the range 1:4 or 1:8 as appropriate. For quaternions, there are also three named functions x, y, and z that can also access the components of the vector part. These are not provided for octonions, as the present function seemed a better implementation, since it is possible to index through the components. The scalar part can also be accessed through the s and scalar functions, which differ in their behaviour if the quaternion/octonion is pure. The present function behaves like s and returns an empty array for a pure quaternion or octonion.

Examples

>> q = quaternion(1, 2, 3, 4)
 
q = 1 + 2 * I + 3 * J + 4 * K
 
>> part(q, 3)

ans = 3

See Also

QTFM functions: s, scalar, v, vector, x/y/z

© 2008-2013 Stephen J. Sangwine and Nicolas Le Bihan

License terms.