MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Re: 3D graphs with constraints

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49792] RE: [mg49785] Re: 3D graphs with constraints
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 1 Aug 2004 04:09:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

That's an interesting surface.

For those who have DrawGraphics here's a smooth rendering with many fewer
plot points and no side walls. We don't need a and b, I used x instead of l
for clarity and I only plotted from x = 1 because the surface flares so much
as x -> 0.

Needs["DrawGraphics`DrawingMaster`"]

v = 2;
f[r_, l_] := Sin[r] Cos[l];

IteratorSubstitution[{r, f[r, x]}, {r, 0, Sqrt[v/(Pi*x)]}]
{{Sqrt[2/Pi]*w*Sqrt[1/x], Cos[x]*Sin[Sqrt[2/Pi]*w*Sqrt[1/x]]}, {w, 0, 1}}

We have to plot the surface in two pieces, for positive and negative r.

Draw3DItems[{EdgeForm[DimGray], ParametricDraw3D[{x, Sqrt[2/Pi]*w*Sqrt[1/x],
      Cos[x]*Sin[Sqrt[2/Pi]*w*Sqrt[1/x]]}, {x, 1, 40}, {w, 0, 1},
     PlotPoints -> {51, 11}], ParametricDraw3D[{x,
(-Sqrt[2/Pi])*w*Sqrt[1/x],
      Cos[x]*Sin[Sqrt[2/Pi]*w*Sqrt[1/x]]}, {x, 1, 40}, {w, 0, 1},
     PlotPoints -> {51, 11}]}, ImageSize -> 450,
   PlotRange -> {{0, 40}, {-(1/2), 1/2}, {-1, 1}/2}, BoxRatios -> {1, 1,
1/2},
   Background -> Linen, Axes -> True];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




From: Daniel Herring [mailto:dherring at at.uiuc.dot.edu]
To: mathgroup at smc.vnet.net

Mario Biondini wrote:
> In need to plot a function f[r,l] but only within the following domain
> for r, and l: a<r<b and l < v/(pi*r^2) where a, b, and v are constants.
> Any idea of how to do that.

Plot3D doesn't like that variable range on l...
Would something like the following work for you?

a = -1/2;
b = 1/2;
v = 2;
f[r_, l_] := Sin[r] Cos[l];
Plot3D[If[ l<v/(Pi*r^2), f[r, l], -10000],
	{l, 0, 40}, {r, a, b},
	PlotRange -> {{0, 40}, {-1/2, 1/2}, {-1, 1}},
	Mesh -> False, PlotPoints -> 100]

Basically, the added If statement sets the function to an invalid low
level outside the region of interest.  The PlotRange option keeps this
extreme low from ruining the scaling of the plot.  The other options
allow for a visually pleasing edge.

Hope that helps,
Daniel




  • Prev by Date: Re: Marking a (rectangular) zone in a standard 2D plot using "Rectangle"
  • Next by Date: Re: Re: Question on Compile[]
  • Previous by thread: Re: Marking a (rectangular) zone in a standard 2D plot using "Rectangle"
  • Next by thread: Re: Combining 2D graphs into a 3D graph