Ask Your Question
1

How to create in Sage system of equations using elements from boolean field?

asked 5 years ago

Maori gravatar image

I want to create a field on 8 elements, and then, using this elements make a System of equations like:

nb = 8
varl = [c+ str(p) for c in 'xy' for p in range (nb)]
B = BooleanPolynomialRing(names = varl)

f1 = x1 + x7*x2

f2 = x4*x6*x8 + x7

and then....

But in this case Sage give me an error NameError: name 'x1' is not defined

And in this case:

f1 = x[3] + x[1]*x[2]
f2 = x[4]*x[6]*x[2] + x[7]

error: TypeError: 'sage.symbolic.expression.Expression' object does not support indexing

Is there any way to create them in Sage?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

tmonteil gravatar image

When you write f1 = x1 + x7*x2, you assume that the Python name x1 points to the boolean indeterminate x1, but there is nothing in your code that assign the Python name x1 to something.

You can to that with:

sage: B.inject_variables()
Defining x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, y6, y7
Preview: (hide)
link

Comments

Thank you, it helps:)

Maori gravatar imageMaori ( 5 years ago )

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 5 years ago

Seen: 407 times

Last updated: May 30 '19