Re: Plotting functions with undefined values
- To: mathgroup at smc.vnet.net
- Subject: [mg43772] Re: Plotting functions with undefined values
- From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
- Date: Sat, 4 Oct 2003 02:04:51 -0400 (EDT)
- References: <blgk0b$jb2$1@smc.vnet.net> <blj62u$1hg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Bo Le" <bole79 at email.si> wrote: > You can define your function with the If clause: > > f[x_,y_,m_]:=If[y==1-x,0,(m+x+1)/(x+y-1)]; > > Plot3D[ f[x,y,1],{x,0,1},{y,0,1} ] But unfortunately that produces a graph which is _even more deceptive_ than naively using just f[x_,y_,m_]:= (m+x+1)/(x+y-1); Plot3D[f[x,y,1],{x,0,1},{y,0,1}] Let me suggest something which produces a graph which is a fair representation. And, although certainly not as nice as David Park's solution, mine is substantially simpler: f[x_,y_,m_]:= If[x+y != 1,(m+x+1)/(x+y-1)]; Plot3D[f[x,y,1],{x,0,1},{y,0,1}] Of course, there are various comments generated before the graph, but the graph produced is, as I said, a fair representation. Another possibility (perhaps closer to what Bo Le had in mind), would be to use f[x_,y_,m_]:=If[y==1-x,ComplexInfinity,(m+x+1)/(x+y-1)]; Plot3D[f[x,y,1],{x,0,1},{y,0,1}] which again gives a graph having no spurious portions of the surface. David Cantrell > "Ronaldo Prati" <rcprati at bol.com.br> wrote in message > news:blgk0b$jb2$1 at smc.vnet.net... > > I need to plot the function pos[m_] = (m + x -1)/(x+y-1), where > > 0<=pos<1, x and y are between 0 and 1 but x+y-1!=0. My problem is > > that I could not input this constrain. When plot the function using > > Plot3D, at the region where x+y = 1 several erros of infinith > > expression 1/0 encountred are given. I'm not interested in plotting the > > region where x+1 occurs, but the region where the function has a true > > value (the graphic appers, but with a straigh region where it is > > undef). How can i solve it?