Hi Andrew! On 2 Sep., 18:12, andrew ewart <[email protected]> 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 your example, it is not clear at all whether you talk 1) about symbolic expressions, 2) univariate polynomials over the Symbolic Ring 3) univariate polynomials over another polyomial ring 4) multivariate polynomials. Actually it seems that your choice was 2) or 3): Otherwise, I[0].list() would result in an attribute error (I just tested: In cases 1) and 4), there is no attribute "list"). So, did you do this? sage: C.<a,b,c,d,e,f> = QQ[] sage: R.<x> = C[] sage: (a+b*x+c*x^2).list() [a, b, c] But then, lists do not have coefficients, even if the items in the list have coefficients. So, if you want to combine the lists of coefficients of both polynomials, you have to be explicit. I would guess (but really I found your question a little unclear!) that you want to do: sage: l = [a+b*x+c*x^2, d+e*x+f*x^2] sage: add([p.coefficients() for p in l],[]) # tell sage that it should combine the lists [a, b, c, d, e, f] Best regards, Simon -- 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
