ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 03 Jan 2019 22:54:41 -0600Sage not detecting intergers in Boolean Polynomial Ring?http://ask.sagemath.org/question/44880/sage-not-detecting-intergers-in-boolean-polynomial-ring/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?Stockfish3709Thu, 03 Jan 2019 22:54:41 -0600http://ask.sagemath.org/question/44880/