All problems
Zero Vector Check
Problem
Check whether a vector is (numerically) the zero vector.
Return True if every entry has absolute value below 1e-9, and False otherwise. The empty vector counts as zero.
Hint
Use a small tolerance rather than exact equality.
Test cases
case 1
in: [[0,0,0]]
expected: true
case 2
in: [[0,1e-10]]
expected: true
case 3
in: [[0,0.001]]
expected: false
case 4
in: [[]]
expected: true
case 5
in: [[1e-10,-1e-10,0]]
expected: true
Starter codePython
def zero_vector_check(v):
# Your code here
pass5 test cases · run your code against them in the editor