Mathematica 3D Graphing (3D Plot) Issue

In summary, the "Mathematica 3D Graphing (3D Plot) Issue" discusses challenges users face when creating 3D plots in Mathematica, including difficulties with rendering, performance, and the limitations of certain functions. It highlights common problems like axis scaling, plot aesthetics, and compatibility with different data types, suggesting potential solutions and workarounds to enhance the 3D graphing experience.
  • #1
Ascendant0
154
33
I'm trying to graph two equations to compare the two visually. For some reason, one of them isn't showing up, even though I'm in a range to where it should be. See the screenshot below.

The "3x - y = 4" is graphing fine, but for some reason, "x + y + z = 5" isn't showing up. At first, I tried them together. When that didn't work, I tried to graph the "x + y + z = 5" by itself, and it still didn't show up. To make sure something wasn't wrong with Mathematica, I figured I'd try graphing the "3x - y = 4" again, this time by itself. Again, it graphed that one fine, just like in the first graph. Can someone tell me what's going on here, and how to get it to graph the equation?

Also, for some reason when I use "Plot3D," it only lets me give a range for the x and y coordinates. If I try to add in a range for z as well, it gives me an error. Not sure why, as I feel it would make sense for us to give a range in all three, but is there a special way you have to add in the z range that's different than how you enter in the x and y range?

Graphs.JPG
 
Physics news on Phys.org
  • #2
Ascendant0 said:
I tried to graph the "x + y + z = 5" by itself, and it still didn't show up.
Plot3D is looking for a function of 2 variables. You cannot have 3 variables in the expression.

You could solve for z explicitly or you can plot that expression using ContourPlot3D.
 
  • Like
Likes Ascendant0 and PhDeezNutz
  • #3
Dale said:
Plot3D is looking for a function of 2 variables. You cannot have 3 variables in the expression.

You could solve for z explicitly or you can plot that expression using ContourPlot3D.
Thank you. I'm new to Mathematica, so I'm still learning all the various commands.

So, I used ContourPlot3D and that worked for the function that wasn't showing up before. But, how can I graph both of them on the same plot? I tried grouping them similar to what I do with Plot3D, but it seems to only take one function when I set it up like I did above with Plot3D (for the 2 equations together in one command).
 
  • #4
Plot3D plots the surface defined by [itex]z = f(x,y)[/itex].

In your case, [itex]3x - y = 4[/itex] is really [itex]3x - y + 0z = 4[/itex]. You can't solve that for [itex]z[/itex], but you can solve it for [itex]y[/itex] and plot [itex]y = f(z,x) \equiv 3x - 4[/itex]. You can then plot [itex]y = g(z,x) \equiv 5 - x - z[/itex] on the same axes. That leaves you with [itex]z[/itex] and [itex]x[/itex] as the horizontal axes, but you can change that by setting ViewVertical to {1,0,0} to make the [itex]z[/itex] axis vertical (see list of options here and detailed example here). (Listing the arguments as [itex]z[/itex] followed by [itex]x[/itex] ensures that you don't introduce an unwanted reflection in the plane [itex]x = z[/itex].)
 
  • #5
Ascendant0 said:
I tried grouping them similar to what I do with Plot3D, but it seems to only take one function when I set it up like I did above with Plot3D (for the 2 equations together in one command).
Hmm, worked for me.

Screenshot 2024-07-31 at 2.15.48 PM.png
 

Similar threads

Replies
5
Views
955
Replies
9
Views
852
Replies
3
Views
1K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
0
Views
845
Replies
5
Views
2K
Back
Top