Ask Your Question
0

Polynomial: distribute to greatest common factor

asked 2012-07-01 13:29:49 +0100

etuardu gravatar image

updated 2012-07-04 11:53:37 +0100

Hello, assuming I have a polinomial like this:

sage: var('x, y')
(x, y)
sage: y = 2*x^2 + x^3 + 10*x^4

is there a way to get it simplified applying the distributive property on the greatest common factor?
In this case, the output should be this:

y = x^2 * ( 2 + x + 10*x^2 )

Thank you!

edit retag flag offensive close merge delete

Comments

1

How about `factor(y)`?

John Palmieri gravatar imageJohn Palmieri ( 2012-07-01 13:44:34 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-07-01 15:49:45 +0100

calc314 gravatar image

updated 2012-07-01 15:50:41 +0100

Try:

y.collect_common_factors()

This gives the output you want.

You could also use factor(y,x^2) if you know upfront that you want to factor out $x^2$.

edit flag offensive delete link more

Comments

Thank you, `collect_common_factors()` is indeed what I was looking for. It was that easy and I apologize if I couldn't manage to find out myself but it seems this function lacks of documentation or search engine indexing.

etuardu gravatar imageetuardu ( 2012-07-04 11:10:23 +0100 )edit

Sometimes it can indeed be hard to find all of the functionality. In this case, I used the command completion in the notebook interface to help me find it. To do this, I typed the polynomial name with a dot afterwards: `y.` Then, I hit the `tab` button. A menu appears with the (many) operations that you can do to this object `y`.

calc314 gravatar imagecalc314 ( 2012-07-04 14:16:26 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-01 13:29:49 +0100

Seen: 751 times

Last updated: Jul 04 '12