Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Limiting range of variables when defining funxtions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74700] Re: [mg74676] Limiting range of variables when defining funxtions
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 1 Apr 2007 04:15:08 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Off[Plot3D::plnc,Plot3D::gval];

Clear[test];
test[x_/;0<=x<=1,y_/;0<=y<=1-x]:=x+y;

Plot3D[test[x,y],{x,-0.1,1.1},{y,-0.1,1.1}];

Clear[test];
test[x_,y_]:=(x+y)*Boole[0<=x<=1&&0<=y<=1-x];

Plot3D[test[x,y],{x,-0.1,1.1},{y,-0.1,1.1}];

Clear[test];
test[x_,y_]:=Piecewise[
      {{x+y,0<=x<=1&&0<=y<=1-x}}];

Plot3D[test[x,y],{x,-0.1,1.1},{y,-0.1,1.1}];


Bob Hanlon

---- Michelasso <qzerty at gmail.com> 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?
> 



  • Prev by Date: Re: Which Mathematica product
  • Next by Date: Simplification with Integers assumption
  • Previous by thread: Re: comments in import files
  • Next by thread: Re: Limiting range of variables when defining funxtions