# How to plot solutions of a 3-variable equation, two variables normally, and the third one to change with colors? [duplicate]

I have this three variable equation $$4 \sinh (2 y) \cosh (z-x)+5 \sin (2 x-y)-6 x+y+3 \cosh (2 z)=0$$ where $$0

I want to have a continuous plot (by joining the adjacent points) of the solutions of the equation for the two variables $$x,y$$ in 2D, and the third variable $$z$$ changes with color ( ColorFunction for example from Blue to Red) with the step $$0.01$$, something like this

Is it possible to do this?

The equation

 5 Sin[2 x - y] + 3 Cosh[2 z] - 6 x + 4 Sinh[2 y] Cosh[z - x] + y==0


• I think you might have some problems with this strategy: for each x, y there are multiple z that solve the equation (even when restricting to the reals), so the question of what color the point at x, y should be arises. To see this consider N@Solve[5 Sin[2 x - y] + 3 Cosh[2 z] - 6 x + 4 Sinh[2 y] Cosh[z - x] + y == 0, z] /. {x -> 2, y -> -2}. However, if you have a way of picking just one z at each point that you want to show, it should be possible (but that method would be noncanonical, and up to you) Commented May 25, 2021 at 22:34
• @thorimur Thanks. I thought we can calculate the points $(x,y,z)$ which solves this equation, then, ask Mathematica to join the adjacent points and give a continuous line.
– user80187
Commented May 25, 2021 at 22:42
• ah, somehow i totally missed the restrictions on $z$! I was wrong that this is an issue; those restrictions turn out to be enough to make your idea work and to make the $z$-value at a given $x,y$ unique. cvgmt's solution works. :) Commented May 26, 2021 at 0:49
• You can edit you original question to clarify your needs. Commented May 26, 2021 at 13:03

Maybe use ContourPlot3D and ColorFunction for z.

ContourPlot3D[
5 Sin[2 x - y] + 3 Cosh[2 z] - 6 x + 4 Sinh[2 y] Cosh[z - x] + y ==
0, {x, 0, 4}, {y, -3, 0}, {z, 0, 2}, MeshFunctions -> {#3 &},
ColorFunction -> Function[{x, y, z}, Hue[z]],
ViewProjection -> "Orthographic", ViewPoint -> Top,
Axes -> {True, True, False}]


• Thank you, but I meant to see the change of $z$ (with step $0.01$) in your black curves with different colors., something like manipulating the variable $z$ but with colors. Is it possible?
– user80187
Commented May 26, 2021 at 9:12
• @MsMath ColorFunction -> (Blend[{{0, Red}, {1, Blue}}, #3] &) ? Commented May 26, 2021 at 10:22
• No, something like the second picture I have added to the text. Is it possible to show the change of $z$ like that?
– user80187
Commented May 26, 2021 at 11:04
• I mean using ContourPlot3D for the three variables $x,y,z$ where the behaviour of $z$ is shown by changing its colour.
– user80187
Commented May 26, 2021 at 11:09