MathGroup Archive 2003

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

Search the Archive

RE: Plotting 3D with regions with non constant limits

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38714] RE: [mg38694] Plotting 3D with regions with non constant limits
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 6 Jan 2003 03:43:39 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Frans,

Here is a routine, which comes out of the DrawGraphics package, that will do
a variable substitution and generate new expressions so that the iterator
domain is constant in the new variable. If these expressions are then used
in a ParametricPlot3D you can plot surfaces with variable limits. One enters
the expression to transform, the original iterator, and a variable name for
the new variable (default is w).

IteratorSubstitution[expr_, iter:{var_, lim1_, lim2_}, newvar_:w] :=
  Module[{newiter, subrules, lim3, lim4, newexpr},
   {lim3, lim4} = If[lim2 === 0, {lim2, lim1}, {lim1, lim2}];
    newiter = {var, lim3, lim4}; newiter =
     If[ !(lim1 === 0 || lim3/lim4 === -1), (newiter - lim3)/(lim4 - lim3),
      newiter/lim4]; subrules = Solve[newvar == newiter[[1]], var];
    newiter[[1]] = newvar; newexpr = Simplify[expr /. subrules];
    newexpr = If[Length[newexpr] == 1, newexpr[[1]], newexpr];
    {newexpr, newiter}]

For your example...

IteratorSubstitution[{y, x + y}, {y, 0, 1 - x^2}]

{{w - w*x^2, w + x - w*x^2}, {w, 0, 1}}

We can then enter these values into ParametricPlot3D to obtain the planar
surface.

ParametricPlot3D[{x, w - w*x^2, w + x - w*x^2}, {w, 0, 1}, {x, -1, 1},
   BoxRatios -> {1, 1, 1},
   Axes -> True,
   ViewPoint -> {-0.009, -2.47, 2.312},
   ImageSize -> 450];


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


From: Frans de Boer [mailto:fhjdeboer at raketnet.nl]
To: mathgroup at smc.vnet.net

Hello everybody,

Consider the following problem

Plot3D[x + y, {y, 0, 1 - x^2}, {x, -1, 1}]
or
Plot3D[x + y, {x, -1, 1},{y, 0, 1 - x^2}]

Both are not accepted because Mathematica demands constant limiting values
for both x and y.
This seems strange to me.
Is there a way to plot a function of two variables where the limiting values
of one depend on the other?

I solved the problem by plotting

ParametricPlot3D[{r Cos[t], r^2 (Sin[t])^2,r^2 (Sin[t])^2 + r Cos[t]}, {t,
0, \[Pi]}, {r, 0, 1}]

but in general I find this to complicated.

Is there a direct way?

Sincerely,

Frans de Boer



  • Prev by Date: Re: Plotting 3D with regions with non constant limits
  • Next by Date: Re: Numbering of figure captions
  • Previous by thread: Re: Plotting 3D with regions with non constant limits
  • Next by thread: Re: Plotting 3D with regions with non constant limits