Quaternion Function Reference

commutator

Commutator

Syntax

C = commutator(X, Y, option)

Description

C = commutator(X, Y) returns X .* Y - Y .* X and C = commutator(X, Y, 'diff') returns the same result.

C = commutator(X, Y, 'prod') returns the quaternion c that multiplies the product X .* Y on the right to give the result of the product Y .* X.

Examples

>> x = randq; y = randq;
>> x .* y .* commutator(x, y, 'prod')

ans =

0.254 + 0.8994 * I + 0.313 * J + 0.169 * K

>> y .* x

ans =

0.254 + 0.8994 * I + 0.313 * J + 0.169 * K

Reals commute so the commutator of any two reals will be zero:

>> commutator(randn, randn)

ans = 0

See Also

QTFM function: associator

(c) 2008-2016 Stephen J. Sangwine and Nicolas Le Bihan

License terms.