Group Abstract Group Abstract

Message Boards Message Boards

0
|
12.4K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Plotting slices of 3D surface

Posted 10 years ago

i wanna draw the fuction w(x,y)=cosx.siny in wolfram mathematica 10 and also draw the cuts which are parallel to the x-axis in a Manipulate environment in which y from -? to ? is varied. Do the same with reversed roles of x and y. use the option Axes ? {False, True} and enter a range of values explicitly [-1,1]

Thanks in advance

POSTED BY: amin ayman
5 Replies

Somebody who has the power, please change the subject of this thread from "wolfram mathematica 10" to something that's actually informative and specific, such as "Plotting slices of 3D surface" or "Adding slices to plot of function of 2 variables".

POSTED BY: Murray Eisenberg

What code do you have already?

First, try making the plot of w(x,y)=cosx.siny.

Then separately try to make the plot of your cuts for several different values.

POSTED BY: Sean Clarke

Try breaking the problem up into simpler things.

(1) You need the correct syntax for a Mathematica function:

w[x_,y_] := Cos[x] Sin[y]

[I'm presuming that your ambiguous expression cosx.siny means, in traditional math notation, (cos x) (sin y) rather than cos(x sin y).]

(2) Then a 3d plot would be given by:

 Plot3D[w[x, y], {x, -3 Pi/2, 3 Pi/2}, {y, -3 Pi/2, 3 Pi/2}]

(3) Add one specific y = constant, say y = 2.25, slice by using a corresponding value for option Mesh:

yTrace = Plot3D[w[x, y], {x, -3 Pi/2, 3 Pi/2}, {y, -3 Pi/2, 3 Pi/2}, 
   Mesh -> {{-5}, {{2.25, Directive[Thick, Red]}}}, 
   PlotStyle -> LightBlue, AxesLabel -> {x, y, z}]

enter image description here

(The first entry {-5} in the value of Mesh is a "dummy" value for an x-slice, chosen to be outside the specified x-domain.)

(4) Do a similar thing for one specific x = constant slice.

(5) Construct a Manipulate in a simple form just for varying the constant in, say, y = constant.

(6) Repeat (5) for x = constant.

(7) Put the results of (5) and (6) together.

Note: You'll find this sort of thing already created in the Wolfram Demonstration: http://demonstrations.wolfram.com/CrossSectionsOfGraphsOfFunctionsOfTwoVariables/

(I found that Demonstration simply by Googling "mathematica slice 3d plot".)

If you want to show the plane y = constant that makes the slice, combine the Plot3D with an appropriate ContourPlot3D:

 ySlice = ContourPlot3D[y == 2.25, {x, -3 Pi/2, 3 Pi/2}, {y, -3 Pi/2, 3 Pi/2}, {z, -1, 1}, 
                   ContourStyle -> Opacity[0.5, Lighter@Green], Mesh -> None]

Then combine yTrace with ySlice using Show: Show[{yTrace, ySlice}]

enter image description here

Note that I made no serious attempt to make the 3d graphics look as clear and appealing as possible. Doing such things takes a lot of work (at least for me).

POSTED BY: Murray Eisenberg
Posted 10 years ago

thank u so much but still i tried to draw it but this error[Options expected (instead of Null) beyond position 3 in Plot3D[w[x,y],{x,-((3 [Pi])/2),(3 [Pi])/2},{y,-((3 [Pi])/2),(3 [Pi])/2},Mesh->{{-5},{{2.25,Directive[Thick,Red]}}},PlotStyle->LightBlue,Null,AxesLabel->{x,y,z}]. An option must be a rule or a list of rules. >>] appears sorry for bothering u because i m just a beginner and i study in german ...so complicated ..thanks anyway

POSTED BY: amin ayman

Sorry, in the Plot3D expression, there was an extra comma just before "AxesLabel". I've edited the code in my long post to remove it. And I directly copied from there into a Mathematica notebook where I executed it without error.

POSTED BY: Murray Eisenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard