I want to find all stationary points of a particular 3 dimensional polynomial function. Sounds easy enough, right? Just get the gradient with Grad[], and solve the resulting system of polynomial equations.

Well, its not working out too well for me. Here is the expression I am having issues with:

Solve[{x2 + b (x3 + c x5) + b^2 x6 + c (x3 + c x6) + 2 a (x4 + (b + c) x6) + 3 a^2 x7 == 0, 
  x2 + a^2 x6 + a (x3 + c x5 + 2 b x6) + c (x3 + c x6) + 2 b (x4 + c x6) + 3 b^2 x7 == 0, 
  x2 + a^2 x6 + b^2 x6 + b (x3 + 2 c x6) + a (x3 + b x5 + 2 c x6) + 
    c (x4 + c x7) + c (x4 + 2 c x7) == 0, a>0, b>0, c>0}, {a, b, c}, Reals]

a,b,c are the 3 variables of the polynomial function, and x2...x7 are real coefficients. (they are to be determined by a least squares fit, and I do not want to have to run the solver every time the dataset changes, I want to take the solutions and embed them into a C++ program)

My problem is that solving this polynomial system seems to take absolutely forever. The fact that Mathematica does not seem to be using all 6 cores of the computer surely does not help either.

And this is just a toy model, the polynomial functions that I really want to work with have 10+ dimensions.

Am I asking Mathematica the impossible? Or is there something I can add, assumptions that speed up the process?

  • 2
    $\begingroup$ Try solving the first equation for a, plugging that into the second equation, solving it for b, and plugging a and b into your third equation. Also, leave off Reals at first (and the a,b,c > 0 conditions) and add them after you've solved using Simplify or FullSimplify. All this just based on experience and other questions on this site-- Mathematica is imperfect w/ solving equations. $\endgroup$ – barrycarter Oct 27 '18 at 15:11
  • 1
    $\begingroup$ You can use GroebnerBasis[] to eliminate variables from your equations (only the ==0 ones) until you end up with only one equation in one variable which can be solved, e.g. gb=GroebnerBasis[eqs,{a,b,c},{a,b}];Solve[gb[[1]]==0,c] $\endgroup$ – Thies Heidecke Oct 27 '18 at 19:29
  • $\begingroup$ @barrycarter I have tried that, and works OK for the tiny example I have posted. But for a slightly larger polynomial system it no longer works, solving for the first variable is doable, but solving for the second variable (after substituting with a solution for the first) takes more time than what I was willing to wait. $\endgroup$ – uLoop Oct 31 '18 at 17:07

Your Answer

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

Browse other questions tagged or ask your own question.