#### 7.38 Bug in contourplot in Maple6 (17.10.00)

Avanish Sathaye, who is using Maple in his calc 3 class, has observed that when

plots[contourplot]((x+y^2)/(x^2+y),x=-3..3,y=-3..3);

is issued to maple6, a contourplot of the numerator is returned. when the rational expression
is made into a function

f := (x,y)->(x+y^2)/(x^2+y);

and

plots[contourplot](f, -3..3, -3..3);

is issued a diﬀerent, even more bizarre, behavior occurs.

Even simpler expressions give similar results. For example,

contourplot(x/y,x=-3..3,y=-3..3);

For more odd variations, try

contourplot( [x,y,x/y],x=-3..3,y=-3..3);

It seems that contourplot has problems with fractions(?).

You can always resort to ’plot3d’ with the plotting style set to contour. If you rotate
the resulting plot so that you’re looking down from above you get a pretty good
result.

This is a known bug in Maple 6, which has been corrected in Maple 6.01. A patch is also
available in my Maple Advisor Database,

http://www.math.ubc.ca/~israel/advisor.

Since f is unbounded on this interval, it’s not surprising that contourplot has problems here
(it tries to choose contour values that are equally spaced over the range of observed values
of f, but those values will be rather large and will only occur for a few sampled
points).

More surprising is the behaviour when you specify the contour values. For example:

> plots[contourplot]((x,y) -> (x+y^2)/(x^2+y),-3..3,-3..3,
contours=[0]);

A work-around for this is to modify the function so that the denominator won’t be exactly 0
at any of the grid points. For example:

> plots[contourplot]((x,y) -> (x+y^2)/(x^2+y+0.00000001),-3..3,-3..3,
contours=[-3,-2,-1,0,1,2,3]);

It still looks a bit strange because linear interpolation of the function values doesn’t work
well across the curve where the denominator is 0. That problem will be alleviated somewhat
by increasing the "grid" values: try it with e.g. `grid=[100,100]`

.