Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The question is what is the method to solve the implicit function has real and imaginary number.

For example, The function is $$F(x,y)=(-I*x + 2*y^2)^2 + x^2 - 4*y^4*Sqrt[1 - I*x/(y^2)]$$

Although I used a NSolve and Solve I can't get the solution. (It is too complicated to solve by those command i think.)

What is the value y? (y may be a complex number when x is given) And is it possible to draw a graph of Real[y] - x and Imaginary[y] - x?

share|improve this question
Have a look at FindRoot. – b.gatessucks Feb 26 '13 at 8:02
Do you want a solution for the equation F[x,y]==c? – Sjoerd C. de Vries Feb 26 '13 at 9:26
yes. (c==0) Do you know how to draw the graph about that relation? such as Real[y]-x (x is a real number. y is a complex number) – user132682 Feb 26 '13 at 10:12

Solve works, but first let's clean up the definition to avoid unnecessary singularities:

f[x_, y_] := (-I*x + 2*y^2)^2 + x^2 - 4*y^4*Sqrt[1 - I*x/(y^2)];
f[x, y] // TraditionalForm

$ x^2+\left(2 y^2-i x\right)^2-4 y^4 \sqrt{1-\frac{i x}{y^2}}$

This is easily simplified by inspection, but we can get Mathematica to help us. I cheat a little by giving it some overly strong assumptions; the purpose is to get it to "recognize" that the $1/y^2$ term is a removable singularity:

Assuming[y > 0, FullSimplify[f[x, y]]] // TraditionalForm

$4 y^2 \left(y \left(y-\sqrt{y^2-i x}\right)-i x\right)$

OK, that looks good, so let's memorialize it:

g[x_, y_] := Evaluate[Assuming[y > 0, FullSimplify[f[x, y]]]]

Now we invoke Solve:

Solve[g[x, y] == 0, {y}]

$\left\{\{y\to 0\},\left\{y\to -\sqrt[4]{-1} \sqrt{x}\right\},\left\{y\to \sqrt[4]{-1} \sqrt{x}\right\}\right\}$

(It is wise to pause here to reflect on the nature of these solutions due to ambiguities in the square and fourth roots: there are two square roots and four fourth roots involved in each solution, potentially designating $16$ different functions in all. However, it is evident that if we allow $x$ to be negative and permit complex square roots to be computed, then we need consider only the primitive fourth root $\exp{i \pi / 4}$ and its negative, both of which show up in the last pair of solutions. We conclude that we should retain all the solutions Solve has provided and allow $x$ to range over all real values, positive and negative.)

Let's encapsulate these solutions within yet another function. This re-solves the equations and extracts the solutions as expressions:

h[x_] := Evaluate@(Flatten[Solve[g[x, y] == 0, {y}]] /. Rule[y, f_] :> f)
h[x] // TraditionalForm

$\left\{0,-\sqrt[4]{-1} \sqrt{x},\sqrt[4]{-1} \sqrt{x}\right\}$

To plot a complex function of a real argument $x$, $y(x)$, we can employ three dimensions: its graph will be a curve. Because there are three separate solutions, we get parts of three such curves using ParametricPlot3D. Its three components are the parameter $x$ and the real and imaginary parts of $y(x)$. I give a fully general expression by selecting random colors for the curves: this avoids even having to count the number of distinct solutions in advance. So that the complex part is appropriately rendered, I use the BoxRatios argument to specify that the last two dimensions (real and imaginary axes) have the same scales.

ParametricPlot3D[Evaluate[{x, Re[#], Im[#]} & /@ h[x]], {x, -2, 2}, 
 PlotStyle -> Table[{Thick, Hue[RandomReal[], .8, .8]}, {i, h[0]}], 
 BoxRatios -> {Automatic, 1, 1}, Boxed -> False, 
 AxesLabel -> {x, Re[y], Im[y]}]

Plot 3D

You can also use ParametricPlot to render the image of $y$ in the complex plane, perhaps distinguishing the values of $x$ by color. Just drop the first parameter, leaving the real and imaginary parts to be drawn:

ParametricPlot[Evaluate[{Re[#], Im[#]} & /@ h[x]], {x, -2, 2}, 
 PlotStyle -> Thickness[0.02],  
 ColorFunction -> Function[{t, x, y}, Hue[t]], 
 AxesLabel -> {Re[y], Im[y]}, LabelStyle -> Medium]

Plot 2D

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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