How to plot a surface in maple where the range is given by an expression, not constants?

382 Views Asked by At

Im trying to plot the surface $z=(1+x^2)/(1+y^2)$ , but specifically the part of the surface that is above $|x|+|y|\leq1$. Cant seem to find any information on how to produce a plot in maple, where your range is given by an expression, and not specific constants.

2

There are 2 best solutions below

0
On BEST ANSWER

Here is one way... Maple can solve that inequality in x and y which determines the domain.

solve(abs(x)+abs(y)<=1);

     {0 <= x, 0 <= y, x <= 1, y <= 1 - x}, {0 <= x, x - 1 <= y, x < 1, y < 0}, 

     {-1 <= x, 0 <= y, y <= 1 + x, x < 0}, {-1 - x <= y, -1 < x, x < 0, y < 0}

From there we can (for this example) merge four plots,

plots:-display(
  plot3d((1+x^2)/(1+y^2),y=0..1-x,x=0..1),
  plot3d((1+x^2)/(1+y^2),y=x-1..0,x=0..1),
  plot3d((1+x^2)/(1+y^2),y=0..1+x,x=-1..0),
  plot3d((1+x^2)/(1+y^2),y=-1-x..0,x=-1..0) );

And we can easily merge those into a just a pair of plots,

plots:-display(
  plot3d((1+x^2)/(1+y^2),y=x-1..1-x,x=0..1),
  plot3d((1+x^2)/(1+y^2),y=-1-x..1+x,x=-1..0) );

And then,

plot3d((1+x^2)/(1+y^2),y=abs(x)-1..1-abs(x),x=-1..1);

Each of these produces the 3D surface plot,

enter image description here

2
On

Here's another way. This produces a slightly rougher looking plot than Acer's, but it is much more intuitive to encode (just one line):

plot3d(piecewise(abs(x)+abs(y) <= 1, (1+x^2)/(1+y^2), undefined), x= -1..1, y= -1..1);

enter image description here