Question: How to get rid of some lengthy `RootOf` expressions?

Let f__0 denote the factors of the "absolute factorization" of the following bivariate polynomial (i.e., p): 

p := product(x^3*k^2 + (x*(y + 2) + 2)*k - x^3 + y^3 + y + 1, k = RootOf(_Z^3 + _Z + 1)):
f__0 := (evala@AFactors)(p)[2, .., 1]; # Assume that we do not know the extension field in advance.

It is unfortunate that the output is not easy to read, so I have to simplify it here. However, it appears that none of the results (i.e., f__1, f__2, and f__3) is eminently readable. 
 

restart;

p := product(x^3*(k^2-1)+(x*(y+2)+2)*k+y^3+y+1, k = RootOf(_Z^3+_Z+1))

-3*x^9+8*x^6*y^3-5*x^3*y^6+y^9-4*x^7*y+3*x^4*y^4-8*x^7+8*x^6*y-x^5*y^2+6*x^4*y^3-10*x^3*y^4+x^2*y^5+3*y^7-4*x^5*y+3*x^4*y^2-5*x^3*y^3+4*x^2*y^4+3*y^6-4*x^5+5*x^4*y-11*x^3*y^2+5*x^2*y^3+4*x*y^4+3*y^5-2*x^4-16*x^3*y-x^2*y^2+8*x*y^3+6*y^4-11*x^3-16*x^2*y+4*x*y^2+8*y^3-20*x^2+3*y^2-16*x+7*y-3

(1)

f__0 := (`@`(evala, AFactors))(p)[2, () .. (), 1]

[x^3+((-(106/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+1486/3267+(1/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2)*y+2972/3267-(212/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(2/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2)*x+(-(4/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2-3040/3267+(61/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))*y^3+(-(4/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2-3040/3267+(61/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))*y-68/3267-(151/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(2/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2, x^3+(((106/3267)*RootOf(10501+_Z^3+51*_Z)+(106/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+1486/3267+(1/3267)*(-RootOf(10501+_Z^3+51*_Z)-RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))^2)*y+2972/3267+(212/3267)*RootOf(10501+_Z^3+51*_Z)+(212/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(2/3267)*(-RootOf(10501+_Z^3+51*_Z)-RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))^2)*x+(-(4/3267)*(-RootOf(10501+_Z^3+51*_Z)-RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))^2-3040/3267-(61/3267)*RootOf(10501+_Z^3+51*_Z)-(61/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))*y^3+(-(4/3267)*(-RootOf(10501+_Z^3+51*_Z)-RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))^2-3040/3267-(61/3267)*RootOf(10501+_Z^3+51*_Z)-(61/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))*y-68/3267+(151/3267)*RootOf(10501+_Z^3+51*_Z)+(151/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(2/3267)*(-RootOf(10501+_Z^3+51*_Z)-RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))^2, x^3+((-(106/3267)*RootOf(10501+_Z^3+51*_Z)+1486/3267+(1/3267)*RootOf(10501+_Z^3+51*_Z)^2)*y+2972/3267-(212/3267)*RootOf(10501+_Z^3+51*_Z)+(2/3267)*RootOf(10501+_Z^3+51*_Z)^2)*x+(-(4/3267)*RootOf(10501+_Z^3+51*_Z)^2-3040/3267+(61/3267)*RootOf(10501+_Z^3+51*_Z))*y^3+(-(4/3267)*RootOf(10501+_Z^3+51*_Z)^2-3040/3267+(61/3267)*RootOf(10501+_Z^3+51*_Z))*y-68/3267-(151/3267)*RootOf(10501+_Z^3+51*_Z)-(2/3267)*RootOf(10501+_Z^3+51*_Z)^2]

(2)

f__1 := evala(f__0)

[34/3267-(151/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(2/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)+(2/3267)*RootOf(10501+_Z^3+51*_Z)^2+(2870/3267)*x-(212/3267)*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(2/3267)*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)-(2/3267)*x*RootOf(10501+_Z^3+51*_Z)^2-(2836/3267)*y+(61/3267)*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(4/3267)*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)+(4/3267)*y*RootOf(10501+_Z^3+51*_Z)^2+(1435/3267)*x*y-(106/3267)*x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(1/3267)*x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)-(1/3267)*x*y*RootOf(10501+_Z^3+51*_Z)^2+x^3-(2836/3267)*y^3+(61/3267)*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(4/3267)*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)+(4/3267)*y^3*RootOf(10501+_Z^3+51*_Z)^2, x^3+(106/3267)*x*y*RootOf(10501+_Z^3+51*_Z)+(106/3267)*x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(1435/3267)*x*y+(1/3267)*x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)+(2870/3267)*x+(212/3267)*x*RootOf(10501+_Z^3+51*_Z)+(212/3267)*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(2/3267)*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)-(4/3267)*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)-(2836/3267)*y^3-(61/3267)*y^3*RootOf(10501+_Z^3+51*_Z)-(61/3267)*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(4/3267)*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z)-(2836/3267)*y-(61/3267)*y*RootOf(10501+_Z^3+51*_Z)-(61/3267)*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+34/3267+(151/3267)*RootOf(10501+_Z^3+51*_Z)+(151/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(2/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)*RootOf(10501+_Z^3+51*_Z), x^3-(106/3267)*x*y*RootOf(10501+_Z^3+51*_Z)+(1486/3267)*x*y+(1/3267)*x*y*RootOf(10501+_Z^3+51*_Z)^2+(2972/3267)*x-(212/3267)*x*RootOf(10501+_Z^3+51*_Z)+(2/3267)*x*RootOf(10501+_Z^3+51*_Z)^2-(4/3267)*y^3*RootOf(10501+_Z^3+51*_Z)^2-(3040/3267)*y^3+(61/3267)*y^3*RootOf(10501+_Z^3+51*_Z)-(4/3267)*y*RootOf(10501+_Z^3+51*_Z)^2-(3040/3267)*y+(61/3267)*y*RootOf(10501+_Z^3+51*_Z)-68/3267-(151/3267)*RootOf(10501+_Z^3+51*_Z)-(2/3267)*RootOf(10501+_Z^3+51*_Z)^2]

