0
$\begingroup$

Evalutation of the following cell, which includes the symbolic resultant, of two univariate polynomials in $x$, with parameters $a,b,c$ for the first polynomial (of degree 4) and parameters $d,e,f,g$ for the second polynomial (of degree 8), just keeps running (for hours).

Why is it so slow, and how can it be made to be faster?

Code:

Resultant[x^4 - 4*(a + b + c)*x^3 + 2*(3*(a + b + c)^2 - 4*(a*b + a*c + b*c))*x^2 - 4*((a + b + c)^3 - 4*(a + b + c)*(a*b + a*c + b*c) + 16*a*b*c)*x+ (4*(a*b + a*c + b*c) - (a + b + c)^2)^2, x^8 - 8*(d + e + f + g)*x^7 + 4*(7*(d + e + f + g)^2 - 4*(d*e + d*f + e*f + d*g + e*g + f*g))*x^6 - 8*(7*(d + e + f + g)^3 - 12*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g) + 16*(d*e*f + d*e*g + d*f*g + e*f*g))*x^5 + 2*(-1088*(d*e*f*g) + 35*(d + e + f + g)^4 - 120*(d + e + f + g)^2*(d*e + d*f + e*f + d*g + e*g + f*g) + 48*(d*e + d*f + e*f + d*g + e*g + f*g)^2 + 256*(d + e + f + g)*(d*e*f + d*e*g + d*f*g + e*f*g))*x^4 - 8*(-320*(d*e*f*g)*(d + e + f + g) + 7*(d + e + f + g)^5 - 
 40*(d + e + f + g)^3*(d*e + d*f + e*f + d*g + e*g + f*g) + 48*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g)^2 + 
 96*(d + e + f + g)^2*(d*e*f + d*e*g + d*f*g + e*f*g) - 128*(d*e + d*f + e*f + d*g + e*g + f*g)*(d*e*f + d*e*g + d*f*g + e*f*g))*x^3 + 4*(320*(d*e*f*g)*(d + e + f + g)^2 + 7*(d + e + f + g)^6 - 1792*(d*e*f*g)*(d*e + d*f + e*f + d*g + e*g + f*g) - 
 60*(d + e + f + g)^4*(d*e + d*f + e*f + d*g + e*g + f*g) + 144*(d + e + f + g)^2*(d*e + d*f + e*f + d*g + e*g + f*g)^2 - 
 64*(d*e + d*f + e*f + d*g + e*g + f*g)^3 + 128*(d + e + f + g)^3*(d*e*f + d*e*g + d*f*g + e*f*g) - 
 512*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g)*(d*e*f + d*e*g + d*f*g + e*f*g) + 1024*(d*e*f*g)^2)*x^2 - 8*(192*(d*e*f*g)*(d + e + f + g)^3 + (d + e + f + g)^8 - 768*(d*e*f*g)*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g) - 
 12*(d + e + f + g)^5*(d*e + d*f + e*f + d*g + e*g + f*g) + 48*(d + e + f + g)^3*(d*e + d*f + e*f + d*g + e*g + f*g)^2 - 
 64*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g)^3 + 1024*(d*e*f*g)*(d*e*f + d*e*g + d*f*g + e*f*g) + 
 16*(d + e + f + g)^4*(d*e*f + d*e*g + d*f*g + e*f*g) - 128*(d + e + f + g)^2*(d*e + d*f + e*f + d*g + e*g + f*g)*(d*e*f + d*e*g + d*f*g + e*f*g) + 
 256*(d*e + d*f + e*f + d*g + e*g + f*g)^2*(d*e*f + d*e*g + d*f*g + e*f*g))*x + (((d + e + f + g)^2 - 4*(d*e + d*f + e*f + d*g + e*g + f*g))^2 - 64*(d*e*f*g))^2, x]
$\endgroup$
3
$\begingroup$

Making substitutions to the parameters make it a little faster. It took 500s to complete.

