0
$\begingroup$

I want to plot the implicitly defined function $u(x,\,t)=(x - u(x,\,t)\, t)^2$. How can I do that?

$\endgroup$
  • 1
    $\begingroup$ What does ut mean? $\endgroup$ – Kuba Sep 10 '20 at 11:08
  • $\begingroup$ ut means u(x,t)*t, (value of function times t) $\endgroup$ – Von Sep 10 '20 at 11:11
  • $\begingroup$ Have you seen the documentation for ContourPlot? $\endgroup$ – Marius Ladegård Meyer Sep 10 '20 at 11:21
  • $\begingroup$ I am reading it right now, but i still don't know to implement nested part. $\endgroup$ – Von Sep 10 '20 at 11:28
  • 2
    $\begingroup$ You can solve for u. Rearrange the equation as Solve[x^2 + u (-1 - 2 t x + t^2 u) == 0, u] and you have two solutions u1[x_,t_] := (1 + 2 t x - Sqrt[1 + 4 t x])/(2 t^2) and u2[x_,t_]:=(1 + 2 t x + Sqrt[1 + 4 t x])/(2 t^2) $\endgroup$ – flinty Sep 10 '20 at 11:34
4
$\begingroup$

Yes, we regard u[x,t] as a implicit function which define by the equation u=(x-u*t)^2. So we can use ContourPlot3D to draw the relations between the three variables x,t,u

ContourPlot3D[u == (x - u*t)^2, {x, -5, 5}, {t, -5, 5}, {u, -5, 5}, 
 Mesh -> None, PlotPoints -> 60, AxesLabel -> {x, t, u}, 
 AxesStyle -> Directive[{Blue, FontFamily -> "Times", 15}]]

enter image description here

$\endgroup$
  • $\begingroup$ Okey, what if i wanted to make countourplot of function u? (not 3d, i mean 2d one, countour lines of fuction u(x,t).) Just inserting ContourPlot[u == (x - u*t)^2, {x, -5, 5}, {t, -5, 5}, {u, -5, 5}] doesnt seem to work. $\endgroup$ – Von Sep 10 '20 at 12:43
  • $\begingroup$ @Von One way is project to x-t plane. ContourPlot3D[u == (x - u*t)^2, {x, -5, 5}, {t, -5, 5}, {u, -5, 5}, MeshFunctions -> (#3 &), Mesh -> 50, PlotPoints -> 60, AxesLabel -> {x, t, u}, ContourStyle -> None, AxesStyle -> Directive[{Blue, FontFamily -> "Times", 15}], ViewProjection -> "Orthographic"] /. {Graphics3D -> Graphics, {x_Real, t_Real, u_Real} -> {x, t}} $\endgroup$ – cvgmt Sep 10 '20 at 13:28
2
$\begingroup$

For the 2D contour plots

Clear["Global`*"]

eqn = u[x, t] == (x - u[x, t]*t)^2;

sol = Solve[eqn, u[x, t]] // Simplify

(* {{u[x, t] -> (1 + 2 t x - Sqrt[1 + 4 t x])/(2 t^2)}, {u[x, t] -> (
   1 + 2 t x + Sqrt[1 + 4 t x])/(2 t^2)}} *)

Verifying the solutions,

eqn /. sol // Simplify

(* {True, True} *)

Column[
 ContourPlot[#, {x, -4, 4}, {t, -4, 4},
    PlotLegends -> Automatic,
    ImageSize -> Medium,
    FrameLabel -> Automatic,
    PlotPoints -> 50,
    PlotLabel -> Style[StringForm["``", #], Bold, 14]] & /@
  (u[x, t] /. sol)]

enter image description here

$\endgroup$

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