Ask Your Question

# Polynomial factorization

I have a polynomial in x,y,z such that each term can factor out a certain power of x to get a polynomial with nonzero constant term. I want to simplify this polynomial, so I want to find the largest n such that each term can be divided by x^n and then divide the whole polynomial by x^n. How shall I do it?

edit retag close merge delete

## Comments

In your story it's not clear to me which polynomial should have a nonzero constant term. Please give an example of the input and the output you want.

( 2024-02-27 18:55:25 +0200 )edit

## 2 Answers

Sort by ยป oldest newest most voted

If I understood you correctly:

sage: R.<x,y,z> = PolynomialRing(QQ)
sage: f = x^2*(x + y + z + 1) + x^3*(y^2 + z^2 + 1); f
x^3*y^2 + x^3*z^2 + 2*x^3 + x^2*y + x^2*z + x^2
sage: g = x^min(e[0] for e in f.exponents()); g
x^2
sage: h = f // g; h
x*y^2 + x*z^2 + 2*x + y + z + 1
sage: f == g*h
True

more

Possible alternative in SR :

sage: var("x, y, z")
(x, y, z)
sage: f = x^2*(x + y + z + 1) + x^3*(y^2 + z^2 + 1); f
(y^2 + z^2 + 1)*x^3 + (x + y + z + 1)*x^2
sage: f.canonicalize_radical().factor()
(x*y^2 + x*z^2 + 2*x + y + z + 1)*x^2


Also :

sage: f.collect_common_factors()
((y^2 + z^2 + 1)*x + x + y + z + 1)*x^2


HTH,

more

## Your Answer

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

Add Answer

## Stats

Asked: 2024-02-27 17:32:48 +0200

Seen: 143 times

Last updated: Mar 01