(3)

f__2 := simplify(f__0, size)

[(1/3267)*(-4*y^3+(-4+x)*y-2+2*x)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2+(1/3267)*(61*y^3+(61-106*x)*y-151-212*x)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(3040/3267)*y^3+(1/3267)*(1486*x-3040)*y+x^3-68/3267+(2972/3267)*x, (1/3267)*(-4*y^3+(-4+x)*y-2+2*x)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)^2+(1/3267)*((-8*y^3+(-8+2*x)*y-4+4*x)*RootOf(10501+_Z^3+51*_Z)-61*y^3+(106*x-61)*y+212*x+151)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(1/3267)*(-4*y^3+(-4+x)*y-2+2*x)*RootOf(10501+_Z^3+51*_Z)^2+(1/3267)*(-61*y^3+(106*x-61)*y+212*x+151)*RootOf(10501+_Z^3+51*_Z)-(3040/3267)*y^3+(1/3267)*(1486*x-3040)*y+x^3-68/3267+(2972/3267)*x, (1/3267)*(-4*y^3+(-4+x)*y-2+2*x)*RootOf(10501+_Z^3+51*_Z)^2+(1/3267)*(61*y^3+(61-106*x)*y-151-212*x)*RootOf(10501+_Z^3+51*_Z)-(3040/3267)*y^3+(1/3267)*(1486*x-3040)*y+x^3-68/3267+(2972/3267)*x]

(4)

f__3 := simplify(f__0, RootOf)

