MathGroup Archive 2006

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

Search the Archive

3D plot with range restricted to non-rectangular region


I want to plot a function whose range is naturally restricted to a
non-rectangular region:

h[x_, y_, z_] := Log[x] + Log[y] + Log[z]

h2[x_, y_] := h[x, y, 1 - x - y]

Only the region {(x,y): 0<x<1; 0<y<1-x}  is allowed.

If I try the naive
Plot3D[h2[x, y], {x, 0, 1}, {y, 0, 1}]

then I get error messages of the type:

Plot3D::plnc: h2[x, y] is neither a machine-size real number at {x,
y}={0.5, \
0.5} nor a list of a real number and a valid color directive

But then it plots the graph anyway.

I also need contour plots of functions like this.

Is there a proper way of avoiding these error messages, like making it
ignore points whenever they contain an illegal operation (here, Log of
a negative number)?


  • Prev by Date: Re: How Functions are Applied to Matrices
  • Next by Date: Re: nearest neighbor
  • Previous by thread: Re: Solving Nonlinear Transcedental equations
  • Next by thread: Re: 3D plot with range restricted to non-rectangular region