> Thanks. That works, but Sage automatically expands things so you
> need to do,
> [(i^j).factor() for i,j in f]
>
> To ensure that each polynomial term is shown factorized.
>

Do you want a list of pairs of the form (p,e) for each term in the
factorization of f? (That's actually how the factorization is stored
internally, so there's definitely no need to call back into factor to
do this.)

Is this what you'd want?

sage: R.<x> = ZZ[]
sage: f = x**10-1
sage: F = f.factor() ; F
(x - 1) * (x + 1) * (x^4 - x^3 + x^2 - x + 1) * (x^4 + x^3 + x^2 + x + 1)
sage: list(F)
[(x - 1, 1),
 (x + 1, 1),
 (x^4 - x^3 + x^2 - x + 1, 1),
 (x^4 + x^3 + x^2 + x + 1, 1)]

I know you also wanted a nice way to move between symbolic expressions
and polynomials (or, alternately, a partial fraction decomposition on
fraction fields of polynomial rings that seems to act consistently). I
agree that all of these should exist -- but in the interim, here's an
easy way to move from polynomials to symbolic expressions:

sage: R.<x> = ZZ[]
sage: f = x**10-1
sage: y = var('y',ns=1)
sage: type(f)
<type 
'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'>
sage: f(y)
y^10 - 1
sage: type(f(y))
<type 'sage.symbolic.expression.Expression'>

Maybe some of that is useful ...

-cc

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to