Ask Your Question

Ilya's profile - activity

2018-12-01 16:38:03 +0200 received badge  Famous Question (source)
2017-06-27 23:16:20 +0200 received badge  Notable Question (source)
2015-06-17 08:17:09 +0200 received badge  Necromancer (source)
2015-06-17 08:17:09 +0200 received badge  Teacher (source)
2014-11-19 06:46:31 +0200 answered a question Julia and IJulia on Sage Math Cloud

Have a look at JuliaBox. They have a forum where you can ask for an invite code (and, hopefully, soon you won't need one).

2014-04-22 23:55:39 +0200 received badge  Popular Question (source)
2012-06-11 07:54:04 +0200 marked best answer How do I iterate through factors of a monomial?
R.<x,y,z>=QQ[]
[u for u in factor(x*y^3)]
#[(x, 1), (y, 3)]
2012-06-11 07:51:19 +0200 commented answer How do I iterate through factors of a monomial?

This works, thank you!

2012-06-11 07:49:41 +0200 commented answer How do I iterate through factors of a monomial?

Thank you very much, don't know how long I'd be looking for it without your help. However, I have to do `list((x*y^3).factor())`. For some reason, `(x*y^3).factor_list()` gives an error ('sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingu\ lar' object has no attribute 'factor_list').

2012-06-11 07:45:09 +0200 received badge  Scholar (source)
2012-06-11 07:45:09 +0200 marked best answer How do I iterate through factors of a monomial?

Not offended at all! I didn't know about this myself until now.

This works:

sage: (x*y^3).factor_list()
[(x, 1), (y, 3)]
sage: mul([x, y, y, y])
x*y^3

And, if you want to go from the factor list to the expression:

sage: a = (x*y^3).factor_list()
sage: mul(t^m for t, m in a)
x*y^3

Hope this helps!

2012-06-11 07:44:54 +0200 received badge  Supporter (source)
2012-06-10 11:49:18 +0200 received badge  Editor (source)
2012-06-10 11:46:35 +0200 asked a question How do I iterate through factors of a monomial?

I am (very naively) trying to implement a certain non-linear map of polynomial rings. I can get the monomials in a polynomial by simply iterating through a polynomial:

>>> R.<x,y,z>=QQ[]
>>> list(x*y^3 + 2*x*y)
[(1, x*y^3), (2, x*y)]

How do I now iterate through the factors of each monomial, i.e. convert x*y^3 into something like [(x, 1), (y, 3)] or even just [x, y, y, y]?

Also, what is the correct way to do the opposite conversion, i.e. [x, y, y, y] to x*y^3?

I hope you won't be offended by such newbie questions. I couldn't find this in any of the tutorials easily (did I miss the right one?) Thank you!