Algosim documentation: ⟂

⟂ (perpendicular)

Checks if two vectors are orthogonal or if two integers are coprime.

Syntax

Description

If u and v are vectors of the same dimension, then u ⟂ v is true iff u and v are orthogonal, that is, iff their inner product (u|v) = 0.

If a and b are integers, then a ⟂ b is true iff a and b are coprime.

Notes

The operator is implemented by the ArePerpendicular function. This function also supports a third argument specifying the epsilon to use for floating-point comparison in the vector orthogonality test.

To test if two integers are coprime, the coprime function can also be used.

Examples

❨1, 1, 0❩ ⟂ ❨0, 0, 1❩
true
u, v ≔ ❨1, 1, 1❩/√3, ❨1, −2, 1❩/√6; x ≔ ❨4, 1, 3❩;
p ≔ (x|u)⋅u + (x|v)⋅v;
(x − p) ⟂ u
true
(x − p) ⟂ v
true
53121751 ⟂ 6985871
true

See also

Vectors

Integers