Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f f in x1,x2,x3,x4,x5,x6,x7 x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), f(z1), I have a polynomial, but with f(z2), f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), f(z1).constant_coefficient(), but I could not do the same with f(z2).f(z2).

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]\
F. = F2.extension(x^2+x+1)
k=F R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens() Fc=[] # o1 polynomials in the first layer
for im in range(o1):
    f=0
    for i in range (v): 
        for j in range (i,v+o1):
        ...

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]\
F. = F2.extension(x^2+x+1)
k=F  R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens() x=R.gens()
Fc=[] # o1 polynomials in the first layer
for im in range(o1):
    f=0
    for i in range (v): 
        for j in range (i,v+o1):
        ...

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]\
F2[]
F. = F2.extension(x^2+x+1)
F2.extension(x^2+x+1) # looks like bad syntax: the dot in "F." on the left side
k=F   # why?
R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens()
Fc=[] # o1 polynomials in the first layer
for im in range(o1):
range(o1):  # what's o1?
    f=0
    for i in range (v):  # what's v?
        for j in range (i,v+o1):
        ...

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]
F. k.<a> = F2.extension(x^2+x+1) # looks like bad syntax: the dot in "F." on the left side
k=F  # why?
v=3
o1=2
o2=2
n=v+o1+o2
R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens()
Fc=[] # o1 polynomials in the first layer
for im in range(o1):  # what's o1?
o1? Sorry, when I pasted, some mistakes appeared but I didn't control them
    f=0
    for i in range (v): # what's v?
        for j in range (i,v+o1):
        ...

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]
k.<a> = F2.extension(x^2+x+1) # looks like bad syntax: the dot in "F." on the left side
v=3
o1=2
o2=2
n=v+o1+o2
R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens()
Fc=[] # o1 polynomials in the first layer
for im in range(o1):  # what's o1? Sorry, when I pasted, some mistakes appeared but I didn't control them
     f=0
     for i in range (v): # what's v?
         for j in range (i,v+o1):
        ...
        f+=k.random_element()*x[i]*x[j]
     for i in range (n-o2):
          f+=k.random_element()*x[i]
     f+=k.random_element()
     Fc.append(f)

o2 polynomials in the second layer

for im in range(o1,o1+o2): f=0 for i in range (v+o1): for j in range (i,n): f+=k.random_element()x[i]x[j] for i in range (n): f+=k.random_element()*x[i] f+=k.random_element() Fc.append(f) w=vector([k.random_element() for i in range (o1+o2)])
Fn=[R.random_element() for i in range (o1)] while True: y_rd=[k.random_element() for j in range (v)] y=y_rd+[x[jj] for jj in range (v,v+o1)]+[0 for jjj in range (v+o1,n)] bc=[] Colist=[] for i in range (o1): Fn[i]=Fci cc=w[i]-(Fn[i].constant_coefficient()) bc.append(cc) mbc=vector(bc) for i in range (o1): Colist.append(Fn[i].coefficient(x[j]) for j in range (v,v+o1)) Mtx=matrix(Colist) if rank(Mtx.augment(mbc))==rank(Mtx): break yb=Mtx.solve_right(mbc) ybb=list(yb) zz1=y_rd+ybb print(y) for i in range (o1+o2): print(Fc[i]) print(Fci) print(type(Fci)) print('-----------------------------------------') yy=zz1+[x[i] for i in range (v+o1,n)] print(yy) for i in range (o1+o2): print(Fc[i]) print(Fci) print(type(Fci))

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]
k.<a> = F2.extension(x^2+x+1) # looks like bad syntax: the dot in "F." on the left side
v=3
o1=2
o2=2
n=v+o1+o2
R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens()
Fc=[] # o1 polynomials in the first layer
for im in range(o1):  # what's o1? Sorry, when I pasted, some mistakes appeared but I didn't control them
     f=0
     for i in range (v): # what's v?
          for j in range (i,v+o1):
                f+=k.random_element()*x[i]*x[j]
     for i in range (n-o2):
           f+=k.random_element()*x[i]
      f+=k.random_element()
      Fc.append(f)
for im in range(o1,o1+o2): f=0 for i in range (v+o1): for j in range (i,n): f+=k.random_element()*x[i]*x[j] for i in range (n): f+=k.random_element()*x[i] f+=k.random_element() Fc.append(f) w=vector([k.random_element() for i in range (o1+o2)])

