3D plot with range restricted to non-rectangular region
- To: mathgroup at smc.vnet.net
- Subject: [mg66097] 3D plot with range restricted to non-rectangular region
- From: "David Sanders" <dpsanders at gmail.com>
- Date: Sat, 29 Apr 2006 03:40:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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.