# Plot3D plotting serrated edge

I want to plot the upper casket of a sphere in 3D using its parametrisation as $$s(x,y) = \sqrt{1-x^2-y^2}$$. Although this show be straight forward with Plot3D, I am running into an issue I find very funny.

As you might see in the picture below, when rendering the upper casket, a serrated pattern appears. Recall that increasing the value of PlotPoints provides a better result, yet a serrated pattern keeps appearing.

Does anyone know why this happens and how could it be avoided?

• The code appears too: it is just right above each picture. Sep 23, 2022 at 11:33
• But the we can't copy the code from the pictures. Sep 23, 2022 at 11:40
• Oh, yes, you're right. Sorry, I should've thought of that! Sep 23, 2022 at 16:50

Please post plain text code next time to eliminate having to type it from the image and making error.

You can play with MaxRecursion and PlotPoints to improve the plot. For example

s[x_, y_] := Sqrt[1 - x^2 - y^2]
Plot3D[s[x, y], Element[{x, y}, Disk[{0, 0}]],
MaxRecursion -> 4, (*try this option*)
PlotPoints -> 40   (*and this option*)
]


Help for MaxRecursion says Refine the surface where it changes quickly You can also add PerformanceGoal -> "Quality" but this did not seem to help as much as MaxRecursion but will not hurt to use it.

Update

Moo's comment below is better and faster:

Plot3D[s[x, y], Element[{x, y}, Disk[{0, 0}]], Exclusions -> None]


Update 2

cvgmt comment below gets better

Plot3D[s[x, y], {x, -1, 1}, {y, -1, 1}, Exclusions -> None]


• Maybe Plot3D[s[x, y], Element[{x, y}, Disk[{0, 0}]], Exclusions -> None]
– Moo
Sep 23, 2022 at 11:46
• @Moo nice one. I did not think of trying it. too many options, too little time. Feel free to post it as answer. Your solution is better and faster. Sep 23, 2022 at 11:47
• No worries - add that as an update to your answer. In both cases, look at the artifact at $0$.
– Moo
Sep 23, 2022 at 11:48
• Plot3D[s[x, y], {x, -1, 1}, {y, -1, 1}, Exclusions -> None] get better. Sep 23, 2022 at 11:56
• @Nasser: It is interesting that if you look at the boundary closely (between zero and one), you can see artifacts of the original issue - looks like white streaks. Can this be considered a bug?
– Moo
Sep 23, 2022 at 14:37