Mathematica 3D Graphing (3D Plot) Issue

Click For Summary
SUMMARY

The discussion centers on graphing equations in Mathematica, specifically the equations "3x - y = 4" and "x + y + z = 5". The user initially faced issues with the latter not displaying in a 3D plot. The solution involves using ContourPlot3D for the three-variable equation, as Plot3D only accepts functions of two variables. Additionally, to graph both equations together, the user can solve for y in terms of x and z, allowing for proper visualization in a single plot.

PREREQUISITES
  • Familiarity with Mathematica syntax and commands
  • Understanding of 3D graphing concepts
  • Knowledge of implicit functions and their graphical representations
  • Basic algebraic manipulation to solve equations for specific variables
NEXT STEPS
  • Learn how to use ContourPlot3D in Mathematica for visualizing three-variable equations
  • Explore the syntax and options available in Plot3D for 3D surface plotting
  • Study how to manipulate equations to express one variable in terms of others for graphing
  • Investigate the ViewVertical option in Mathematica for adjusting plot orientations
USEFUL FOR

Mathematica users, educators in mathematics, and anyone interested in advanced graphing techniques for visualizing multi-variable equations.

Ascendant0
Messages
176
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
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K