7.45 bug in densityplot in MapleV.5 and patch (6.10.98)

7.45.1 Dave Damiano

I noticed in the Unix version R5 that density plot interchanges the roles of the independent variables. For example,

        densityplot(x^2 -y,x=-3..3,y=-3..3);
 

yields a density plot of

 y^2-x

and

        densityplot(x^2-y,y=-3..3,x=-3..3);
 

yields the correct density plot but with the axes labeled incorrectly.

Is there a patch for this error?

It is corrected with Maple 6.01. (U. Klein)

7.45.2 Eric Johnstone (10.10.98)

Just got MAPLEVR5 (win95). I thought I would run an example from A. Heck’s book (Introduction to MAPLE, Springer Verlag, 2ed page 428):

> restart; 
> with(plots): 
> phi:=ln(sqrt((x+ 1)^2 + y^2)) - ln(sqrt((x-1)^2 + y^2)); 
> densityplot(phi,x=-2..2,y=-1..1,grid=[80,80],axes=box,style=patchnogrid, 
  colorstyle=HUE);
 

Release 4 does the plot correctly (like in Heck’s book). Release 5 confuses the axes!!!!!!

This problem is not seen for contourplot or gradplot however. The problem appears to be endemic to densityplot

Bummer.

It is as if the arguments of the function are permuted or something like that within densityplot. Anybody else notice this problem? Is there a work-around?

The quality of the output from densityplot is better though, if one is prepared to ignore this minor detail.

Also, it appears that R5 renders the plot about 2-3 times faster in 1/2 memory than R4.

7.45.3 Robert Israel (24.10.98)

As several people have noticed, densityplot in Release 5 has a bug which causes \(x\) and \(y\) to be "interchanged". Actually the result of

   densityplot(f(x,y), x = a .. b, y = c .. d)
 

is what should be obtained from

   densityplot(f(a + (b-a)*(y-c)/(d-c), c + (d-c)*(x-a)/(b-a)), x = a .. b, y = c .. d)
 

So a work-around is to use

> dplot:= proc(f, r1, r2) 
   local x, y, a, b, c, d, g; 
   if not typematch(r1, x::name = a::anything .. b::anything) then 
      ERROR("incorrect second argument") fi; 
   if not typematch(r2, y::name = c::anything .. d::anything) then 
     ERROR("incorrect third argument") fi; 
   g:= unapply(f, x, y); 
   densityplot(g(a+(b-a)*(y-c)/(d-c), c + (d-c)*(x-a)/(b-a)), args[2..-1]); 
   end;
 

The bug seems to be related to the use of hfarrays in densityplot.