2
$\begingroup$

I would like to plot Scherk's first surface which is defined on a checkerboard of the plane, e.g. $-\frac{\pi}{2} < x < \frac{\pi}{2}, -\frac{\pi}{2} < y < \frac{\pi}{2}$ and $\frac{\pi}{2} < x < \frac{3\pi}{2}, \frac{\pi}{2} < y < \frac{3\pi}{2}$.

The patch is $\mathbf{X}(u,v) = (u,v,f(u,v))$ where $f = \ln\left( \frac{\cos(x)}{\cos(y)}\right)$.

$\endgroup$
2
  • 1
    $\begingroup$ Consider plotting the implicit equation for Scherk's minimal surface instead: ContourPlot3D[Exp[z] Cos[y] == Cos[x], {x, -π/2, 3 π/2}, {y, -π/2, 3 π/2}, {z, -π/2, 3 π/2}]. $\endgroup$ May 31, 2016 at 16:22
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    May 31, 2016 at 16:41

1 Answer 1

10
$\begingroup$

You can use RegionFunction to set the region:

Plot3D[Log[Cos[x]/Cos[y]], {x, -(π/2), 3 π/2}, {y, -(π/2),3 π/2}, 
 RegionFunction -> 
  Function[{x, y, z}, -(π/2) < x < π/2 && -(π/2) < y < π/2 || π/
      2 < x < (3 π)/2 && π/2 < y < (3 π)/2]]

enter image description here

Or you can construct the region and plot inside it:

reg = ImplicitRegion[-(π/2) < x < π/2 && -(π/2) < y < π/2 
      || π/2 < x < (3 π)/2 && π/2 < y < (3 π)/2, {x, y}];
Plot3D[Log[Cos[x]/Cos[y]], {x, y} ∈ reg]
$\endgroup$
1
  • 2
    $\begingroup$ Or, reg = RegionUnion[Cuboid[-Pi/2 {1, 1}, Pi/2 {1, 1}], Cuboid[Pi/2 {1, 1}, 3 Pi/2 {1, 1}]]. $\endgroup$
    – rcollyer
    May 31, 2016 at 16:43

Your Answer

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

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