I have the following equation:

$$D=\frac{1}{64} \pi A ^3 B \sin \left(C\right)-\frac{1}{2} \pi A B \sin \left(C\right)$$

which I want to solve for $A$. The equation is cubic in $A$ so this should give me 3 answers and, potentially, imaginary parts to the answers. I know, from the physical meaning of the parameters, that all parameters ($A$,$B$,$C$ and $D$) are positive and real.

My question is: how can I use Solve on this equation and make sure that there will be no imaginary parts popping up in the solution?

I have used the suggestion by Chris and tried:

Solve[d == 1/64 π a^3 b Sin[c] - 1/2 π a b Sin[c], a, Reals]

but I still see that there is a $\imath\sqrt{3}$ term in the answer. Why does this still appear?

  • $\begingroup$ related? mathematica.stackexchange.com/questions/3369/… $\endgroup$
    – chris
    Feb 26, 2013 at 20:34
  • $\begingroup$ Not exactly. I found this post but I would like Solve to work with the assumptions already 'in mind'. Not `change' the answer afterwards $\endgroup$
    – Michiel
    Feb 26, 2013 at 20:37
  • 3
    $\begingroup$ Solve[F[x],x,Reals] as suggested in reference.wolfram.com/mathematica/ref/Solve.html ? e.g. 'Solve[x^3 + 2 x^2 + 3 x + 4 == 0, x, Reals] // N' $\endgroup$
    – chris
    Feb 26, 2013 at 20:38
  • $\begingroup$ That is actually a good point. I didn't know that Solve had that option. I tried using $Assumptions, but that didn't help. Thanks! $\endgroup$
    – Michiel
    Feb 26, 2013 at 20:41
  • $\begingroup$ `Solve[x^3 + 2 x^2 + 3 x + 4 == 0, x, Reals] // ToRadicals // First // First' gives you the formal unique real root $\endgroup$
    – chris
    Feb 26, 2013 at 20:44

1 Answer 1


You can use the Reals Domain option in Solve as in

 Solve[x^3 + 2 a x^2 + 4 == 0, x, Reals] // ToRadicals // First // First

Mathematica graphics

For the example above, calling d=2D/Pi/B/Sin[C]

 Solve[d == 1/32  A^3  -  A , A, Reals] // ToRadicals // First //First // FullSimplify

Mathematica graphics

  • $\begingroup$ I have done what you mentioned, except for the //First//First part, because that will give me the wrong 1 of the 3 answers. $\endgroup$
    – Michiel
    Feb 26, 2013 at 20:56

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.