Ask Your Question

Revision history [back]

When you write:

sage: R = PolynomialRing(GF(2), 3, 'x')

You define a polynomial ring with indeterminates x0, x1, x2:

sage: R
Multivariate Polynomial Ring in x0, x1, x2 over Finite Field of size 2
sage: R.gens()
(x0, x1, x2)

When you write:

sage: x0

You ask for the value of the Python name x0, which is not defined.

You can define the Python names a,b,c to point to the 3 indeterminates x0, x1, x2:

sage: a,b,c = R.gens()
sage: a
x0
sage: a^2+b
x0^2 + x1

If you want each Python name xi to automatically point to the polynomial indeterminate xi, you can use the inject_variables method:

sage: R.inject_variables()
Defining x0, x1, x2

Then you can define your matrix:

sage: A = M([x0^2,x1^2,x2^2, x0^4,x1^4,x2^4, x0^8,x1^8,x2^8])
sage: A
[x0^2 x1^2 x2^2]
[x0^4 x1^4 x2^4]
[x0^8 x1^8 x2^8]