poly1 = x^4 - 4*(a + b + c)*x^3 + 
   2*(3*(a + b + c)^2 - 4*(a*b + a*c + b*c))*x^2 - 
   4*((a + b + c)^3 - 4*(a + b + c)*(a*b + a*c + b*c) + 16*a*b*c)*
    x + (4*(a*b + a*c + b*c) - (a + b + c)^2)^2;
poly2 = x^8 - 8*(d + e + f + g)*x^7 + 
   4*(7*(d + e + f + g)^2 - 4*(d*e + d*f + e*f + d*g + e*g + f*g))*
    x^6 - 8*(7*(d + e + f + g)^3 - 
      12*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g) + 
      16*(d*e*f + d*e*g + d*f*g + e*f*g))*x^5 + 
   2*(-1088*(d*e*f*g) + 35*(d + e + f + g)^4 - 
      120*(d + e + f + g)^2*(d*e + d*f + e*f + d*g + e*g + f*g) + 
      48*(d*e + d*f + e*f + d*g + e*g + f*g)^2 + 
      256*(d + e + f + g)*(d*e*f + d*e*g + d*f*g + e*f*g))*x^4 - 
   8*(-320*(d*e*f*g)*(d + e + f + g) + 7*(d + e + f + g)^5 - 
      40*(d + e + f + g)^3*(d*e + d*f + e*f + d*g + e*g + f*g) + 
      48*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g)^2 + 
      96*(d + e + f + g)^2*(d*e*f + d*e*g + d*f*g + e*f*g) - 
      128*(d*e + d*f + e*f + d*g + e*g + f*g)*(d*e*f + d*e*g + d*f*g +
          e*f*g))*x^3 + 
   4*(320*(d*e*f*g)*(d + e + f + g)^2 + 7*(d + e + f + g)^6 - 
      1792*(d*e*f*g)*(d*e + d*f + e*f + d*g + e*g + f*g) - 
      60*(d + e + f + g)^4*(d*e + d*f + e*f + d*g + e*g + f*g) + 
      144*(d + e + f + g)^2*(d*e + d*f + e*f + d*g + e*g + f*g)^2 - 
      64*(d*e + d*f + e*f + d*g + e*g + f*g)^3 + 
      128*(d + e + f + g)^3*(d*e*f + d*e*g + d*f*g + e*f*g) - 
      512*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g)*(d*e*f +
          d*e*g + d*f*g + e*f*g) + 1024*(d*e*f*g)^2)*x^2 - 
   8*(192*(d*e*f*g)*(d + e + f + g)^3 + (d + e + f + g)^8 - 
      768*(d*e*f*g)*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + 
         f*g) - 12*(d + e + f + g)^5*(d*e + d*f + e*f + d*g + e*g + 
         f*g) + 48*(d + e + f + g)^3*(d*e + d*f + e*f + d*g + e*g + 
          f*g)^2 - 
      64*(d + e + f + g)*(d*e + d*f + e*f + d*g + e*g + f*g)^3 + 
      1024*(d*e*f*g)*(d*e*f + d*e*g + d*f*g + e*f*g) + 
      16*(d + e + f + g)^4*(d*e*f + d*e*g + d*f*g + e*f*g) - 
      128*(d + e + f + g)^2*(d*e + d*f + e*f + d*g + e*g + 
         f*g)*(d*e*f + d*e*g + d*f*g + e*f*g) + 
      256*(d*e + d*f + e*f + d*g + e*g + f*g)^2*(d*e*f + d*e*g + 
         d*f*g + e*f*g))*
    x + (((d + e + f + g)^2 - 
         4*(d*e + d*f + e*f + d*g + e*g + f*g))^2 - 64*(d*e*f*g))^2;
rules = {a + b + c -> AA, a*b + a*c + b*c -> BB, a b c -> CC, 
   d + e + f + g -> DD, d e + d f + e f + d g + e g + f g -> EE, 
   d e f + d e g + d f g + e f g -> FF, d e f g -> GG, 
   d^2 e^2 f^2 g^2 -> GG^2};

poly1 = poly1 //. rules;
poly2 = poly2 //. rules;

AbsoluteTiming[res = Resultant[poly1, poly2, x];]

(*{493.44, Null}*)

res = res //. Map[Reverse, rules, {1}];
```
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.