# Plot a function over a specific domain

I have a function that is defined on a specific domain for example the function $$f(x,y)=(x-0.5)*(y-0.5)$$ defined on $\Sigma$ which is the circle $(x-0.5)^2+(y-0.5)^2=0.5^2$

How to plot $f$ over $\Sigma$?

I tried something like

Plot3D[(-0.5 + x) (-0.5 + y), {x, -1, 1}, {y, -1, 1},
RegionFunction ->
Function[{x, y}, 0.5^2 - 0.01 <= (x - 0.5)^2 + (y - 0.5)^2 <= 0.5^2 + 0.01]]


but I am looking for something better.

-
Have you considered reparametrizing in polar coordinates, and then using ParametricPlot3D[]? –  Ｊ. Ｍ. Apr 25 '13 at 17:11
If you use options like PlotPoints -> 100 the results is quite nice I think. –  b.gatessucks Apr 25 '13 at 17:18
"Better" in what sense, precisely? –  whuber Apr 25 '13 at 17:29
Yeah, precisely. Whats wrong with RegionFunction? –  Sjoerd C. de Vries Apr 25 '13 at 17:34
@whuber Well, what I tried gave a plot with discontinuities. PlotPoints->100 seems to solve this. However it essentially gives a band around the solution, defined a parameter (in this case 0.01). Changing the parameter leads again to problems. So I am looking for a more natural way to solve this. –  Jim Apr 25 '13 at 17:37

## 1 Answer

Try this:

Plot3D[
(x - .5) (y - .5),                        (*  your f(x,y)       *)
{x, 0, 1}, {y, 0, 1},
MeshFunctions -> Function[{x, y, z},
(x - .5)^2 + (y - .5)^2 - .5^2          (*  your Σ equation   *)
],
Mesh -> {{0}},
MeshStyle -> Red,
PlotStyle -> None, BoundaryStyle -> None]


-
Very nice solution and it has the advantage that it works even when parametrization is difficult. –  Jim Apr 25 '13 at 19:24
@Jim Thanks. In fact implicit functions are sometimes easier to use than parametric ones. Please compare to this similar question. –  Silvia Apr 25 '13 at 19:28