1
$\begingroup$

I want to draw the surface of the upper half of the sphere $z = \sqrt {4 x - x^2 - y^2}$ inside the cylinder $(x - 1)^2 + y^2 = 1$ .

reg = ImplicitRegion[
       z == Sqrt[4 x - x^2 - y^2] && ((x - 1)^2 + y^2 <= 1), {x, y, z}];
    Region[%, PlotRange -> All]

Region[DiscretizeRegion[
  ImplicitRegion[
   z == Sqrt[4 x - x^2 - y^2] && ((x - 1)^2 + y^2 < 1), {x, y, z}]], 
 PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}]

But the above code can't draw this surface. What should I do?

But the following code can get the desired result:

Region[DiscretizeRegion[
  ImplicitRegion[z^2 == 4 x - x^2 - y^2, {x, y, z}]], 
 PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}]

ClearAll["Global`*"]
ImplicitRegion[
   z == Sqrt[4 x - x^2 - y^2] && (x - 1)^2 + y^2 < 1 && 
    4 x - x^2 - y^2 > 0 && z > 0, {x, y, z}], 
  MaxCellMeasure -> "Length" -> 0.01], 
 PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}]

enter image description here

I want to know why the first method can't get the desired results?

enter image description here

However, using numerical method I can get the correct result. Maybe this is a bug?

Next, calculate the second-kind surface integral $I=\iint_{\Sigma} y z(y-z) \mathrm{d} y \wedge \mathrm{d} z+z x(z-x) \mathrm{d} z \wedge \mathrm{d} x+x y(x-y) \mathrm{d} x \wedge \mathrm{d} y$ on this surface.

Integrate[{y*z (y - z), z*x (z - x), 
   x*y (x - y)}.(Normalize[
    D[z - Sqrt[4 x - x^2 - y^2], {{x, y, z}}]]), {x, y, z} ∈ 
  reg]

DiscretizeRegion[
 ImplicitRegion[
  z == Power[4 x - x^2 - y^2, 1/4], {{x, -2, 2}, {y, -2, 2}, {z, 0, 
    2}}], AccuracyGoal -> 10]
$\endgroup$
6
  • 2
    $\begingroup$ Once again, please don't add [bugs] tag before it's confirmed. $\endgroup$ – xzczd Sep 4 '20 at 2:54
  • $\begingroup$ @xzczd Thank you for your advice. I just want to attract the attention of the experts. I will not do it again. $\endgroup$ – A little mouse on the pampas Sep 4 '20 at 3:04
  • 3
    $\begingroup$ If you want to attract attention, improve your question. Underhanded tactics attract downvote only. $\endgroup$ – xzczd Sep 4 '20 at 3:11
  • $\begingroup$ @xzczd Thank you for your advice. I will abide by it. It's all entertainment and playfulness. Actually, I am not a bad person. $\endgroup$ – A little mouse on the pampas Sep 4 '20 at 3:47
  • 1
    $\begingroup$ z^2 == 4 x - x^2 - y^2 has two solution region: z = Sqrt[4 x - x^2 - y^2] and z = - Sqrt[4 x - x^2 - y^2]. This creates difference. $\endgroup$ – Mustafa Kösem Sep 7 '20 at 5:01
2
+50
$\begingroup$
Plot3D[Sqrt[4 x - x^2 - y^2], {x, -2, 2}, {y, -2, 2}, 
 RegionFunction -> Function[{x, y}, (x - 1)^2 + y^2 <= 1], 
 PlotPoints -> 80, Mesh -> None, 
 PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}}, BoxRatios -> 1]

Or

ContourPlot3D[
 z^2 == 4 x - x^2 - y^2, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
 Mesh -> {{0}}, MeshStyle -> None, 
 MeshFunctions -> {Function[{x, y, z}, (x - 1)^2 + y^2 - 1], 
   Function[{x, y, z}, z]}, 
 MeshShading -> {{None, None}, {Red, None}}, BoundaryStyle -> None, 
 PlotPoints -> 80]

reply the questioner's comment

reg = ImplicitRegion[
   z^2 ==  4 x - x^2 - y^2 && (x - 1)^2 + y^2 <= 1 && z >= 0 , {x, y, 
    z}];
Region[%, PlotRange -> All]
Region[DiscretizeRegion[
  ImplicitRegion[
   z^2 == 4 x - x^2 - y^2 && (x - 1)^2 + y^2 < 1, {x, y, z}], 
  MaxCellMeasure -> "Length" -> 0.01], 
 PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}]

Update-2

Replace the power index 1/2 to 0.5 and using Cylinder domain we can draw the same surface.

reg = ImplicitRegion[
  z == (4 x - x^2 - y^2)^0.5 && {x, y, z} \[Element] 
    Cylinder[{{1, 0, 0}, {1, 0, 2}}, 1], {x, y, z}]
RegionPlot3D[DiscretizeRegion@reg, 
 PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thank you very much. I wonder why Region[DiscretizeRegion[ ImplicitRegion[z^2 == 4 x - x^2 - y^2, {x, y, z}]], PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}] can get the desired result, but Region[DiscretizeRegion[ ImplicitRegion[z == Sqrt[4 x - x^2 - y^2], {x, y, z}]], PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}] can't. What is the essential difference between the two methods? $\endgroup$ – A little mouse on the pampas Sep 4 '20 at 0:11
  • $\begingroup$ Thank you very much. After adding the condition of 4 x - x^2 - y^2 > 0, I can draw it, but the result is a little incorrect (show more parts):clear Region[DiscretizeRegion[ ImplicitRegion[ z == Sqrt[4 x - x^2 - y^2] && (x - 1)^2 + y^2 < 1 && 4 x - x^2 - y^2 > 0, {x, y, z}], MaxCellMeasure -> "Length" -> 0.01], PlotRange -> {{-2, 2}, {-2, 2}, {0, 2}}] $\endgroup$ – A little mouse on the pampas Sep 4 '20 at 2:14
  • $\begingroup$ Thank you very much, but the bottom of the answer of Update-2 is still not fully displayed. $\endgroup$ – A little mouse on the pampas Sep 8 '20 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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