Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
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 –  Artes Oct 2 '12 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... –  J. M. Oct 2 '12 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. –  Mark McClure Oct 2 '12 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 '12 at 2:44
    
@E.O. Quit just serves that purpose. –  Artes Oct 2 '12 at 10:00
show 4 more comments

1 Answer 1

up vote 2 down vote accepted

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]}]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.