Algosim documentation: commute

commute

Tests if two matrices commute.

Syntax

Description

If A and B are matrices, then commute(A, B) returns true iff A and B commute, with floating-point comparisons made with epsilon ε. If omitted, a default (but non-zero) epsilon is used.

Examples

A ≔ RotationMatrix(π/3, ❨0, 0, 1❩)
⎛            0.5  −0.866025403784                0⎞
⎜ 0.866025403784              0.5                0⎟
⎝              0                0                1⎠
B ≔ ReflectionMatrix(❨0, 0, 1❩)
⎛ 1   0   0⎞
⎜ 0   1   0⎟
⎝ 0   0  −1⎠
commute(A, B)
true