HI I do not understand why if v.norm !=0 does not work here.
ZeroDivisionError: rational division by zero
def normalizeVectorL(vectorList) :
vNormList=[]
for l in vectorList :
lMatrixList=[]
for v in l :
v=vector(v)
z=zero_vector(v.length())
#if v != z :
if v.norm() != 0 :
show("v :\t",v,"v.norm() :\t",v.norm())
lMatrixList.append(matrix(v/v.norm()).transpose())
else :
lMatrixList.append(matrix(v).transpose())
vNormList.append(lMatrixList)
return vNormList
VVVlist=[]
VVVlist0=[]
VVVlist0.append([1,1,1])
VVVlist0.append([1,1,2])
VVVlist0.append([1,0,0])
VVVlist.append(VVVlist0)
VVVlist1=[]
VVVlist1.append([1,3,1])
VVVlist1.append([1,2,2])
VVVlist1.append([0,0,0])
VVVlist.append(VVVlist1)
show(VVVlist)
show(normalizeVectorList(VVVlist))