Re: Question about Plotting with boundary constriants
- To: mathgroup at smc.vnet.net
- Subject: [mg58248] Re: Question about Plotting with boundary constriants
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 24 Jun 2005 02:50:16 -0400 (EDT)
- Organization: The Open University, Milton Keynes, England
- References: <d9e0pk$gce$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
HUAFANG CUI wrote:
> Hi,
>
> I have a question about plotting a 3d graph with some boundary constraints.
>
> for example,
>
> feasible area of function f(x, y) is 0 <= x <= 1 and 0 <= y <= 1-x.
>
> Thanks alot.
>
> HC
>
Hi,
Have a look at the functions *Boole* (if you have Mathematica 5.1) or
*UnitStep*. For example
First we define a function of two variables, say
In[1]:=
f[x_, y_] := Sin[x]^2 + Cos[y]
Then we plot it with your boundary conditions
In[2]:=
Plot3D[f[x, y]*Boole[0 <= y <= 1 - x], {x, 0, 1}, {y, -1, 1}];
Best regards,
/J.M.