Ask Your Question

# Revision history [back]

### Declaring symbols in a Field

Lets define a field F.<t> = GF(2^n) now i want to define a variable points of the form x1+x2t+...+xnt^(n-1) and then solving equation with this by comparing coefficients of t^i.

Now I am defining R= PolynomialRing(ZZ,'x',n) c=R.gens() R=R.quotient_ring([c[i]^2-c[i] for i in range(0,n)]) then i get n variables but if I write x= sum(c[i]*t^i for i in (0,n)) I get the parent of x is R. and I am unable to collect the coefficients of t^i. after defining y and z in the same way. if I do X=x+y+z then I am getting the value as a Ring element with monomials in xi's and coefficients in F as X in a Ring element.

Can anyone suggest any way to get the results as f1+f2t+f3t^2+...+fn*t^(n-1) and then collect fi's where fi's are functions in the variables xi's.

### Declaring symbols in a Field

Lets define a field F.<t> = GF(2^n) now i want to define a variable points of the form x1+x2t+...+xnt^(n-1) and then solving equation with this by comparing coefficients of t^i.

Now I am defining R= PolynomialRing(ZZ,'x',n) c=R.gens() R=R.quotient_ring([c[i]^2-c[i] for i in range(0,n)]) then i get n variables but if I write x= sum(c[i]*t^i for i in (0,n)) I get the parent of x is R. and I am unable to collect the coefficients of t^i. after defining y and z in the same way. if I do X=x+y+z then I am getting the value as a Ring element with monomials in xi's and coefficients in F as X in a Ring element.

Can anyone suggest any way to get the results as f1+f2t+f3t^2+...+fn*t^(n-1) and then collect fi's where fi's are functions in the variables xi's.

suppose I want to solve for X,Y in GF(2^3) with X^2Y^2= X^2+(1+t)Y^2

sage: F.<t>=GF(2^3)

sage: R.<a1,a2,b1,b2,c1,c2>= PolynomialRing(ZZ)

sage: R.<a1,a2,b1,b2,c1,c2>= R.quotient_ring([a1^2-a1,a2^2-a2,b1^2-b1,b2^2-b2,c1^2-c1,c2^2-c2])

sage: X=R(a1)+R(b1)t+R(c1)t^2

sage: Y=R(a2)+R(b2)t+R(c2)t^2

sage: X^2*Y^2

Now i want to store this output as A+Bt+Ct^2(how to do this? is my question )

then I do:

sage: X^2+w*Y^2

and I want to store this as E+Ft+Gt^2(is it possible?)

finally I want to solve for ai's and bi's from the eqns A=E, B=F,C=G,ai^2=ai,bi^2=bi,ci^2=ci for i=1,2

### Declaring symbols in a Field

Lets define a field F.<t> = GF(2^n) now i want to define a variable points of the form x1+x2t+...+xnt^(n-1) and then solving equation with this by comparing coefficients of t^i.

Now I am defining R= PolynomialRing(ZZ,'x',n) c=R.gens() R=R.quotient_ring([c[i]^2-c[i] for i in range(0,n)]) then i get n variables but if I write x= sum(c[i]*t^i for i in (0,n)) I get the parent of x is R. and I am unable to collect the coefficients of t^i. after defining y and z in the same way. if I do X=x+y+z then I am getting the value as a Ring element with monomials in xi's and coefficients in F as X in a Ring element.

Can anyone suggest any way to get the results as f1+f2t+f3t^2+...+fn*t^(n-1) and then collect fi's where fi's are functions in the variables xi's.

suppose I want to solve for X,Y in GF(2^3) with X^2Y^2= X^2+(1+t)Y^2

sage: F.<t>=GF(2^3)

sage: R.<a1,a2,b1,b2,c1,c2>= PolynomialRing(ZZ)

sage: R.<a1,a2,b1,b2,c1,c2>= R.quotient_ring([a1^2-a1,a2^2-a2,b1^2-b1,b2^2-b2,c1^2-c1,c2^2-c2])

sage: X=R(a1)+R(b1)t+R(c1)t^2

sage: Y=R(a2)+R(b2)t+R(c2)t^2

sage: X^2*Y^2

Now i want to store this output as A+Bt+Ct^2(how to do this? is my question )

then I do:

sage: X^2+w*Y^2X^2+(1+t)*Y^2

