Dear Emmanuel, Thank, ... one last question ... How I will be able to extract the coefficients of t^0,t^1,...,t^(p-1)
2014-08-18 5:49 GMT-03:00 Emmanuel Charpentier < emanuel.charpent...@gmail.com>: > If I follow your cpde correctly, you are working on polynoms in X0,..,X3. > What you attempt to create would be a polynom in x00,..,x03,x10..x33. > > Doubleplusungood... > > You should probaby use expressions in SR and cast the resultant expression > in the ring of polynoms in x00,..x33. > > BTW, you don't have to loop on your substitution : create a dictionary. > > This gives : > > p = 3 > k.<t> = GF(2^p) > nvars = 4 > vars_GF = [] > vars_gf2 = [] > vars_gf2subs = [] > l = 0 > for i in range(nvars): > vars_GF.append(var("X"+str(i))) > sum1 = 0 > for j in range(p): > vars_gf2.append(var("x"+str(i)+str(j))) > sum1 = sum1 + vars_gf2[i*p+j]*(t^j) > l = l + 1 > vars_gf2subs.append(sum1) > PR = PolynomialRing(k, nvars, names = vars_GF) > p = PR.random_element(degree=2) > Dic={vars_GF[i]:vars_gf2subs[i] for i in range(nvars)} > PR2=PolynomialRing(k, nvars*p, names = vars_gf2) > p2=PR2(SR(p).subs(Dic)) > > p2 might or might not be what you want. > > There are probably more steamlined ways to accomplish what you want, but > I'm only discovering Sage... > > HTH, > > -- > Emmanuel Charpentier > > Le lundi 18 août 2014 07:18:26 UTC+2, juaninf a écrit : > >> Dears members I need doing substitution of values vars_gf2subs in vars_GF >> variables on p polynomial. I'm trying p.subs(vars_GF[i]=vars_gf2subs[i]) >> bu tI get error. How I will be able to doing that? >> >> p = 3 >> k.<t> = GF(2^p) >> nvars = 4 >> vars_GF = [] >> vars_gf2 = [] >> vars_gf2subs = [] >> l = 0 >> for i in range(nvars): >> vars_GF.append(var("X"+str(i))) >> sum1 = 0 >> for j in range(p): >> vars_gf2.append(var("x"+str(i)+str(j))) >> sum1 = sum1 + vars_gf2[i*p+j]*(t^j) >> l = l + 1 >> vars_gf2subs.append(sum1) >> >> PR = PolynomialRing(k, nvars, names = vars_GF) >> p = PR.random_element(degree=2) >> for i in range(nvars): >> print vars_GF[i] >> p.subs(vars_GF[i]=vars_gf2subs[i]) >> >> -- >> --------------------------------------------------------------------- >> MSc. Juan del Carmen Grados Vásquez >> Laboratório Nacional de Computação Científica >> Tel: +55 21 97633 3228 >> (http://www.lncc.br/) >> http://juaninf.blogspot.com >> --------------------------------------------------------------------- >> > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. > -- --------------------------------------------------------------------- MSc. Juan del Carmen Grados Vásquez Laboratório Nacional de Computação Científica Tel: +55 21 97633 3228 (http://www.lncc.br/) http://juaninf.blogspot.com --------------------------------------------------------------------- -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.