I have a polynomial equation:

$-(a-ib)e^{(4\pi i/3)}(\sqrt{2}i+x^3/\sqrt{3})x- (a+ib) e^{(2\pi i/3)}(\sqrt{2}ix^3+1/\sqrt{3})=0$

(which in code is):

-(a - I b)Exp[4 π I/3](Sqrt[2] I+x^3/Sqrt[3])x - (a+I b)Exp[2 π I/3](Sqrt[2] I x^3+1/Sqrt[3])==0;

with the conditions:

$a^{2}+b^{2} \leq 1$,

$1/2 \geq a \geq -1$, and

$\sqrt{3}/2 \geq b \geq -\sqrt{3}/2$.

I need numerical solutions for this equation. I tried to solve this in Mathematica, but ended up with messy solutions. Also I couldn't impose conditions on $a$ and $b$. Please help me in solving this.

  • $\begingroup$ Welcome to Mathematica.SE! Please share the equation in Mathematica code form, such that we could easily copy and try it out. $\endgroup$
    – Johu
    Oct 11, 2018 at 6:27
  • $\begingroup$ Are you looking for a real solution x depending on given constrained parameter values a,b? Or are you looking for real solution {x,a,b} fullfilling all the conditions? $\endgroup$ Oct 11, 2018 at 7:35

3 Answers 3


Here is one method of finding a numerical solution under your constraints

NMinimize[{Abs[-(a - I b) E^(4 Pi I/3) (Sqrt[2] I + x^3/Sqrt[3]) x -
  (a + I b) E^(2 Pi I/3) (Sqrt[2] I x^3 + 1/Sqrt[3])],
  {a^2 + b^2 <= 1, 1/2 >= a >= -1, Sqrt[3]/2 >= b >= -Sqrt[3]/2}}, {x, a, b}]

which gives you {x -> -1., a -> 0.330227, b -> -0.190657}

There are other solutions, but NMinimize is only returning one that it finds. If you want others you can try adding more conditions and see if it finds any solution in the smaller domain.

You should carefully read the help page for NMinimize and click on the "Details and Options" to see additional information. You want to be careful that the first part of what NMinimize returns, the minimum value found, is very close to zero. If that is not the case then it may have found a local, but non-zero minimum.

  • $\begingroup$ Strange: I have Mathematica version 8, and I received an error after copying and pasting your code: LessEqual::nord: Invalid comparison with 0.321702 +0. I attempted. >> and obtained different solutions : {2.42987*10^-6, {x -> -0.414215, a -> 0.139598, b -> -0.368109}} $\endgroup$
    – GerardF123
    Oct 11, 2018 at 9:26
  • $\begingroup$ Can't tell how NMinimize operates internally. SortBy[Select[Flatten[Table[NMinimize[ {Abs[-(a-I b) E^(4 Pi I/3) (Sqrt[2] I+x^3/Sqrt[3]) x-(a+I b) E^(2 Pi I/3) (Sqrt[2] I x^3 + 1/Sqrt[3])], {a^2+b^2<=1, 1/2>=a>= -1, Sqrt[3]/2>=b>= -Sqrt[3]/2}, a>a0, b>b0}, {x,a,b}], {a0,-1,1/2-1/5,1/5}, {b0,-Sqrt[3]/2,Sqrt[3]/2-1/5,1/5}], 1], First[#]<10^-4&], Last] shows some warnings and lots of possible solutions $\endgroup$
    – Bill
    Oct 11, 2018 at 15:54
  • $\begingroup$ @Bill- I need both real and complex solutions. Your method perfectly gives real solutions. How can I modify your method to obtain both real and complex solutions? $\endgroup$
    – Sunita
    Oct 11, 2018 at 16:16
  • $\begingroup$ NMinimize[{Abs[-(a-I b)E^(4 Pi I/3)(Sqrt[2] I+(xr+I xi)^3/Sqrt[3])(xr+I xi)-(a+I b) E^(2 Pi I/3)(Sqrt[2] I (xr+I xi)^3+1/Sqrt[3])], {a^2+b^2<=1, 1/2>=a>= -1, Sqrt[3]/2>=b>= -Sqrt[3]/2}}, {xr,xi,a,b}] $\endgroup$
    – Bill
    Oct 11, 2018 at 18:39

The solution of your equation can be obtained setting real and imaginary part equal to zero:

gln = ComplexExpand[{Re[#],Im[#]} &[-(a - I b) E^(4 Pi I/3) (Sqrt[2] I +x^3/Sqrt[3]) x - (a + I b) E^(2 Pi I/3) (Sqrt[2] I x^3 +1/Sqrt[3])], TargetFunctions -> {Re, Im}] 

Reduce (assuming all variables to be real) gives

sol = Reduce[gln == 0, x]

several conditions.

Now you have only to test which of these conditions are elements of the parameterspace {a,b}


Include the real condition in Solve. Here is your equation:

eqn = -(a - I b)Exp[4 π I/3](Sqrt[2] I+x^3/Sqrt[3])x - 
    (a+I b)Exp[2 π I/3](Sqrt[2] I x^3+1/Sqrt[3])==0;
eqn //TeXForm

$e^{-\frac{2 i \pi }{3}} x \left(\frac{x^3}{\sqrt{3}}+i \sqrt{2}\right) (-a+i b)-e^{\frac{2 i \pi }{3}} \left(\frac{1}{\sqrt{3}}+i \sqrt{2} x^3\right) (a+i b)=0$

and conditions:

conditions = a^2+b^2 <= 1 && -1 <= a <= 1/2 && -Sqrt[3]/2 <= b <= Sqrt[3]/2;

Use Solve, including reality conditions:

soln = Solve[eqn && (x | a | b) ∈ Reals];

Normal[soln] //ComplexExpand //Simplify //Column //TeXForm

$\begin{array}{l} \{a\to 0,b\to 0\} \\ \left\{a\to -\sqrt{3} b,x\to 1\right\} \\ \left\{a\to -\sqrt{3} b,x\to -1\right\} \\ \left\{a\to \frac{\sqrt{3} \left(31+22 \sqrt{2}\right) b}{9+6 \sqrt{2}},x\to -1-\sqrt{2}\right\} \\ \left\{a\to \frac{\sqrt{3} \left(22 \sqrt{2}-31\right) b}{6 \sqrt{2}-9},x\to 1-\sqrt{2}\right\} \\ \left\{a\to \frac{\left(5+4 \sqrt{2}\right) b}{\sqrt{3}},x\to \sqrt{2}-1\right\} \\ \left\{a\to \frac{\left(5-4 \sqrt{2}\right) b}{\sqrt{3}},x\to 1+\sqrt{2}\right\} \\ \end{array}$

Imposing your other conditions will just convert these infinite line regions into finite line regions. For example, the second solution corresponds to:

ComplexExpand @ Normal[soln[[2]]]

{a -> -Sqrt[3] b, x -> 1}


    Line[{{-Sqrt[3]/2, 1/2}, {1/2, -1/(2Sqrt[3])}}],
    ImplicitRegion[a == -Sqrt[3] b && conditions, {a,b}]



If there is no reality condition on x, then just do:

soln = Solve[eqn, x];

and plug in any values of a and b that satisfy your conditions. For example:

soln /. {a->.3, b->.1}

{{x -> -2.6158 - 0.635753 I}, {x -> -0.665718 + 0.958755 I}, {x -> 0.36097 + 0.0877316 I}, {x -> 0.488639 - 0.70373 I}}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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