I have a problem with a 3D surface in Mathematica 10.1. The problem is that the surface comes out disconnected even if it shouldn't. Here's a minimal toy example showing the problem:

Plot3D[E^-(x - Round[x])^2, {x, 0, 3}, {y, 0, 3}, PlotRange -> {0, 1}]

the result is

3D surface disconnected

The surface profile (in 2D) is that of a continuous line (even if it is not differentiable at all points):

Plot[E^-(x - Round[x])^2, {x, 0, 3}, PlotRange -> {0, 1}]

2D Profile is connected

Increasing the PlotPoints actually reduce the gaps' width, but doesn't eliminate them.

I have also tried the above code in Mathematica 9 and there's the same problem.

That effect is very awful in the rendering of a much more complex surface intended to reproduce a seashell (with bumps and nodules). Is there any simple workaround to smooth out (not differentiable) surfaces?


1 Answer 1


For the record, this can be solved by setting Exclusions -> None in Plot3D, which tells Mathematica not to exclude subregions of the domain that are associated with discontinuities. Generally, if you want that plot to look sharp, you will have to couple it with a largish number for MaxRecursions:

Plot3D[E^-(x - Round[x])^2, {x, 0, 3}, {y, 0, 3}, 
 Exclusions -> None,
 MaxRecursion -> 10
 PlotRange -> {0, 1}]


  • 2
    $\begingroup$ Yet another (sneaky!) way to thwart automatic exclusion is to make the definition f[x_?NumericQ] := E^-(x - Round[x])^2 and use that for the plots. $\endgroup$ Commented May 6, 2015 at 4:26
  • $\begingroup$ Instead of Exclusions-> None, there should be a command.. Inclusions-> All :) $\endgroup$
    – Narasimham
    Commented May 6, 2015 at 7:02

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