Question: plot3d on a nonsqure region

Dear all:

    I want to plot a function(say, z=x^2+y^2) on a nonsqure region(say, x^2+y^2<=1). What I did is to manually define a procedure so that it returns the function value if the sample point is inside the defined regioin, null otherwise.

 

region:=proc(x,y)
  if x^2 + y^2 <= 1 then
      return x^2+y^2;
   else
      return null;
   end if:
 
 end proc;


 plot3d(region, -1..1,-1..1);

However, Maple gives a terrible plot: the surface near the boundary x^2+y^2=1 has many zigzags. I guess Maple doesn't sample enough points around the boundary.

Does anyone know any good way to plot a smooth surface in this case?

Thanks,

Peter

Please Wait...