Re: Limiting range of variables when defining funxtions

*To*: mathgroup at smc.vnet.net*Subject*: [mg74703] Re: [mg74676] Limiting range of variables when defining funxtions*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Sun, 1 Apr 2007 04:16:40 -0400 (EDT)*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst*References*: <200703310627.BAA02986@smc.vnet.net>*Reply-to*: murray at math.umass.edu

Here's one way: Multiply your function by Boole[expr], where expr gives the restrictions. For example: Plot3D[Boole[0<=x && 0<=y<=1-x](x^2-y^2), {x,-1,1},{y,-1,1}]; Michelasso wrote: > Hello everybody, > my problem is that I would like to plot a 3d graphic of a function of > two variables, restricted to domain D={(x,y): x>= 0, y>=0, y <= 1-x}. > > I thought to define the function in this way: > test[x_,y_/; y <= 1-x]:= x+y > > but this seems not to work, while it works for functions of one > variable, i.e.: > test2[x_/; x<= 1]:= 3x > > So, am I doing some syntax error, or is there some other kind of > problems with my definition? > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305