Here is my code:

f0[\[Lambda]0_, y0_, y1_, x_, k_] :=-(-y0 + k*x*y1 + (1 - k*x^2)*\[Lambda]0^2)^2 + 4*x^2*(1 - k^2*x)*\[Lambda]0^2*Abs[-(k*y0) + y1 + k*\[Lambda]0^2 - x*\[Lambda]0^2]

f1[\[Lambda]1_, y0_, y1_, x_, k_] := -(x*y0 - y1 + (1 - k*x^2)*\[Lambda]1^2)^2 + 4*x^2*(-k + x)*\[Lambda]1^2*Abs[-(k*y0) + y1 - \[Lambda]1^2 + k^2*x*\[Lambda]1^2]

f2[\[Lambda]0_, \[Lambda]1_, x_, k_] :=-1/27 + \[Lambda]0^3 + 3*x*\[Lambda]0^2*\[Lambda]1 + 3*k*x*\[Lambda]0*\[Lambda]1^2 + \[Lambda]1^3

$k$ is some positive number which can be chosen freely for example $k=1$ or $k=3/2$ or $k=2/3$. $f_0$ is only a function of $\lambda_0$, likewise $f_1$ is only a function of $\lambda_1$.

If I would insert $\lambda_0$ from $f_0$ into $f_2$ and insert $\lambda_1$ from $f_1$ into $f_2$ then $f_2$ will be a function of only $x,k,y_0,y_1$.

In this case I would like to have a 3D plot with x axis =$y_0$, y-axis=$y_1$, and z-axis =$x$ for $7/81<y_0<1/9$ and $7/81<y_1<1/9$, for some known $k$ as mentioned above and $x$ must be eventually in $0<x<1$, by positivity condition. Is it doable? how can I do that?


I obtain the polynomials via equating them to $0$. Namely, $f_0=0$, $f_1=0$ and $f_2=0$ are all given and known.

Thank you very much.

  • $\begingroup$ You have f2 function of 3 variables (x,y0,y1). This is not 3D function but 4D function. You can try ContourPlot3D[f2, {y0, 7/81, 1/9}, {y1, 7/81, 1/9}, {x, 0, 1}]. $\endgroup$ Jul 12, 2014 at 19:26
  • $\begingroup$ @Algohi that should be a 3D function. Let me explain. We can write it as $x=f(y_0,y_1)$ and for each $(y_0,y_1)$ we have a value of $x$. I am only interested in the values of $x$ which are in $[0,1]$. OK I think I forgot to mention that I have $f_0=0$, $f_1=0$, $f_2=0$! I must edit. Sorry for that. $\endgroup$ Jul 12, 2014 at 19:31
  • $\begingroup$ In this case, ContourPlot3D[f2==0, {y0, 7/81, 1/9}, {y1, 7/81, 1/9}, {x, 0, 1}] will do the job for you. $\endgroup$ Jul 12, 2014 at 19:42
  • $\begingroup$ @Algohi didnt work (( I think I need to mention also that $f_0=0$ and $f_1=0$. $\endgroup$ Jul 12, 2014 at 19:47
  • $\begingroup$ Please note that in the code you provided, f0 is not a function of lamda0. $\endgroup$ Jul 12, 2014 at 19:51

2 Answers 2


First of all f0 and f1 are quadratic in $\lambda_0$ and $\lambda_1$. So you would not get a unique value for them. So lets proceed in a general way.





see at last step, I specify one of the values of $\lambda_0$ and $\lambda_1$, i.e. the first value. you can choose any combination like (1,1),(1,2),(2,1)or(2,2).

Then comes the second difficulty. You may not get a graphics output with ContourPlot3D because the final function returns a lot of complex values. You can refine your function or see the Abs, Re or Im value.

ContourPlot3D[Abs[f[1, x, y0, y1]], {y0, 7/81, 1/9}, {y1, 7/81, 1/9}, {x, 0, 1},PlotPoints -> 3, AxesLabel -> {"y0", "y1", "x"}]

Since the function is quite heave I use PlotPoints->3. Otherwise it is taking too much time.

  • $\begingroup$ I posted an answer and the only problem is about NSolve. Please let me know if you have any idea to deal with this problem. $\endgroup$ Jul 13, 2014 at 8:07

Based on the answer of Sumit I manipulated the code so that the code should make what I want. But NSolve takes alot of time. I am still waiting and I dont think that the code will end. Is there a faster way? because I am interested in only the 3D plot which can be obtained purely numerically..




f[x_, y0_, y1_] = f2[\[Lambda]0s[[1]], \[Lambda]1s[[1]], x, 1];
xx := x /. NSolve[f[x, y0, y1] == 0, x];

Plot3D[xx, {y0, 7/81, 1/9}, {y1, 7/81, 1/9}, AxesLabel -> {"y0", "y1", "x"}]
  • $\begingroup$ I think the problem is with the complicated initial functions, which makes the final solution quite difficult, both for Solve and NSolve. That's why I suggest to go with Abs, Re or Im. Your method looks quite good to me. As a cross check generate Table[{x,y0,y1,f[x,y0,y1]},{x,..},{y0,..},{y1,..}]//TableForm and you can get an idea about if there exist a solution in the defined range. $\endgroup$
    – Sumit
    Jul 13, 2014 at 9:23

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.