Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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?

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?

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?

click to hide/show revision 4
retagged

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?

click to hide/show revision 5
None

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?