Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

RE: Plotting functions with undefined values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43756] RE: [mg43744] Plotting functions with undefined values
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 3 Oct 2003 02:28:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Ronaldo,

If you wish to try out the DrawGraphics package at my web site below, then
it provides one method to make a nice plot of your surface.

Needs["DrawGraphics`DrawingMaster`"]

pos[m_] = (m + x - 1)/(x + y - 1)

The undefined line is given by...

Solve[x + y - 1 == 0, y]
{{y -> 1 - x}}

The strategy is to break the surface into two halves, divided by the
diagonal line. The only problem is that Mathematica does not allow you to
use a variable range iterator in plot statements (as you can in Integrate).
But you can achieve the same effect  by reparametrizing the surface,
replacing y by w, such that w has a fixed range iterator. This is done with
the DrawGraphics routine IteratorSubstitution. Here I obtain expressions for
both y and the surface height in terms of x and w. The new expressions and
the fixed range iterator are returned.

IteratorSubstitution[{y, pos[m]}, {y, 0, 1 - x}, w]
{{w - w*x, (-1 + m + x)/(-1 + w + x - w*x)}, {w, 0, 1}}

For the second half of the surface we use...

IteratorSubstitution[{y, pos[m]}, {y, 1 - x, 1}, w]
{{1 + (-1 + w)*x, (-1 + m + x)/(w*x)}, {w, 0, 1}}

Define the two new functions (or we could have pasted the expressions
directly into the plot statement).

pos2[m_] := (-1 + m + x)/(-1 + w + x - w*x)
pos3[m_] := (-1 + m + x)/(w*x)

Now we can draw the surface...

plot1 =
    Draw3DItems[
      {SurfaceColor[LightSteelBlue],
        EdgeForm[ColorMix[LightSteelBlue, Black][0.3]],
        Draw3D[pos2[0.5], {x, 0, 0.9999}, {w, 0, 0.9999}] /.
          DrawingTransform3D[#1 &, #2 - #2 #1 &, #3 &],

        SurfaceColor[LightCoral], EdgeForm[ColorMix[LightCoral,
Black][0.3]],
        Draw3D[pos3[0.5], {x, 0.0001, 1}, {w, 0.0001, 1}] /.
          DrawingTransform3D[#1 &, 1 + (#2 - 1)#1 &, #3 &]},

      NeutralLighting[0.3, 0.5, 0.1],
      BoxRatios -> {1, 1, 1},
      PlotRange -> {-5, 5},
      BoxStyle -> Gray,
      Background -> Linen,
      ViewPoint -> {2.371, -1.754, 1.659},
      ImageSize -> 450];

We had to slightly shade the range of x and w to avoid the undefined line. I
used a number of other DrawGraphics tricks here. I colored the first surface
as LightSteelBlue and the second surface as LightCoral. I used an EdgeForm
that was only a little darker than the surface colors so as to obtain a
subdued "mesh". I used NeutralLighting so that the colors would not be
overwhelmed by the usual Mathematica lighting.

Since the surface was drawn above the xw plane, we need to transform the
images to the xy plane. That is why I calculated the expression for y as
well as the height in IteratorSubstitution. I then used DrawingTransform3D
to transform the images from the xw plane to the xy plane. It takes pure
functions to compute x,y and z. #1 is the old x, #2 is the old w, and #3 is
the old z.

You can then obtain a nice view of this by spinning it around. Use the arrow
keys to advance one frame at a time.

SpinShow[plot1]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1,
      AnimationDirection -> Forward]}]

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

From: Ronaldo Prati [mailto:rcprati at bol.com.br]
To: mathgroup at smc.vnet.net


Hello everybody

I'm a new student using mathematica and I couldn't solve my problem by
myself.

I need to plot the function pos[m_] = (m + x -1)/(x+y-1), where
0<=pos<1, x and y are between 0 and 1 but x+y-1!=0. My problem is
that I could not input this constrain. When plot the function using
Plot3D, at the region where x+y = 1 several erros of infinith
expression 1/0 encountred are given. I'm not interested in plotting the
region where x+1 occurs, but the region where the function has a true
value (the graphic appers, but with a straigh region where it is undef).
How can i solve it?


  • Prev by Date: Re: Computational aspects of Galois theory?
  • Next by Date: Positive Integer Assumptions
  • Previous by thread: Plotting functions with undefined values
  • Next by thread: Re: Plotting functions with undefined values