Ball

Author

Eric W. Weisstein
September 17, 2014

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SolidGeometry/Ball.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Ball.html.

©2014 Wolfram Research, Inc. except for portions noted otherwise

Definitions

ineq=x^2+y^2+z^2≤a^2;

implreg=ImplicitRegion[ineq,{x,y,z}];

reg=Ball[{0,0,0},a];

assum=a>0;

vol=4/3π a^3;

Diagram

Graphics

Graphics3D[Ball[],Boxed->False,Method->{"ShrinkWrap"->True},ImageSize->Small]

SolidData

SolidData["Ball","Image"]

RegionPlot3D

Block[{a=1},Show[RegionPlot3D[ineq,
{x,-a,a},{y,-a,a},{z,-a,a},Boxed->False,Axes->False,BoxRatios->Automatic],Method->{"ShrinkWrap"->True},ImageSize->Small]]

DiscretizeRegion

Block[{a=1},Show[DiscretizeGraphics[reg],Method->{"ShrinkWrap"->True},ImageSize->Small]]

Block[{a=1},Show[DiscretizeRegion[reg],Method->{"ShrinkWrap"->True},ImageSize->Small]]

Block[{a=1},Show[DiscretizeRegion[implreg],Method->{"ShrinkWrap"->True},ImageSize->Small]]

Properties

Centroid

Integrate Boole

Assuming[assum,FullSimplify[(vol^(-1))Integrate[{x,y,z}Boole[(x^2)+(y^2)+(z^2)≤(a^2)],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]]]//Timing

Integrate Cartesian

(vol^(-1))Integrate[{x,y,z},{x,-a,a},{y,-Sqrt[a^2-x^2],Sqrt[a^2-x^2]},{z,-Sqrt[a^2-x^2-y^2],Sqrt[a^2-x^2-y^2]}]//Timing

Integrate Cylindrical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[{r Cos[θ],r Sin[θ],z} r ,{r,0,a},{θ,0,2π},{z,-(Sqrt[(a^2)-(r^2)]),(Sqrt[(a^2)-(r^2)])}]]]//Timing

Integrate Spherical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[{r Cos[θ]Sin[ϕ],r Sin[θ]Sin[ϕ],r Cos[ϕ]} (r^2) Sin[ϕ],{r,0,a},{θ,0,2π},{ϕ,0,π}]]]//Timing

RegionCentroid

Assuming[assum,RegionCentroid[reg]]

Assuming[assum,RegionCentroid[implreg]]

Bounding Box

Simplify[BoundingBox[x^2+y^2+z^2==a^2,{x,y,z}],a>0]

Inertia Tensor

With[{ρ=(M/((4/3)π (a^3)))},ρ Integrate[{{y^2+z^2,-x y,-x z},
{-x y,z^2+x^2,-y z},
{-x z,-y z,x^2+y^2}}Boole[(x^2)+(y^2)+(z^2)<(a^2)],
{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0]
]//TraditionalForm

With[{ρ=(M/((4/3)π (a^3)))},ρ Integrate[Boole[r<a]InertiaTensor[{r,θ,ϕ},"CoordinateSystem"->"Spherical"](r^2)Sin[ϕ],{r,0,∞},{θ,0,2π},{ϕ,0,π},Assumptions->a>0]
]

MeanCylindricalRadius

Integrate Boole

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(Sqrt[(x^2)+(y^2)])Boole[(x^2)+(y^2)+(z^2)≤(a^2)],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]]]//Timing

With[{a=1},(1/(2 (a^3) π))3 Integrate[(Sqrt[((a^2)-(x^2)-(y^2)) ((x^2)+(y^2))]),{x,-a,a},{y,-(Sqrt[(a-x) (a+x)]),(Sqrt[(a-x) (a+x)])}]]//Timing

Integrate Cylindrical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[r r ,{r,0,a},{θ,0,2π},{z,-(Sqrt[(a^2)-(r^2)]),(Sqrt[(a^2)-(r^2)])}]]]//Timing

MeanSphericalRadius

Integrate Boole

Assuming[assum,(vol^(-1))Integrate[(Sqrt[(x^2)+(y^2)+(z^2)])Boole[(x^2)+(y^2)+(z^2)≤(a^2)],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]]//Timing

Integrate Spherical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[r (r^2) Sin[ϕ],{r,0,a},{θ,0,2π},{ϕ,0,π}]]]//Timing

MeanSquareCylindricalRadius

Integrate Boole

