Bug fix: Contourplot bugs

There are several bugs affecting contourplot in the plots package. The following two bugs can be remedied by using the procedure patchcontourplot from the Maple Advisor Database to install a patch.

> with(plots,contourplot):

> contourplot(x/y,x=1..2,y=1..2);

[Maple Plot]

> contourplot(x+y,x=0..1,y=0..x,coloring=[red,blue]);

[Maple Plot]

> savelibname:= "c:/advisor";

savelibname :=

Now run patchcontourplot() . A warning will result if you attempt to install the patch in a directory whose name does not include the word "advisor", and you will be asked to confirm that this directory is the proper target. This is intended to prevent you from accidentally writing to Maple's own "lib" or "update" libraries.

> patchcontourplot();

Now the examples above should work:

> contourplot(x/y,x=1..2,y=1..2);

[Maple Plot]

> contourplot(x+y,x=0..1,y=0..x,coloring=[red,blue]);

[Maple Plot]

> contourplot(r*cos(theta),r=0..3,theta=0..Pi,coords=polar);

Error, (in plot/iplot2d/patch) cannot convert to coordinate system polar

Three-dimensional coordinate systems do work, but not in the way you might expect.

> contourplot(r*cos(theta),r=0..3,theta=0..Pi,coords=cylindrical,scaling=constrained);

[Maple Plot]

It seems that contourplot(f(u,v), u=a..b, v=c..d, coords=cylindrical) actually plots the projection in the xy plane of the contours of the surface r = f(theta,z) , i.e. the curves r = f(theta,c) for different values of the constant c .

To produce a contour plot in a two-dimensional coordinate system, use the Maple Advisor Database function changecoords2d .

> changecoords2d(contourplot(r*cos(theta),r=0..3, theta=0..2*Pi,scaling=constrained), polar);

[Maple Plot]

To make a contour plot using a three-dimensional coordinate system such as cylindrical coordinates (plotting the level curves of z = f(r,theta) ), you can use the parametric version of contourplot .

> contourplot([r,theta,r*cos(theta)], r=0..3, theta=0..2*Pi, coords=cylindrical, scaling=constrained);

[Maple Plot]

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

[Maple Plot]

A work-around for this is to change either the definition of the function or the rectangle very slightly so that grid points will not be so very close to (or exactly on) the curve.

> contourplot((2*x+y)/(x^2-y),x=-3..3,y=-3.00001..3.00002,contours=[-2,0,2],axes=box,grid=[40,40]);

[Maple Plot]

See also: changecoords2d , contourplot , coords , How many contours? , labelledcontourplot , plot[options] , plots

Maple Advisor Database R. Israel, 2000