[sage-support] Re: rexpression of lists

2010-09-03 Thread Simon King
Hi Andrew! On Sep 2, 6:56 pm, andrew ewart aewartma...@googlemail.com wrote: ... degx= f.degree(z1) degy= f.degree(z2) degree=2*degx*degy ...           for q in xrange(0,degree+1):                 for ja in range(0,degx):                    

Re: [sage-support] Re: rexpression of lists

2010-09-03 Thread andrew ewart
want i want to compute is a vector for each power of ad^j that lists all the coefficients wrt t and y which will have length at most (degree+1)*degx of course if it is shorter i want to stick 0's on the end until i get to this length -- To post to this group, send email to

Re: [sage-support] Re: rexpression of lists

2010-09-03 Thread andrew ewart
so for ad^0 i should get out [1,0,0,0,0,...,0] -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL:

[sage-support] Re: rexpression of lists

2010-09-03 Thread Simon King
Hi Andrew! On Sep 3, 12:28 pm, andrew ewart aewartma...@googlemail.com wrote: so for ad^0 i should get out [1,0,0,0,0,...,0] What you can use is padded_list! Example: sage: R.x=QQ[] sage: p = R.random_element() sage: p 3/4*x^2 + 1/2*x - 1 sage: p.padded_list(5) [-1, 1/2, 3/4, 0, 0] The

Re: [sage-support] Re: rexpression of lists

2010-09-03 Thread andrew ewart
finally getting somewhere now get this output [1, 0, 0, 0, 0, 0, 0, 0, 0] [1, 0] [0, 0] [0, 0] [0, 0] [0, 0] [0, 0] [0, 0] [0, 0] [0, 0] [t, 0, t, 0, 2*t, 0, 3*t, 0, 0] [0, 1] [0, 0] [0, 1] [0, 0] [0, 2] [0, 0] [0, 3] [0, 0] [0, 0] this is very close all i want to do is now join each collection

[sage-support] Re: rexpression of lists

2010-09-03 Thread Simon King
On Sep 3, 1:42 pm, andrew ewart aewartma...@googlemail.com wrote: ... this is very close all i want to do is now join each collection of lists together so get outputs [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] and [0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0] thoughts?

[sage-support] Re: rexpression of lists

2010-09-02 Thread Marshall Hampton
Its a little unclear what you want to consider the variables to be. Why would the coefficient list have 6 items? Perhaps you want something like this: var('a,b,c,d,e,f,x') l=[a+b*x+c*x^2, d+e*x+f*x^2 for s in range(0,2): cofs = [l[s].coefficient(q) for q in [a,b,c,d,e,f]] print cofs

Re: [sage-support] Re: rexpression of lists

2010-09-02 Thread andrew ewart
the variable is x in this case also im running this out of sage in a file, then loading the file in sage so i dont to use var(...) also i feel ill need 2 loops 1 to go through each component on the list and a second to extract the coefficints of each component wrt 1,x and x^2 (in this case) --

Re: [sage-support] Re: rexpression of lists

2010-09-02 Thread andrew ewart
and the final printout should be (in this case) [a,b,c,d,e,f] -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at

[sage-support] Re: rexpression of lists

2010-09-02 Thread Simon King
Hi Andrew! On 2 Sep., 18:12, andrew ewart aewartma...@googlemail.com wrote: suppose i have a list of the form l=[a+b*x+c*x^2, d+e*x+f*x^2] how do i use l[n].list() correctly to produce [a,b,c,d,e,f] as at the moment im only getting [a,b,c] ... Please provide a complete code snipped. From

Re: [sage-support] Re: rexpression of lists

2010-09-02 Thread andrew ewart
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 =

Re: [sage-support] Re: rexpression of lists

2010-09-02 Thread andrew ewart
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()

Re: [sage-support] Re: rexpression of lists

2010-09-02 Thread andrew ewart
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()

[sage-support] Re: rexpression of lists

2010-09-02 Thread John Cremona
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.