question about plot3d



Le 16/11/2012 21:04, Dmitry Shkirmanov a ?crit :
> Thanks. I slightly modified your approach:
>
> f(x,y):=if x^2+y^2>1 then false else sin(x*y)$
> plot3d(f(x,y),[x,-1,1],[y,-1,1])$
>
> It returns very good graph.
>

There are also options to add more points if you want a smoother surface:
plot3d(f(x,y),[x,-1,1],[y,-1,1],[grid,50,50])$

> Just a curiosity: why
>
> f(x,y):=block([],
> if (y< -sqrt(1-x^2)) then return(0),
> if (y>sqrt(1-x^2)) then return(0),
> return(sin(x*y)));
>
> is not working?
If |x| > 1, then the square root is a complex number, so the inequality 
is never true,
and you always get the sine.