Re: 3D plot with range restricted to non-rectangular region
- To: mathgroup at smc.vnet.net
- Subject: [mg66133] Re: [mg66097] 3D plot with range restricted to non-rectangular region
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 30 Apr 2006 04:21:58 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
h[x_,y_,z_]:=Log[x]+Log[y]+Log[z]; h2[x_,y_]:=h[x,y,1-x-y]; Off[Plot3D::gval]; Plot3D[h2[x, y], {x, 10^-15, 1}, {y,10^-15, 1}]; Off[ContourGraphics::ctpnt]; ContourPlot[h2[x, y], {x, 10^-15, 1}, {y,10^-15, 1}]; Bob Hanlon ---- David Sanders <dpsanders at gmail.com> wrote: > Hi, > > 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)? > > Thanks, > David. >