2
$\begingroup$

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?

Thank you all in advance! enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Please post your code instead of only pictures. $\endgroup$
    – cvgmt
    Commented Sep 23, 2022 at 11:16
  • $\begingroup$ The code appears too: it is just right above each picture. $\endgroup$ Commented Sep 23, 2022 at 11:33
  • 1
    $\begingroup$ But the we can't copy the code from the pictures. $\endgroup$
    – cvgmt
    Commented Sep 23, 2022 at 11:40
  • $\begingroup$ Oh, yes, you're right. Sorry, I should've thought of that! $\endgroup$ Commented Sep 23, 2022 at 16:50

1 Answer 1

4
$\begingroup$

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

Mathematica graphics

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]

Mathematica graphics

Update 2

cvgmt comment below gets better

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

Mathematica graphics

$\endgroup$
9
  • 1
    $\begingroup$ Maybe Plot3D[s[x, y], Element[{x, y}, Disk[{0, 0}]], Exclusions -> None] $\endgroup$
    – Moo
    Commented Sep 23, 2022 at 11:46
  • 1
    $\begingroup$ @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. $\endgroup$
    – Nasser
    Commented Sep 23, 2022 at 11:47
  • $\begingroup$ No worries - add that as an update to your answer. In both cases, look at the artifact at $0$. $\endgroup$
    – Moo
    Commented Sep 23, 2022 at 11:48
  • 3
    $\begingroup$ Plot3D[s[x, y], {x, -1, 1}, {y, -1, 1}, Exclusions -> None] get better. $\endgroup$
    – cvgmt
    Commented Sep 23, 2022 at 11:56
  • 1
    $\begingroup$ @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? $\endgroup$
    – Moo
    Commented Sep 23, 2022 at 14:37

Your Answer

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

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