1
$\begingroup$

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.

$\endgroup$
8
  • $\begingroup$ Have you considered reparametrizing in polar coordinates, and then using ParametricPlot3D[]? $\endgroup$ Apr 25, 2013 at 17:11
  • 1
    $\begingroup$ If you use options like PlotPoints -> 100 the results is quite nice I think. $\endgroup$ Apr 25, 2013 at 17:18
  • $\begingroup$ "Better" in what sense, precisely? $\endgroup$
    – whuber
    Apr 25, 2013 at 17:29
  • $\begingroup$ Yeah, precisely. Whats wrong with RegionFunction? $\endgroup$ Apr 25, 2013 at 17:34
  • 1
    $\begingroup$ @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. $\endgroup$
    – Jim
    Apr 25, 2013 at 17:37

1 Answer 1

4
$\begingroup$

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]

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.