# Defining regions for Exclusions

I have the following function I want to plot in 3D (For simplicities sake we can say $a=5,b=-1,c=3$.)

f[x_, y_, a_, b_,c_] := ((E^(b x) - E^(b y)) x)/((c E^(a b) + E^(b x)) (x - y))


However, when I plot it I get error messages for Intermediate values. To try to solve this I used Exclusions, but despite this I still get the same error messages.

Plot3D[{f[x, y,5,-1,3]}, {x, 9, 10}, {y, 9, 10}, Exclusions -> {x - y == 0}]


I thought I should maybe exclude the values -0.1<=x-y<=0.1, but I don't really know how to do it or if it works. Another thought I had was maybe use the conditions that result from using reduce. However, I'm not sure how to use the results to exclude intermediate values.

Reduce[f[x, y,5,-1,3] == 0, x]


Any suggestions on other ways to do it would be greatly appreciated.

• Why do you mind error messages ? Try e.g. Plot3D[{f[x, y, 5, -1, 3]}, {x, 9, 10}, {y, 9, 10}] // Quiet or if you need to exclude a region e.g. : Plot3D[{f[x, y, 5, -1, 3]}, {x, 9, 10}, {y, 9, 10},RegionFunction -> Function[{x, y, z}, Abs[x - y] > 0.1]] // Quiet Oct 2, 2012 at 1:51
• A simpler example: Plot3D[1/(x - y), {x, 9, 10}, {y, 9, 10}, Exclusions -> {x == y}]. Note that the message Power::infy only comes up once... Oct 2, 2012 at 1:51
• @Artes "Error message" might even be a misnomer, here. Maybe just a "warning" that something might be wrong, not necessarily that something is wrong. Oct 2, 2012 at 1:59
• @Artes it's not that I don't mind the error messages, it's just that I'm using it in a presentation and don't want the graph to produce messages.
– E.O.
Oct 2, 2012 at 2:44
• @E.O. Quit just serves that purpose. Oct 2, 2012 at 10:00

You can try using Quiet to suppress the message, or re-define the function to exclude the problem points in the function definition:

 f1[x_, y_, a_, b_, c_] := ((E^(b x) - E^(b y)) x)/((c E^(a b) + E^(b x)) (x - y)) /;
x != y;
f2[x_, y_, a_, b_, c_] := Switch[x == y, True,   Indeterminate,
_, ((E^(b x) - E^(b y)) x)/((c E^(a b) +  E^(b x)) (x - y))];

Row[{Plot3D[Quiet@f[x, y, 5, -1, 3], {x, 9, 10}, {y, 9, 10},
BoxRatios -> 1, ImageSize -> 250],
Plot3D[f1[x, y, 5, -1, 3], {x, 9, 10}, {y, 9, 10},
BoxRatios -> 1,  ImageSize -> 250],
Plot3D[f2[x, y, 5, -1, 3], {x, 9, 10}, {y, 9, 10},
BoxRatios -> 1, ImageSize -> 250]}] 