[34/3267-(2836/3267)*y^3+(61/3267)*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(151/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(2870/3267)*x-(106/3267)*x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(2836/3267)*y+(61/3267)*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(1435/3267)*x*y+x^3-(212/3267)*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(1/3267)*(-x*y-2*x+4*y^3+4*y+2)*RootOf(10501+_Z^3+51*_Z)^2+(1/3267)*(-2*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+2*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+4*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+4*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))*RootOf(10501+_Z^3+51*_Z), x^3-(61/3267)*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(151/3267)*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(1435/3267)*x*y+34/3267+(2870/3267)*x-(2836/3267)*y^3-(2836/3267)*y+(106/3267)*x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(212/3267)*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-(61/3267)*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+(1/3267)*(-61*y-61*y^3+151+2*x*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+106*x*y-4*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)-4*y^3*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+x*y*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2)+212*x-2*RootOf(_Z^2+_Z*RootOf(10501+_Z^3+51*_Z)+51+RootOf(10501+_Z^3+51*_Z)^2))*RootOf(10501+_Z^3+51*_Z), x^3+((-(106/3267)*RootOf(10501+_Z^3+51*_Z)+1486/3267+(1/3267)*RootOf(10501+_Z^3+51*_Z)^2)*y+2972/3267-(212/3267)*RootOf(10501+_Z^3+51*_Z)+(2/3267)*RootOf(10501+_Z^3+51*_Z)^2)*x+(-(4/3267)*RootOf(10501+_Z^3+51*_Z)^2-3040/3267+(61/3267)*RootOf(10501+_Z^3+51*_Z))*y^3+(-(4/3267)*RootOf(10501+_Z^3+51*_Z)^2-3040/3267+(61/3267)*RootOf(10501+_Z^3+51*_Z))*y-68/3267-(151/3267)*RootOf(10501+_Z^3+51*_Z)-(2/3267)*RootOf(10501+_Z^3+51*_Z)^2]

(5)

Unfortunately, none of f__0, f______1__, f__2, and f______3__ is very readable.
It can be proved that the following one is also the factors.

f__4 := [x^3 + RootOf(3*_Z^3 - 4*_Z^2 + _Z - 1, index = 3)*(x*(y + 2) + 2) + RootOf(3*_Z^3 + 8*_Z^2 + 5*_Z + 1, index = 3)*(y^3 + y + 1), x^3 + RootOf(3*_Z^3 - 4*_Z^2 + _Z - 1, index = 2)*(x*(y + 2) + 2) + RootOf(3*_Z^3 + 8*_Z^2 + 5*_Z + 1, index = 1)*(y^3 + y + 1), x^3 + RootOf(3*_Z^3 - 4*_Z^2 + _Z - 1, index = 1)*(x*(y + 2) + 2) + RootOf(3*_Z^3 + 8*_Z^2 + 5*_Z + 1, index = 2)*(y^3 + y + 1)];

evala(p+3*`?()`(`*`, f__4))NULL

[x^3+RootOf(3*_Z^3-4*_Z^2+_Z-1, index = 3)*(x*(y+2)+2)+RootOf(3*_Z^3+8*_Z^2+5*_Z+1, index = 3)*(y^3+y+1), x^3+RootOf(3*_Z^3-4*_Z^2+_Z-1, index = 2)*(x*(y+2)+2)+RootOf(3*_Z^3+8*_Z^2+5*_Z+1, index = 1)*(y^3+y+1), x^3+RootOf(3*_Z^3-4*_Z^2+_Z-1, index = 1)*(x*(y+2)+2)+RootOf(3*_Z^3+8*_Z^2+5*_Z+1, index = 2)*(y^3+y+1)]

 

0

(6)

`~`[length]([f__ || (0 .. 4)])

[3858, 4389, 1410, 3608, 513]

(7)

`~`[MmaTranslator:-Mma:-LeafCount]([f__ || (0 .. 4)])

[935, 1047, 391, 881, 166]

(8)

As you can see, f__4 is of lower mathematical complexity.


 

Download fully_simplify_f_0.mw

The f__4 above (whose "size" is smaller) comes from manual simplification, but this is not a easy work. Is there a way to get the much simplified result programmatically?

Please Wait...