# 3space graphs on Mathematica 8

1. Jan 19, 2012

### Levi Tate

(note for editor; this is not a homework problem, this is bred out of my desire to visualize 3space)

Hello fellows,

I am hoping that somebody can help me. I've asked multiple teachers and tutors, but nobody can solve my seemingly very easy problem.

I am taking a course in multivariable calculus. I never planned on going into math and physics, it just happened naturally. Anyways, we are getting into 3space, and I am having trouble seeing what graphs in 3space actually look like, when viewed in a plane. That's why I bought Mathematica, but I cannot figure out how to graph a function in 3space. If somebody could help me with what to do I could greatly appreciate it. The functions do not need to be complex, I just want to see what is going on in three dimensions visually.

Here are a few examples from my text, if you could show me the way to graph one of these in three dimensions I'm sure I can use that syntax to graph other functions.

Thank you in advance if you can help me out here.

I want to get something with three variables..

Okay..

6x + 2y + 3z = 6

Then maybe a sphere as well

x^2 + y^2 + z^2 = 4

2. Jan 20, 2012

### lonewolf219

Hi, just started 3 dimensional calulus, too. The three coordinates refer to x y z axis. x is repositioned in 3 dimensions. y takes the place of x, and then z becomes the position y had. To graph a coordinate in tree dimensions, the first number is to move forward, towards yourself, from the origin. That is the x axis. The next number moves to the right, which is the new y axis. And the third number moves up, which is the new z axis. This positioning assumes al numbers (1,2,3) are positive.
If the z coordinate is 0, that means it has no height. That means it would lie entirely on the "floor", which is caled the xy plane. A PLANE looks like a flat sheet of paper. No height, no volume. The major diference between dimensions in my opinion is that x=6 on an x y graph will be a sraight line. But X=6 on an x,y,z graph is no longer just a line. It is now a PLANE, and looks like a sheet of paper. When x=6 on the 2D graph, there are infinite values of y in two directions, north and south. But on a 3D graph, there are infinite values for y AS WELL AS Z. That means the values are infinite again in both north and south directions (which represents z axis), as well as east and west (which represents y axis).

The coordinates (1,1,1) are a single point, just as they are in 2D. If a sphere equals 25, that means the radius is 5. (5^2)=25. You have to square the radius in a spere equation because the line created by the spere is not linear. The square curves the line. So the radius would measure 5 units from the center along each axis.

3. Jan 20, 2012

### Levi Tate

Sure, I hope this pushes this thread to the top so somebody proficient can answer my question.

4. Jan 20, 2012

### lonewolf219

5. Jan 20, 2012

### Levi Tate

Sure, what you said was good and all (I think) and I did not mean to disparage you, but I just want to know how to graph these things on Mathematica 8

6. Jan 20, 2012

### lonewolf219

I saw the word mathematica (as in, Principia). Also, you would not be visualizing anything. Visualize means to see a mental picture in your head, not on a computer screen.

7. Jan 20, 2012

### Levi Tate

Okay, I don't want to turn this into a puerile discussion of the semantics of what I wrote. It is my hope that somebody capable can provide me with the syntax I need to graph in 3space on Mathematica. Thank you in advance if you could help me with this, it will help me very much.

8. Jan 25, 2012

### luke

That is a good question. I had never actually used to visualize 3D surfaces until now. Nice idea.

Here are some example bits of script:

ContourPlot3D[6 x + 2 y + 3 z == 6, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}]
ContourPlot3D[x^2 + y^2 + z^2 - 4==0 , {x, -3, 3}, {y, -3, 3}, {z, -3, 3}]

I choose to use ContourPlot3D because in general you will not be able to describe a surface using z = f(x,y). IF you can write z=f(x,y), then you can use Plot3D but ContourPlot3D would work also. I think it is clear that ContourPlot3D will basically plot the surface that satisfies the equation. Make sure you use double equals. The below bit is just a more general form.

ContourPlot3D[f(x,y,z)==0, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}]

Also it you want to make the surface look "nice" try

ContourPlot3D[x^2 + y^2 + z^2 - 4==0 , {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, Mesh->None]

Check out the documentation for some more options but this should cover what you want.

PS: It just occurs to me that you might find it useful to plot regions in 3 space. Check out RegionPlot3D in the Mathematica documentation. It is just like ContourPlot3D but allows inequalities or systems of inequalities so you can define regions.

Last edited: Jan 25, 2012
9. Jan 26, 2012

### Levi Tate

Thanks a lot mate

I won't have time to try these until tonight, as I have physics and then math all day today.

I hope they work, right now I paid 125\$ and the only thing I can do is add 2+2.

I could have did that with my abacus.

I really hope these work, understanding mathematica is like taking a course kind of, I don't really have a lot of time to learn the syntax, so hopefully when i plug these in with the equations in my notes they'll show up.

Thanks again.

10. Jan 26, 2012

### luke

Let me know if you have trouble, but they worked for me.

In general, I find Mathematica's greatest strength for a beginner is the documentation. The documentation is mostly just a bunch of examples. Check it out. I didn't know about ContourPlot3D until I checked the documentation. The way I found it was I knew about ContourPlot and that it was useful for 2D plots were you have a function like f(x,y)=0. I figured that if Mathematica had something for 3D plots if would be mentioned. At the bottom of each page in the documentation is a list of related functions. That is how I found ContourPlot3D.

Good luck.

11. Jan 27, 2012

### Levi Tate

Thank you very much!

This really helps me see what's going on in 3space when I put in the functions.

Do you know how I can calibrate the bounds so the surfaces look the way I want them to, or is it arbitrary because they're extending past those points in the cube?

Sorry if that sounds dumb, I'm just getting a feel for this stuff.

12. Jan 29, 2012

### luke

Well if you want to change the domain over which the plot is made, you just need to change the limits

So this will show a cube that is 6x6x6 centered at (0,0,0)

ContourPlot3D[f(x,y,z)==0,{x,-3,3},{y,-3,3},{z,-3,3}]

This will show a larger region that is a 8x8x8 cube centered at (0,0,0)

ContourPlot3D[f(x,y,z)==0,{x,-4,4},{y,-4,4},{z,-4,4}]

The limits do not have to be the same

ContourPlot3D[f(x,y,z)==0,{x,0,4},{y,-1,3},{z,-10,10}]

You have to pick limits that make sense for the surface you want to see. It might take a few educated guesses.

13. Jan 29, 2012

### 20Tauri

If I remember MV calculus properly, I think we sometimes graphed 3D surfaces using Plot3D or PlotEquation3D. They take input using these syntax forms:

Plot3D[function of two variables, {var1, min, max}, {var 2, min, max}]

PlotEquation3D[left side of eqn == Right side of eqn, {x, min, max}, {y, min, max}, {z, min, max}]

You might also be interested in SphericalPlot or ParametricPlot3D.

Furthermore, if you want to get a template for the syntax of a command, you type the command name and then ctrl + shift + k. If you want information about a command, you type a question mark and then the command name and input the cell, i.e., ?Plot3D. In the little info box that pops up, you can click the >> to go to the Documentation Center, which will give you even more info.