and I want to store this as E+Ft+Gt^2(is it possible?)

finally I want to solve for ai's and bi's from the eqns A=E, B=F,C=G,ai^2=ai,bi^2=bi,ci^2=ci for i=1,2

### Declaring symbols in a Field

Lets define a field F.<t> = GF(2^n) now i want to define a variable points of the form x1+x2t+...+xnt^(n-1) and then solving equation with this by comparing coefficients of t^i.

Now I am defining R= PolynomialRing(ZZ,'x',n) c=R.gens() R=R.quotient_ring([c[i]^2-c[i] for i in range(0,n)]) then i get n variables but if I write x= sum(c[i]*t^i for i in (0,n)) I get the parent of x is R. and I am unable to collect the coefficients of t^i. after defining y and z in the same way. if I do X=x+y+z then I am getting the value as a Ring element with monomials in xi's and coefficients in F as X in a Ring element.

Can anyone suggest any way to get the results as f1+f2t+f3t^2+...+fn*t^(n-1) and then collect fi's where fi's are functions in the variables xi's.

suppose I want to solve for X,Y in GF(2^3) with X^2Y^2= X^2+(1+t)Y^2

sage: F.<t>=GF(2^3)

sage: R.<a1,a2,b1,b2,c1,c2>= PolynomialRing(ZZ)

sage: R.<a1,a2,b1,b2,c1,c2>= R.quotient_ring([a1^2-a1,a2^2-a2,b1^2-b1,b2^2-b2,c1^2-c1,c2^2-c2])

sage: X=R(a1)+R(b1)t+R(c1)t^2

sage: Y=R(a2)+R(b2)t+R(c2)t^2

sage: X^2*Y^2

Now i want to store this output as A+Bt+Ct^2(how to do this? is my question )

then I do:

sage: X^2+(1+t)*Y^2

and I want to store this as E+Ft+Gt^2(is it possible?)possible to do?)

finally I want to solve for ai's and bi's from the eqns A=E, B=F,C=G,ai^2=ai,bi^2=bi,ci^2=ci for i=1,2

### Declaring symbols in a Field

Lets define a field F.<t> = GF(2^n) now i want to define a variable points of the form x1+x2t+...+xnt^(n-1) and then solving equation with this by comparing coefficients of t^i.

Now I am defining R= PolynomialRing(ZZ,'x',n) c=R.gens() R=R.quotient_ring([c[i]^2-c[i] for i in range(0,n)]) then i get n variables but if I write x= sum(c[i]*t^i for i in (0,n)) I get the parent of x is R. and I am unable to collect the coefficients of t^i. after defining y and z in the same way. if I do X=x+y+z then I am getting the value as a Ring element with monomials in xi's and coefficients in F as X in a Ring element.

Can anyone suggest any way to get the results as f1+f2t+f3t^2+...+fn*t^(n-1) and then collect fi's where fi's are functions in the variables xi's.

suppose I want to solve for X,Y in GF(2^3) with X^2Y^2= X^2+(1+t)Y^2

sage: F.<t>=GF(2^3)

sage: F.<t>=GF(2^3)

sage: R.<a1,a2,b1,b2,c1,c2>= PolynomialRing(ZZ) PolynomialRing(ZZ)

sage: R.<a1,a2,b1,b2,c1,c2>= R.quotient_ring([a1^2-a1,a2^2-a2,b1^2-b1,b2^2-b2,c1^2-c1,c2^2-c2]) sage: X=R(a1)+R(b1)t+R(c1)t^2 sage: Y=R(a2)+R(b2)t+R(c2)t^2 sage: X^2*Y^2R.quotient_ring([a1^2-a1,a2^2-a2,b1^2-b1,b2^2-b2,c1^2-c1,c2^2-c2])

sage: X=R(a1)+R(b1)t+R(c1)t^2

sage: Y=R(a2)+R(b2)t+R(c2)t^2

sage: X^2*Y^2


Now i want to store this output as A+Bt+Ct^2(how to do this? )

then I do:

sage: X^2+(1+t)*Y^2

sage: X^2+(1+t)*Y^2


and I want to store this as E+Ft+Gt^2(is it possible to do?)

finally I want to solve for ai's and bi's from the eqns A=E, B=F,C=G,ai^2=ai,bi^2=bi,ci^2=ci for i=1,2