2
$\begingroup$

Updated

I have an equation:

$x (z \ln z) = y$.

For different values of $x$ and $y$ we can solve this equation for z, for example, for $x = 3$ and $y =1$, we have:

FindRoot[3 z Log[z] == 1, {z, 0.1, 5}]

I like to have a 3D plot, where $x$ varies, for example, from $1$ to $3$, and $y$ from $2$ to $4$, and the third dimension to be the solutions of the equation, that is, $z$. How can I implement this in Mathematica?

Edit:

I need the command for solving the equation to be FindRoot.

$\endgroup$
  • $\begingroup$ Why do you need the command to be FindRoot? Is this a homework assignment? $\endgroup$ – N.J.Evans Oct 15 at 13:03
  • 1
    $\begingroup$ For comparison, ContourPlot3D enables plotting without an explicit solution. ContourPlot3D[x z Log[z] == y, {x, 1, 3}, {y, 2, 4}, {z, 1.5, 3.5}, AxesLabel -> Automatic] $\endgroup$ – Bob Hanlon Oct 15 at 13:12
  • 1
    $\begingroup$ @N.J.Evans The real equation that I wanted to solve it's only solvable with FindRoot. $\endgroup$ – user67794 Oct 19 at 19:59
  • $\begingroup$ @BobHanlon Thanks! $\endgroup$ – user67794 Oct 19 at 20:00
5
$\begingroup$

You can solve your equation for z

sol = Solve[x z Log[z] == y, z][[1]]
(*{z -> y/(x ProductLog[y/x])}*)

and plot z

Plot3D[z /. sol, {x, 1, 3}, {y, 2, 4}, AxesLabel -> Automatic]

numerical approach:

solu[x_?NumericQ, y_?NumericQ] :=z /. FindRoot[x z Log[z] == y, {z, 1}]
Plot3D[solu[x,y], {x, 1, 3}, {y, 2, 4}, AxesLabel -> Automatic]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks! I need to use FindRoot command. Can I just replace Solve with FindRoot? $\endgroup$ – user67794 Oct 15 at 11:05
  • $\begingroup$ The advantage of the symbolic solution would be lost. I'll modify my answer. $\endgroup$ – Ulrich Neumann Oct 15 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy