remove list element from a list of list with symbolic pi
HI
I'm reporting something that seems odd to me.
I want to remove from a list of lists an element which is itself a list. if I convert the elements to string before comparing them the two lists are equivalent, but if I don't do the string conversion, then SageMath finds a difference between the two lists. equiv which was written by hand is ok, we can remove an element from this list, while the one made by Arrangement does not allow this element to be removed without first having it converted to a string.
upAndRightSidesL=[[2*pi, 2*pi], [0, 2*pi], [pi, 2*pi], [3/2*pi, 2*pi], [1/2*pi, 2*pi], [2*pi, pi],
[2*pi, 0], [2*pi, 3/2*pi], [2*pi, 1/2*pi]]
equiv=[[2*pi, 2*pi], [2*pi, 0], [0, 2*pi], [0, 0]]
print('equiv not build by Arrangements: ', equiv)
## if these 3 lines are not commented then [2*pi, 2*pi] is not removed in newL
#for pt in upAndRightSidesL :
# if pt[0]==2*pi and pt[1] ==2*pi:
# equiv=Arrangements( [pt[0]] + [0] + [pt[0]] + [0] ,2).list()
print('upAndRightSidesL : ', upAndRightSidesL)
print('equiv build by Arrangement : ', equiv)
print(upAndRightSidesL)
def removeFromList(el,L) :
newL=[]
for index in range(len(L)) :
#if str(el) != str(L[index]) : # if string conversion beforehand then both list are ok
if el != L[index] :
newL.append(L[index])
else :
print ('not included',str(el))
return newL
newL=removeFromList(equiv[0],upAndRightSidesL)
show('newL : ',newL)
oops I forgot to write this precision for versions !!.
W11 WSL UBUNTU 22.04 SageMath 9.8