Hi all,
I'm trying to do a detecting system for terms in the equations used in a polynomial. I'm using Boolean Polynomials here.
Here's is my code. This prints all the terms of the equations.
P.<x,y,z> = BooleanPolynomialRing(3, order = 'lex')
equations = [x+y+z-1, y*z, x+z]
for i in range(len(equations)):
for j in equations[i]:
print j
Output:
x
y
z
1
y*z
x
z
As you can see, 1 appears in the output. However, when I implement this logic onto it, the output is empty.
for i in range(len(equations)):
for j in equations[i]:
if j == 1:
print 'true'
It's not like the logic doesn't work, if I change '1' to 'x', my logic works.
for i in range(len(equations)):
for j in equations[i]:
if j == x:
print 'true'
Output:
true
true
What am I doing wrong here?