# Trying to plot ugly expression, not working

I have this ugly function :

A[x_]:=((2 x^3 + 9 x^2 + 27 x + 3 Sqrt (3 x^4 + 14 x^3 + 27 x^2)^(1/2))/2)^(1/3)


(notice the fractional exponents at the end, it is indeed ugly) and it so happens that I want to plot the complex solutions

Abs[A[x] + (3x + x^2)/A[x] + x] == Abs[rho A[x] + rho^2 (3 z + z^2)/A[x] + x]


where rho is a cube root of unity (so we can just set it to (-1 - I Sqrt)/2).

This displays beautifully with ContourPlot and gives a picture of a curve (I actually have to replace x above by x+Iy and both x and y are in a [-3,3] range to see the picture).

In theory, I am supposed to be able to simplify this equation to something a little simpler, i.e. giving something like this :

A[x] Conjugate[x] + Conjugate[(3x+x^2)/A[x]] x + Conjugate[A[x]] (3x + x^2)/A[x] ==
rho^2 Conjugate[A[x] Conjugate[x] + Conjugate[(3x+x^2)/A[x]] x + Conjugate[A[x]] (3x + x^2)/A[x]]


I have checked the details a thousand times ; getting from the above equation to the latter is just squaring the absolute values, using |z|^2 = z Conjugate[z] and expanding, it's really trivial math. But when I use ContourPlot to find the solutions to the latter equation, the curve doesn't show up. Any explanations on this?... Anything would be appreciated! From a wild guess to a very detailed attempt or even a suggestion/question.

• @R.M : It is utterly simple, but it's really huge, because one needs to expand two products and each product is a product of two factors with three terms, so you end up adding 18 things. But it simplifies really well, you just need to know that (1-rho^2)/(1-rho) = rho+1 = -rho^2 and everything follows naturally. I really considered seriously the answer to your question. If you don't trust me, feel free to check it yourself, but re-transcribing it might end up in transcription mistakes more than anything else. – Patrick Da Silva Sep 10 '12 at 16:16
• ContourPlot[ Abs[H[x + I y]] == Abs[J[x + I y]], {x, -3, 3}, {y, -3, 3}] Where H[x_] := AA[x] + (3 x + x^2)/AA[x] + x and J[x_] := rho AA[x] + rho^2 (3 x + x^2)/AA[x] + x. This is the one that worked (using the initial equations, not the re-worked up ones). All my other attempts with the new equation failed, I tried a few using ContourPlot. – Patrick Da Silva Sep 10 '12 at 16:18
• I guessed that ContourPlot[A[x] Conjugate[x] + Conjugate[(3x+x^2)/A[x]] x + Conjugate[A[x]] (3x + x^2)/A[x] == Conjugate[A[x] Conjugate[x] + Conjugate[(3x+x^2)/A[x]] x + Conjugate[A[x]] (3x + x^2)/A[x]] rho^2 ,{x,-3,3},{y,-3,3}] should have worked, but unfortunately it didn't. – Patrick Da Silva Sep 10 '12 at 16:25
• There is no y in your last function – Dr. belisarius Sep 10 '12 at 16:27
• @belisarius : Sorry yes, I just typed it on MSE a little too fast. But I did put the x + Iy when I tried. I know the expression is a bit ugly but it's just something of the form f(x) = conjugate( f(x) ) rho^2, so if you just remember that f(x) = A[x]...+(3x+x^2)/A[x], I tried something like ContourPlot[F[x+Iy] == Conjugate[F[x+I y]] rho^2, {x,-3,3},{y,-3,3}], and I tried with+without using a function F or the actual expression. – Patrick Da Silva Sep 10 '12 at 16:27

It doesn't look like the two equations are equivalent. I defined two expressions with the difference of your lhs and rhs :

rho = (-1 - I Sqrt)/2;
A[x_] := ((2 x^3 + 9 x^2 + 27 x +
3 Sqrt (3 x^4 + 14 x^3 + 27 x^2)^(1/2))/2)^(1/3)

equation = ComplexExpand[Abs[A[z] + (3 z + z^2)/A[z] + z] -
Abs[rho A[z] + rho^2 A[z] + z] /. z -> x + I y, TargetFunctions -> {Re, Im}];

equation2 = ComplexExpand[A[z] Conjugate[z] + Conjugate[(3 z + z^2)/A[z]] z +
Conjugate[A[z]] (3 z + z^2)/A[z] - rho^2 Conjugate[
A[z] Conjugate[z] + Conjugate[(3 z + z^2)/A[z]] z +
Conjugate[A[z]] (3 z + z^2)/A[z]] /. z -> x + I y, TargetFunctions -> {Re, Im}];

equation /. {x -> 1.2, y -> 3.4}
equation2 /. {x -> 1.2, y -> 3.4}

(* -3.36029
0.652864 - 0.376931 I *)

ContourPlot[{Re[equation2] == 0, Im[equation2] == 0,  equation == 0}, {x, -3, 3}, {y, -3, 3}] • The picture in purple is quite similar to the one I have, except mine was way smoother. The equation you have in brownish looks like the conjugate of the equation in purple. I expected this to happen, but I didn't know about the ComplexExpand command. – Patrick Da Silva Sep 10 '12 at 17:27
• I really don't understand why you added those two lines though! equation /. {x -> 1.2, y -> 3.4} equation2 /. {x -> 1.2, y -> 3.4} – Patrick Da Silva Sep 10 '12 at 17:29
• @PatrickDaSilva Just a quick check to make sure the expressions evaluate. – b.gates.you.know.what Sep 10 '12 at 17:33
• Sure. I'll give it a try and look what happens. But you definitely don't have the right expression; that curve in brown down there is not natural in the problem. Maybe I typed something wrong when entering the question in Mathematica. I'll double check – Patrick Da Silva Sep 10 '12 at 17:35
• I just saw that the typo was also in my question. It was really just a transcription mistake though because I've always been able to plot the first equation, it was with the second one I had trouble. And you helped! Thank you again. +1 & check! – Patrick Da Silva Sep 10 '12 at 17:46