Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
Have you considered reparametrizing in polar coordinates, and then using ParametricPlot3D[]? –  J. M. Apr 25 '13 at 17:11
1  
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
1  
@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 1

up vote 3 down vote accepted

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

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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