[sage-support] Re: Factorization class

2008-12-03 Thread Tim Lahey
Ah, I think I see what you're doing. Thanks for the explanation. Cheers, Tim. On Dec 3, 2008, at 6:04 AM, Simon King wrote: Dear Tim, perhaps the following is a better explanation. In the above situation, "for X in F" yields a list of pairs (x-1,2), (x +1,2) etc. In particular, X is n

[sage-support] Re: Factorization class

2008-12-03 Thread John Cremona
Does this help? sage: n=factorial(30) sage: [Factorization([pe]) for pe in n.factor()] [2^26, 3^14, 5^7, 7^4, 11^2, 13^2, 17, 19, 23, 29] sage: x = polygen(GF(3)) sage: f = cyclotomic_polynomial(120)(x) sage: [Factorization([pe]) for pe in f.factor()] [(x^4 + x^2 + x + 1)^2, (x^4 + x^2 + 2*x

[sage-support] Re: Factorization class

2008-12-03 Thread Simon King
Dear Tim, perhaps the following is a better explanation. In the above situation, "for X in F" yields a list of pairs (x-1,2), (x +1,2) etc. In particular, X is not a polynomial. It is a pair, formed by a polynomial and a number. Hence, I am *not* applying a function called "Factorization" to so

[sage-support] Re: Factorization class

2008-12-03 Thread Simon King
Dear Tim, On Dec 3, 10:57 am, Tim Lahey <[EMAIL PROTECTED]> wrote: -- snip -- > Yes, and it's what someone else told me earlier in this thread. Where? I only found your own suggestion [(i^j).factor() for i,j in f]. But this is likely not a good idea, because * i^j is computed (may take time),

[sage-support] Re: Factorization class

2008-12-03 Thread Tim Lahey
On Dec 3, 2008, at 4:50 AM, Simon King wrote: Dear Tim, On Dec 3, 7:15 am, Tim Lahey <[EMAIL PROTECTED]> wrote: No, because I want instead of something like [(x-2,2),(x-3,3)] I'd like [(x-2)^2,(x-3)^3] You may do this: Start with a factorization of something: sage: f=factor(16200)

[sage-support] Re: Factorization class

2008-12-03 Thread Simon King
Dear Tim, On Dec 3, 7:15 am, Tim Lahey <[EMAIL PROTECTED]> wrote: > No, because I want instead of something like > [(x-2,2),(x-3,3)] > > I'd like > [(x-2)^2,(x-3)^3] You may do this: Start with a factorization of something: sage: f=factor(16200) sage: f 2^3 * 3^4 * 5^2 "for X in f"

[sage-support] Re: Factorization class

2008-12-02 Thread Tim Lahey
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 factorizati

[sage-support] Re: Factorization class

2008-12-02 Thread Craig Citro
> 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 factoriza

[sage-support] Re: Factorization class

2008-12-02 Thread Tim Lahey
On Dec 3, 2008, at 12:18 AM, Jason Grout wrote: An easier way: sage: f=factor(16200) sage: f 2^3 * 3^4 * 5^2 sage: [i^j for i,j in f] [8, 81, 25] 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

[sage-support] Re: Factorization class

2008-12-02 Thread Jason Grout
Tim Lahey wrote: > Hi, > > Does the Factorization class not have a > routine to return just a list of the factors? > Basically, something like the value function > but instead of multiplying them, puts > each term into a list? > > I ask because the output of a squarefree_decomposition > is a fac