On Dec 3, 2008, at 1:03 AM, Craig Citro wrote:
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)]
No, because I want instead of something like [(x-2,2),(x-3,3)] I'd like [(x-2)^2,(x-3)^3] because I'd like to use these as input to a partial fraction expansion routine (which unfortunately, you can't do right now).What I'm doing is working through Manuel Bronstein's symbolic integration book. In it, he builds up the tools necessary to do integration and these
are part of it.
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 ...
Oh, that is useful. Thanks. I wonder about going the reverse direction. Cheers, Tim. --- Tim Lahey PhD Candidate, Systems Design Engineering University of Waterloo http://www.linkedin.com/in/timlahey
smime.p7s
Description: S/MIME cryptographic signature