All problems
Orthogonal Set Check
Problem
Check whether a collection of equal-length vectors forms an orthogonal set.
All vectors must be nonzero and every pair must satisfy v_i . v_j = 0 within 1e-9. Return True only if both conditions hold.
Hint
An orthogonal set cannot contain the zero vector, because 0 is orthogonal to everything.
Test cases
case 1
in: [[[1,1],[1,-1]]]
expected: true
case 2
in: [[[1,0],[1,1]]]
expected: false
case 3
in: [[[1,0],[0,1],[1,1]]]
expected: false
case 4
in: [[[0,0],[1,0]]]
expected: false
case 5
in: [[[1,1],[1,-1.0000000001]]]
expected: true
Starter codePython
def orthogonal_set_check(vectors):
# Your code here
pass5 test cases · run your code against them in the editor