# How to draw this three-dimensional implicit region?

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


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

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]

• Once again, please don't add [bugs] tag before it's confirmed. Sep 4, 2020 at 2:54
• @xzczd Thank you for your advice. I just want to attract the attention of the experts. I will not do it again. Sep 4, 2020 at 3:04
• If you want to attract attention, improve your question. Underhanded tactics attract downvote only. Sep 4, 2020 at 3:11
• @xzczd Thank you for your advice. I will abide by it. It's all entertainment and playfulness. Actually, I am not a bad person. Sep 4, 2020 at 3:47
• 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. Sep 7, 2020 at 5:01

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]


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


• 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? Sep 4, 2020 at 0:11
• 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}}] Sep 4, 2020 at 2:14
• Thank you very much, but the bottom of the answer of Update-2` is still not fully displayed. Sep 8, 2020 at 1:45