Mathematica 3D Graphing (3D Plot) Issue

Click For Summary

Discussion Overview

The discussion revolves around issues encountered while graphing equations in Mathematica, specifically focusing on the visualization of the equations "3x - y = 4" and "x + y + z = 5". Participants explore the functionality of Plot3D and ContourPlot3D, addressing challenges related to plotting surfaces defined by multiple variables.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant reports that "x + y + z = 5" does not graph despite being in the expected range, while "3x - y = 4" graphs correctly.
  • Another participant explains that Plot3D requires a function of two variables and suggests solving for z explicitly or using ContourPlot3D.
  • A participant confirms success with ContourPlot3D for the previously ungraphable function but seeks guidance on plotting both equations together.
  • Another participant clarifies that "3x - y = 4" can be expressed in terms of y and provides a method to plot both equations on the same axes, including adjustments for axis orientation.
  • One participant expresses confusion about grouping functions in the plotting command, noting that it seems to only accept one function at a time.
  • A later reply indicates that grouping worked for them, suggesting a potential discrepancy in experiences among participants.

Areas of Agreement / Disagreement

Participants generally agree on the limitations of Plot3D regarding the number of variables but have differing experiences with successfully plotting multiple functions together. The discussion remains unresolved regarding the best method to graph both equations simultaneously.

Contextual Notes

Participants mention specific commands and functions in Mathematica, indicating a reliance on the software's capabilities and limitations. There are unresolved questions about the proper syntax and methods for combining multiple equations in a single plot.

Who May Find This Useful

Users of Mathematica, particularly those interested in 3D graphing and visualizing equations involving multiple variables.

Ascendant0
Messages
177
Reaction score
37
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
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   Reactions: Ascendant0 and PhDeezNutz
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).
 
Plot3D plots the surface defined by z = f(x,y).

In your case, 3x - y = 4 is really 3x - y + 0z = 4. You can't solve that for z, but you can solve it for y and plot y = f(z,x) \equiv 3x - 4. You can then plot y = g(z,x) \equiv 5 - x - z on the same axes. That leaves you with z and x as the horizontal axes, but you can change that by setting ViewVertical to {1,0,0} to make the z axis vertical (see list of options here and detailed example here). (Listing the arguments as z followed by x ensures that you don't introduce an unwanted reflection in the plane x = z.)
 
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 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K