Ask Your Question
1

Sage subs() function include product condition

asked 2018-12-04 04:41:19 -0600

linuxCipher gravatar image

updated 2018-12-06 10:48:27 -0600

kcrisman gravatar image

Code:

from brial import *
katan=declare_ring([Block('x',32),Block('k',80)],globals())

r1=x(3)*x(8) + x(7) + x(10)*x(12) + x(18) + x(23) + k(1) + k(16)

r2 = r1.subs({x(3)*x(8)+x(7)+ x(10)*x(12)+ x(18) + x(23) + k(1) + k(16) : 0})
print(r2)

this is a sage code, make r1 equals a polynomial include some variables, then use the subs() function to fix some variable, in this case, let the polynomial equals 0, so the expected result of r2 is 0, but the sage gives the result is

x(7) + x(10)*x(12) + x(18) + x(23) + k(1) + k(16)

i know , some thing wrong with the x(3)*x(8), but i don't know how to make it right.

edit retag flag offensive close merge delete

Comments

kcrisman gravatar imagekcrisman ( 2018-12-07 12:38:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-12-06 11:14:07 -0600

slelievre gravatar image

If you want to mod out by r1, you could use a quotient ring.

One good option is to project to the quotient ring and then lift back to the original ring.

sage: from brial import *
sage: katan = declare_ring([Block('x', 32), Block('k', 80)], globals())
sage: r1 = x(3)*x(8) + x(7) + x(10)*x(12) + x(18) + x(23) + k(1) + k(16)
sage: r1
x(3)*x(8) + x(7) + x(10)*x(12) + x(18) + x(23) + k(1) + k(16)
sage: J = katan.ideal([r1])
sage: R = katan.quotient(J)
sage: r2 = R(r1).lift()
sage: r2
0
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-12-04 04:41:19 -0600

Seen: 69 times

Last updated: Dec 06