How to plot region of integration in Mathematica?
Transform your conditions to cylindrical coordinates
cond =
x^2 + (y - 1)^2 < 1 &&0 < z < x^2 + y^2 /. {x -> r Cos[φ], y -> r Sin[φ]} //
FullSimplify[#, {r > 0, -Pi < φ < Pi}] &
(*r < 2 Sin[φ] && 0 < z < r^2*)
to get the integration limits!
The first condition (remember r > 0
) implies 0 < φ < Pi
.
The integration limits follow to
{φ, 0, Pi}, {r, 0, 2 Sin[φ]}, {z, 0, r^2}
Checking the results:
Volume of the cartesian region:
ImplicitRegion[x^2 + (y - 1)^2 < 1 && 0 < z < x^2 + y^2, {x, y, z}] // Volume
(*3Pi/2*)
equals
Integrate[r, {φ, 0, Pi}, {r, 0, 2 Sin[φ]}, {z, 0,r^2}]
(* 3Pi/2*)
That's it. Hope it helps.
You can visualize the region of integration as follows if specified in rectangular / Cartesian coordinates. I am looking for a way to specify in cylindrical to the plot directly and will update when I find it.
With[{
Δ=0.1
},
RegionPlot3D[And[
x^2+(y-1)^2<=1,
z<=x^2+y^2,
z>=0
],
{x,-1-Δ,1+Δ},
{y,0-Δ,2+Δ},
{z,0-Δ,4+Δ},
Mesh->10,
MeshFunctions->{#3&},
PlotStyle->Directive[Opacity[0.5],Yellow],
MeshShading->{Red,Automatic},
PlotPoints->150,
PlotTheme->"Detailed",
AxesLabel->Automatic
]
]
ClearAll[getCartesian,getCylindrical];
getCartesian[field_]:=FullSimplify@TransformedField["Cylindrical"->"Cartesian",field,{r,θ,\[ScriptZ]}->{x,y,z}];
getCylindrical[field_]:=FullSimplify@TransformedField["Cartesian"->"Cylindrical",field,{x,y,z}->{r,θ,\[ScriptZ]}];
getCylindrical/@And[
x^2+(y-1)^2<=1,
z<=x^2+y^2,
z>=0
]
r^2 <= 2 r Sin[θ] && [ScriptZ] <= r^2 && [ScriptZ] >= 0
Now you can use this transformation function to directly specify the conditions in cylindrical coordinates and it will be plotted.
With[{
Δ=0.1
},
RegionPlot3D[Evaluate[getCartesian/@And[
r^2<=2r Sin[θ],
\[ScriptZ]<=r^2,
\[ScriptZ]>=0
]],
{x,-1-Δ,1+Δ},
{y,0-Δ,2+Δ},
{z,0-Δ,4+Δ},
Mesh->10,
MeshFunctions->{#3&},
PlotStyle->Directive[Opacity[0.5],Yellow],
MeshShading->{Red,Automatic},
PlotPoints->150,
PlotTheme->"Detailed",
AxesLabel->Automatic
]
]