o2 polynomials in the second layer

for im in range(o1,o1+o2): f=0 for i in range (v+o1): for j in range (i,n): f+=k.random_element()x[i]x[j] for i in range (n): f+=k.random_element()*x[i] f+=k.random_element() Fc.append(f) w=vector([k.random_element() for i in range (o1+o2)])
Fn=[R.random_element() for i in range (o1)] while True: y_rd=[k.random_element() for j in range (v)] y=y_rd+[x[jj] for jj in range (v,v+o1)]+[0 for jjj in range (v+o1,n)] bc=[] Colist=[] for i in range (o1): Fn[i]=Fci Fn[i]=Fc[i](y) cc=w[i]-(Fn[i].constant_coefficient()) bc.append(cc) mbc=vector(bc) for i in range (o1): Colist.append(Fn[i].coefficient(x[j]) for j in range (v,v+o1)) Mtx=matrix(Colist) if rank(Mtx.augment(mbc))==rank(Mtx): break yb=Mtx.solve_right(mbc) ybb=list(yb) zz1=y_rd+ybb print(y) for i in range (o1+o2): print(Fc[i]) print(Fci) print(type(Fci)) print(Fc[i](y)) print(type(Fc[i](y))) print('-----------------------------------------') yy=zz1+[x[i] for i in range (v+o1,n)] print(yy) for i in range (o1+o2): print(Fc[i]) print(Fci) print(type(Fci))

print(Fc[i](yy)) print(type(Fc[i](yy)))

Why does a polynomial become an element of a fraction field?

I have a multivariate polynomial f in x1,x2,x3,x4,x5,x6,x7 on a field k=GF2(a) and 2 lists z1=[1,a,0,x4,x5,0,0], z2=[1,a,0,a,a+1,x6,x7]. When I run f(z1), I have a polynomial, but with f(z2), I receive FractionFieldElement. So I can call f(z1).constant_coefficient(), but I could not do the same with f(z2).

F2=GF(2); Rr.<x> = F2[]
k.<a> = F2.extension(x^2+x+1) # looks like bad syntax: the dot in "F." on the left side
v=3
o1=2
o2=2
n=v+o1+o2
R=PolynomialRing(k,["x%d" %i for i in range (1,n+1)])
x=R.gens()
Fc=[] # o1 polynomials in the first layer
for im in range(o1):  # what's o1? Sorry, when I pasted, some mistakes appeared but I didn't control them
     f=0
     for i in range (v): # what's v?
          for j in range (i,v+o1):
                f+=k.random_element()*x[i]*x[j]
     for i in range (n-o2):
              f+=k.random_element()*x[i]
         f+=k.random_element()
         Fc.append(f)
 for im in range(o1,o1+o2):
       f=0
       for i in range (v+o1):
            for j in range (i,n):
                 f+=k.random_element()*x[i]*x[j]
       for i in range (n):
             f+=k.random_element()*x[i]
       f+=k.random_element()
       Fc.append(f)
 w=vector([k.random_element() for i in range (o1+o2)])    
 Fn=[R.random_element() for i in range (o1)]
 while True:
        y_rd=[k.random_element() for j in range (v)]
        y=y_rd+[x[jj] for jj in range (v,v+o1)]+[0 for jjj in range (v+o1,n)]
        bc=[]
        Colist=[]
        for i in range (o1):
             Fn[i]=Fc[i](y)
             cc=w[i]-(Fn[i].constant_coefficient())
             bc.append(cc)
        mbc=vector(bc)
        for i in range (o1):
             Colist.append(Fn[i].coefficient(x[j]) for j in range (v,v+o1))
        Mtx=matrix(Colist)
        if rank(Mtx.augment(mbc))==rank(Mtx):
                break
 yb=Mtx.solve_right(mbc)
 ybb=list(yb)
 zz1=y_rd+ybb
 print(y)
 for i in range (o1+o2):
       print(Fc[i])
       print(Fc[i](y))
       print(type(Fc[i](y)))
 print('-----------------------------------------')
 yy=zz1+[x[i] for i in range (v+o1,n)]
 print(yy)
 for i in range (o1+o2):
       print(Fc[i])
       print(Fc[i](yy))
       print(type(Fc[i](yy)))