10
$\begingroup$

OP EDIT: Wolfram Technical Support got back to me and confirmed this is a bug. But the Answers below provided good workarounds.

I have two polynomials respectively in {z,c} and in {r,z,c}. I'd like to eliminate z and get a tidy expression in {r,c}. For some reason, Eliminate[] never completes this simple task, while Solve[] quickly succeeds at the harder task of finding r as a function of c. But the Solve[] result is messy, so I'd like to know how to get just Eliminate[] to work.

Edit: I believe the solution should be a fairly simply polynomial in {r,c}.

The first three lines of code just generate and display my two polynomials.

w[n_, z_, c_] := If[n > 0, w[n - 1, z, c]^2 + c, z]; 
p1 = PolynomialQuotient[w[4, z, c] - z, w[2, z, c] - z, z]
p2 = 2^4; Do[p2 = p2*w[i, z, c], {i, 0, 3}]; p2
Solve[{p1 == 0, p2 == r}, r, {z}]
Eliminate[{p1 == 0, p2 == r}, {z}]
$\endgroup$
  • $\begingroup$ Are you looking for real solutions? $\endgroup$ – Ulrich Neumann Jul 28 at 8:24
  • $\begingroup$ @UlrichNeumann No, all of the variables are complex. I'm hoping for a polynomial in {r,c} simpler than the expression for r(c) that Solve[] returned. $\endgroup$ – Jerry Guern Jul 28 at 8:39
7
$\begingroup$

I'm not sure what the hang-up for Eliminate[] is. This is fast:

GroebnerBasis[{p1, p2 - r}, {c, r}, {z}]
(*
  {4096 + 8192 c^2 + 12288 c^3 + 12288 c^4 + 12288 c^5 + 4096 c^6 - 
    768 r - 256 c^2 r + 256 c^3 r + 256 c^4 r + 48 r^2 - 16 c^2 r^2 - r^3}
*)
$\endgroup$
  • $\begingroup$ Yep, that does exactly what I wanted. Thank you. I didn't know that function existed. Do more current versions of MMa also hang up when you use Eliminate[]? Might this be a bug? $\endgroup$ – Jerry Guern Jul 28 at 18:16
  • 1
    $\begingroup$ @JerryGuern I'm using V12 and it hangs. I don't know about other versions. $\endgroup$ – Michael E2 Jul 28 at 18:17
  • 2
    $\begingroup$ Wolfram Tech Support confirmed it's a bug in Eliminate[], but this workaround was perfect. $\endgroup$ – Jerry Guern Aug 10 at 2:33
5
$\begingroup$

I offer the following approach. Let

soln = Solve[{p1 == 0, p2 == r}, r, {z}]

Then find the polynomial that has these roots:

0 == Times @@ ((r - Last[#]) & /@ Flatten[soln]) // 
 Collect[#, r, Simplify] &
(* 0 == -4096 (1 + 2 c^2 + 3 c^3 + 3 c^4 + 3 c^5 + c^6) - 
  256 (-3 - c^2 + c^3 + c^4) r + 16 (-3 + c^2) r^2 + r^3 *)
$\endgroup$
  • $\begingroup$ A bit ghetto but clever and effective! Thank you. I'd still like to know what's wrong with Eliminate[] though. $\endgroup$ – Jerry Guern Jul 28 at 18:10
0
$\begingroup$

It is not necessary to solve for r!

Elimination of z:

solz== Solve[p2 == 0, z]
(*{{z -> 0}, {z -> -Sqrt[-Sqrt[-Sqrt[-c] - c] - c]}, {z -> Sqrt[-Sqrt[-Sqrt[-c] - c] - c]}, ...}*)

gives 15 solutions z[c]

Complex Solutions (15! ) r[c] follow to

r=p1 /. solz // FullSimplify
(*{1 + c^2 (1 + c) (2 + c) (1 + c^2),1 + Sqrt[-Sqrt[-Sqrt[-c] - c] - c] Sqrt[-Sqrt[-c] - c] +Sqrt[-Sqrt[-c] - c] Sqrt[-c], 
1 - Sqrt[-Sqrt[-Sqrt[-c] - c] - c] Sqrt[-Sqrt[-c] - c] +Sqrt[-Sqrt[-c] - c] Sqrt[-c],...*)

Perhaps the first result is the simple polynomial solution you're looking for!

Further evaluation needs knowledge about parameter c!

$\endgroup$
  • $\begingroup$ No, p2 has to equal r. $\endgroup$ – Jerry Guern Jul 28 at 8:16
  • $\begingroup$ Sorry, my fault... $\endgroup$ – Ulrich Neumann Jul 28 at 8:19

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.