Does this help?

sage: x=polygen(QQ)
sage: L = [1+2*x+3*x^2,4+5*x+6*x^2]
sage: sum([list(f) for f in L],[])
[1, 2, 3, 4, 5, 6]

If f is a univariate polynomial then list(f) is a list of its
coefficients, with the i'th entry equal to the coefficient of x^i.
And summing lists concatenates them.

John Cremona

On Sep 2, 6:56 pm, andrew ewart <[email protected]> wrote:
> > well i was trying to use that example to see how i could work it in this
> > case
> > S = GF(5)
>
> > R.<z1, z2>=PolynomialRing(S, 2, "z");
>
> > f = z2^2+z1^2+3
> > T.<x>=PolynomialRing(S)
>
> > def factor_bivar(f):
>
> >             q = S.cardinality()
>
> >             fx0 = T(f(x,0))
>
> >             fac = fx0.factor()
>
> >             l = len(list(fac))
>
> >             print l
> >             degx= f.degree(z1)
> >             degy= f.degree(z2)
> >             degree=2*degx*degy
> >             print degree
> >             for n in xrange(0, l):
>
> >                 h = fac[n][0]
>
> >                 if (h.is_monic()):
>
> >                     if h == fx0:
>
> >                         break
> >                         return h
> >                 print h
> >             E.<t> = S.extension(h)
>
> >             G.<y> = E['y']
>
> >             print G
> >             df=diff(f,z1)
> >             dif=E(df(t,0))
> >             s=1/(dif)
> >             print s
> >             a0=E(t)
> >             ak=a0
> >             print ak
> >             for k in xrange(0, degree):
> >                 ak=ak-s*G(f(ak,y))
> >                 ad=ak%y^(degree+1)
> >             print ad
> >             degad=ad.degree(y)
> >             print degad
> >             li=vector((ad^j)%y^(degree+1) for j in xrange(0,degx+1))
> >             print li
> >             lei=[]
> >             for q in xrange(0,degree+1):
> >                 for ja in range(0,degx):
> >                     lee=li[ja].coeffs()
> >                     print lee
> >                     lei=lee[q].list()
> >                     print lei
>
> > li is a vector of the powers of ad from ad^0 to ad^degx
> > lee should be a list of coefficients wrt y of all the li
> > so should have degx+1 of lee
> > 1 for each power of ad
> > and length of lee should be degree+1
> > based on the powers of y from y^0 to y^degree
> > then lei should split wrt powers of t
> > so length of lei is (degree+1)*degx
> > and i want an output of lei for each power of ad^j
>
> >>  and at moment i get this as output
>
> 1
> 8
> Univariate Polynomial Ring in y over Univariate Quotient Polynomial Ring in
> t over Finite Field of size 5 with modulus t^2 + 3
> 4*t
> t
> 3*t*y^6 + 2*t*y^4 + t*y^2 + t
> 6
> (1, 3*t*y^6 + 2*t*y^4 + t*y^2 + t, 4*y^2 + 2)
> [1]
> [1, 0]
> [t, 0, t, 0, 2*t, 0, 3*t]
> [0, 1]
> [1]
> Traceback (most recent call last):
>   File "quickfact.py", line 72, in <module>
>     print factor_bivar(f)
>   File "quickfact.py", line 63, in factor_bivar
>     lei=lee[q].list()
> IndexError: list index out of range

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to