# Plotting a function with implicitly defined variable

I have a question about plotting a function with an implicitly defined variable. I think the solution should be something similar like here: Define a function with variables linked implicitly but I quite can't get it to work. I apologize if this has been asked for, I tried doing a thorough search before asking. Anyway, I am trying to plot the following function:

$$u(x,y,t)=\text{sgn}(x+y-t+r(t))\big(e^{-\vert x+y-t+r(t) \vert }-1\big)+r(t)e^{-\vert x+y+r(t)+\ln(\frac{1}{9}r(t)^2-\frac{1}{2}r(t)+1)\vert}$$ where $r(t)$ is implicitly defined with the following equation $$\ln\vert r(t)\vert-\frac{1}{2}\ln\vert r(t)^2-\frac{9}{2}r(t)+9\vert+\frac{3\sqrt{}{7}}{7}\tan^{-1}\big(\frac{4r(t)-9}{3\sqrt{}{7}}\big)=2t.$$ Ultimately, I would like to use Plot3D for $u(x,y)$ and use Manipulate to see the function at different time steps of $t$. Thank you in advance for your time and help. It's greatly appreciated.

Edit: Here is some mathematica format to make life easier:

Sign[x + y - t + r] (Exp[-Abs[x + y - t + r]] -1) + r*Exp[-Abs[x + y - t + Log[1/9*r^2 - 1/2*r + 1]]]


and

Log[Abs[r]] + 1/2 Log[Abs[r^2 - 9/2 r + 9]] +3 Sqrt[7]/7*ArcTan[(4 r - 9)/(3 Sqrt[7])]

• Post your function / expression as a Mathematica expression that people can copy/paste, and you will be much more likely to get meaningful help. Jul 27 '15 at 19:46
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Jul 27 '15 at 20:08
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful Jul 27 '15 at 20:09
• Eric, if you feel that one of the two answers you received answers your question, you might want to consider accepting it officially by clicking the grey checkmark next to it. Aug 5 '15 at 23:11

u[x_?NumericQ, y_?NumericQ, t_?NumericQ] :=
Sign[x + y - t + rr[t]] (Exp[x + y - t + rr[t]] - 1) +
rr[t]*Exp[x + y - t + Log[1/9*rr[t]^2 - 1/2*rr[t] + 1]]
rr[t_] := r /. FindRoot[ 2 t - Log[Abs[r]] + (1/2) Log[Abs[r^2 - 9/2 r + 9]] +
3 Sqrt[7]/7*ArcTan[(4 r - 9)/(3 Sqrt[7])], {r, 1}]


This can plot it, options added for some speed

ContourPlot3D[u[x, y, t], {x, -2, 2}, {y, -2, 2}, {t, -1, 1},
PlotPoints -> 5, MaxRecursion -> 1, Mesh -> None, Contours -> 4]


• Thank you for your time, but I'm not sure if this is what I'm looking for. If you remove the $y$ dependency, the plot should look something like this: picture. I'm also not interested in plotting $t$ as a variable. I am interested in seeing what $u(x,y)$ looks like at different time steps, which is why I mentioned that I wanted to use Manipulate. Jul 27 '15 at 21:14
• @EricTovar The Mathematica code that you posted doesn't match the latex version of your formula, which is probably why the output is wrong. If you want to plot u(x, y) at different time steps, then just use Plot3D. Jul 28 '15 at 0:25
• @SimonRochester I didn't notice that! Thank you. And the Plot3D worked as well! Thank you :) Jul 28 '15 at 0:50

As Simon has already remarked, your Mathematica expressions do not reflect your LaTeX; assuming that the LaTeX is correct, then you can should be able to use the following:

u[x_?NumericQ, y_?NumericQ, t_?NumericQ] := Module[
{r},
r = FindRoot[
Log[Abs[r]] + 1/2 Log[Abs[r^2 - 9/2 r + 9]] +
3 Sqrt[7]/7*ArcTan[(4 r - 9)/(3 Sqrt[7])] == 2 t,
{r, 1, 1.1}
][[1, 2]];
Sign[x + y - t + r] (Exp[-Abs[x + y - t + r]] - 1) +
r*Exp[-Abs[x + y + r + Log[1/9*r^2 - 1/2*r + 1]]]
]

Manipulate[
Plot3D[
u[x, y, t], {x, -10, 10}, {y, -10, 10},
PlotPoints -> 10, MaxRecursion -> 2,
PlotRange -> All, Mesh -> None,
ColorFunction -> "TemperatureMap"
],
{{t, 0}, 0, 4, 1, RadioButtonBar}
]