Ask Your Question
1

Sage subs() function include product condition

asked 2018-12-04 11:41:19 +0200

linuxCipher gravatar image

updated 2018-12-06 17:48:27 +0200

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 19:38:38 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-12-06 18:14:07 +0200

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

Comments

it's very helpful, thank you so much

linuxCipher gravatar imagelinuxCipher ( 2019-01-15 11:50:18 +0200 )edit

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 11:41:19 +0200

Seen: 566 times

Last updated: Dec 06 '18