On Sep 7, 2010, at 08:57 , andrew ewart wrote:

ah found why got that missed brqacket on end of g.unit()

now by using g.factor
how do i express the factors of a polynomial in a list
eg
g=x^2+x
g.factor= x(x+1)
so want something that does
list(g)
giving output
[x,x+1]

g.factor() returns something called a "factori{z,s}ation", which is a Python class. The class representation is "x*(x+1)", but its underlying implementation is (currently) a list of lists. In your case, it is [[x,1],[x+1,1]], with the '1's being the exponents of the factors. There will also be another component of the data type for the unit that might be present in the factorization (e.g., "-1").

And to be more precise, tuples are used, not lists, because the type is immutable (i.e., you can't change the data associated to a factorization).

In any case, you can retrieve the factors by something like

sage: F=g.factor()
sage: F[1][0]
x

Don't forget that, using '?' and '??' (the latter shows source as well as documentation), you can find out such details for yourself. Feel free to continue asking on this list, or on <http://ask.sagemath.org>, if things don't make sense, or information is incomplete.

HTH

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
Like the ski resort full of girls hunting for husbands
and husbands hunting for girls, the situation is not
as symmetrical as it might seem.
  - Alan MacKay
--

--
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