# another factoring polynomials question

I have the following expression:

f = u^2*v*x + 3*u*v^2*x + 2*v^3*x + u^2*x^2 + 5*u*v*x^2 + 5*v^2*x^2 + 2*u*x^3 + 4*v*x^3 + x^4 + 2*u^2*v*y + 6*u*v^2*y + 4*v^3*y + 2*u^2*x*y + 12*u*v*x*y + 12*v^2*x*y + 6*u*x^2*y + 12*v*x^2*y + 4*x^3*y + u^2*y^2 + 6*u*v*y^2 + 6*v^2*y^2 + 6*u*x*y^2 + 12*v*x*y^2 + 5*x^2*y^2 + 2*u*y^3 + 4*v*y^3 + 2*x*y^3 + u^2*v*z + 3*u*v^2*z + 2*v^3*z + u^2*x*z + 6*u*v*x*z + 6*v^2*x*z + 3*u*x^2*z + 6*v*x^2*z + 2*x^3*z + u^2*y*z + 6*u*v*y*z + 6*v^2*y*z + 6*u*x*y*z + 12*v*x*y*z + 5*x^2*y*z + 3*u*y^2*z + 6*v*y^2*z + 3*x*y^2*z + u*v*z^2 + v^2*z^2 + u*x*z^2 + 2*v*x*z^2 + x^2*z^2 + u*y*z^2 + 2*v*y*z^2 + x*y*z^2


and I would like to simplify it by gathering and factoring partial sums

u, u+v,...,u+v+x+y+z
v, v+x,...,v+x+y+z
x, x+y,x+y+z,
y,y+z
z


(I have reason to expect that the expression will look quite a bit nicer if I do this, introducing notation for the sums of course, like h_{ij} = the sum of variables i up to j)

My first lame try at this was to ask sage to rational_simplify() quotients f/(u+v+x+y+z),...,f/(u+v), and so on, hoping to see more than just one big fraction. It didn't work.

Any insights/suggestions/corrections would be much appreciated!

Thanks,

edit retag close merge delete

Sort by » oldest newest most voted

Your $f$ can be simplified to:

v*(u + v)*(6*(x + y + z)^2 - (x^2 + 6*(x + y)*z + 5*z^2) + (x + 2*y + z)*(u + 2*v)) + (x + y)*(x + y + z)*(u^2 + x*(x + 2*y + z) + (u + 2*v)*(2*x + 2*y + z))


or if you prefer it without minus $-$ sign:

v*(u + v)*((x + z)*(5*x + z) + 6*y*(2*x + y + z) + (x + 2*y + z)*(u + 2*v)) + (x + y)*(x + y + z)*(u^2 + x*(x + 2*y + z) + (u + 2*v)*(2*x + 2*y + z))


Is it what you wanted?

more