Assuming[assum,FullSimplify[(vol^(-1))Integrate[((x^2)+(y^2))Boole[(x^2)+(y^2)+(z^2)≤(a^2)],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]]]//Timing

Integrate Cylindrical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(r^2) r ,{r,0,a},{θ,0,2π},{z,-(Sqrt[(a^2)-(r^2)]),(Sqrt[(a^2)-(r^2)])}]]]//Timing

MeanSquareSphericalRadius

Integrate Cartesian

Assuming[assum,FullSimplify[(vol^(-1))Integrate[((x^2)+(y^2)+(z^2))Boole[(x^2)+(y^2)+(z^2)≤(a^2)],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]]]//Timing

Integrate Spherical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(r^2) (r^2) Sin[ϕ],{r,0,a},{θ,0,2π},{ϕ,0,π}]]]//Timing

Volume

Integrate Cartesian Coordinates

Integrate[1,{x,-a,a},{y,-Sqrt[a^2-x^2],Sqrt[a^2-x^2]},{z,-Sqrt[a^2-x^2-y^2],Sqrt[a^2-x^2-y^2]}]//Timing

Integrate Cylindrical Coordinates

Integrate[r,{θ,0,2π},{r,0,a},{z,-Sqrt[a^2-r^2],Sqrt[a^2-r^2]},Assumptions->a>0]//Timing

{0.33000000000000185` Second,((4 π (a^3))/3)}

Integrate Spherical Coordinates

Integrate[ρ^2 Sin[ϕ],{θ,0,2π},{ϕ,0,π},{ρ,0,a}]//Timing

{0.23000000000000043` Second,((4 π (a^3))/3)}

Boole V5.1

Integrate[Boole[x^2+y^2+z^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]//Timing

{15.280000000000008` Second,-(4/3) π ((((a^2)))^(3/2))}

Integrate[Boole[x^2+y^2+z^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0,GenerateConditions->True]//Timing

{30.340000000000003` Second,-((4 π (a^3))/3)}

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0]//Timing

{18.930000000000003` Second,((4 π (a^3))/3)}

Boole V5.2

Integrate[Boole[x^2+y^2+z^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]//Timing

{10.54` Second,(4/3) π ((((a^2)))^(3/2))}

Integrate[Boole[x^2+y^2+z^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0,GenerateConditions->True]//Timing

{12.36` Second,((4 π (a^3))/3)}

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0]//Timing

{13.93` Second,((4 π (a^3))/3)}

Boole V6

$Version

Integrate[Boole[x^2+y^2+z^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]//Timing

{1.430599` Second,(4/3) π ((((a^2)))^(3/2))}

Integrate[Boole[x^2+y^2+z^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0,GenerateConditions->True]//Timing

{0.972872` Second,((4 π (a^3))/3)}

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0]//Timing

{0.8105370000000001`,((4 π (a^3))/3)}

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,0,∞},Assumptions->a>0&&(x0|y0|z0)∈aeals]//Timing

{941.76898`,(Piecewise[{{((4 π (a^3))/3), a>0&&a-z0<0}, {((4 π (z0^3))/3), a>0&&a-z0==0}, {(1/3) π (2 a-z0) (((a+z0))^2), a>0&&a+z0>0&&z0≤0}, {(1/3) (6 π (a^3)+3 π (a^2) z0-5 π (z0^3)-4 π (a^2) (Sqrt[(a^2)-(z0^2)])-2 π (z0^2) (Sqrt[(a^2)-(z0^2)])), a>0&&z0>0&&a-z0>0}}])}

Boole V7

$Version

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0]//Timing

{0.8766830000000001`,((4 π (a^3))/3)}

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0&&(x0|y0|z0)∈Reals]//Timing

{0.34465499999998883`,((4 π (a^3))/3)}

Boole V8

$Version

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0]//Timing

...wrong...

Integrate[Boole[(x-x0)^2+(y-y0)^2+(z-z0)^2≤a^2],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->a>0&&(x0|y0|z0)∈Reals]//Timing

{295.78784000000087`,2 Integrate[(Sqrt[(a^2)-(x^2)+2 x x0-(x0^2)-(y^2)+2 y y0-(y0^2)]),{x,-a+x0,a+x0},{y,-(Sqrt[(a^2)-(x^2)+2 x x0-(x0^2)])+y0,(Sqrt[(a^2)-(x^2)+2 x x0-(x0^2)])+y0},Assumptions->(x0|y0|z0)∈Reals&&R>0]}

RegionMeasure

Assuming[assum,RegionMeasure[implreg]]

Volume

Assuming[assum,Volume[implreg]]