Ask Your Question
1

Polynomial factorization

asked 2024-02-27 17:32:48 +0100

8moeb8 gravatar image

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 flag offensive 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.

rburing gravatar imagerburing ( 2024-02-27 18:55:25 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2024-03-01 07:06:31 +0100

Emmanuel Charpentier gravatar image

updated 2024-03-01 07:09:49 +0100

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,

edit flag offensive delete link more
1

answered 2024-02-27 18:50:27 +0100

rburing gravatar image

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
edit flag offensive delete link more

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: 2024-02-27 17:32:48 +0100

Seen: 199 times

Last updated: Mar 01