# How would one plot a multivariable function over several disjoint domains?

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)$.

• 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}]. May 31, 2016 at 16:22
• 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. May 31, 2016 at 16:41

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]] 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]

• Or, reg = RegionUnion[Cuboid[-Pi/2 {1, 1}, Pi/2 {1, 1}], Cuboid[Pi/2 {1, 1}, 3 Pi/2 {1, 1}]]. May 31, 2016 at 16:43