Cork Plug

Author

Eric W. Weisstein
May 5, 2016

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

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

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

Definitions

ent="CorkPlug";

var=SolidData[ent,"Variables"]

parm=Symbol/@SolidData[ent,"Parameters"]

ineq=(SolidData[ent,"Inequalities"]@@var)@@parm

implreg=SolidData[ent,"ImplicitRegion"]@@var

reg=SolidData[ent,"Region"]@@var

assum=SolidData[ent,"VariableConstraints"]@@var

vol=SolidData[ent,"Volume"]@@var

Equations

ineqs=PolyhedronInequalities[{
Polygon[Reverse@{{-r,0,h},{0,r,0},{r,0,h}}],
Polygon[Reverse@{{r,0,h},{0,-r,0},{-r,0,h}}]
},{x,y,z}]

Plots

Graphics3D

CorkPlug[jj_:50]:=Module[{x,s=2},
{
Polygon[Table[{Sin[x],Cos[x],0},{x,0,2Pi,Pi/jj}]],
Polygon[Table[{Sin[x],Cos[x],s(1-Abs[Sin[x]])},{x,(#-1)Pi,#Pi,Pi/jj}]]&/@{1,2},
Table[Polygon[{{Sin[x],Cos[x],0},{Sin[x+Pi/jj],Cos[x+Pi/jj],0},{Sin[x+Pi/jj],Cos[x+Pi/jj],s(1-Abs[Sin[x+Pi/jj]])},{Sin[x],Cos[x],s(1-Abs[Sin[x]])}}], {x,0,2Pi,Pi/jj} ]
}
]

Projections

Show[GraphicsArray[Graphics3D[CorkPlug[],Boxed-> False,ViewPoint->30#]&/@Reverse/@IdentityMatrix[3]],ImageSize->500]

Angled

Show[Graphics3D[CorkPlug[]],Boxed->False]

LiveGraphics3D

<<Utilities`LiveGraphics3D`

WriteLiveForm["CorkPlug.m",Graphics3D[CorkPlug[25],Boxed->False]]//Timing

Entity Image

Show[SolidData[ent,"Image"],Method->{"ShrinkWrap"->True},ImageSize->Small]

Entity ImplicitRegion

Show[DiscretizeRegion@SolidData[ent,"ImplicitRegion"][1,2],Method->{"ShrinkWrap"->True},ImageSize->Small]

Entity ParametricRegion

Show[DiscretizeRegion@SolidData[ent,"ParametricRegion"][1,2],Method->{"ShrinkWrap"->True},ImageSize->Small]

Entity Region

Show[DiscretizeRegion@SolidData[ent,"Region"][1,2],Method->{"ShrinkWrap"->True},ImageSize->Small]

RegionPlot3D

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

DiscretizeRegion

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

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

Regions

SolidData[ent,"ImplicitRegion"]

SolidData[ent,"ParametricRegion"]

SolidData[ent,"Region"]

Properties

Boundary

SolidData[ent,"BoundarySurface"]

SolidData[ent,"Boundary"]

Show[DiscretizeRegion[SolidData[ent,"Boundary"][1,.5,1]],ImageSize->Small,Method->{"ShrinkWrap"->True}]

Show[BoundaryDiscretizeRegion[SolidData[ent,"Region"][1,.5,1]],ImageSize->Small,Method->{"ShrinkWrap"->True}]

Centroid

SolidData[ent,"Centroid"]

Integrate

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

RegionCentroid

Assuming[assum,FullSimplify@RegionCentroid[reg]]//Timing

Assuming[assum,FullSimplify@RegionCentroid[implreg]]//Timing

Assuming[assum,FullSimplify@RegionCentroid[SolidData[ent,"ImplicitRegion"][a,h]]]//Timing

Assuming[assum,FullSimplify@RegionCentroid[SolidData[ent,"ParametricRegion"][a,h]]]//Timing

Assuming[assum,FullSimplify@RegionCentroid[SolidData[ent,"Region"][a,h]]]//Timing

GeneralizedDiameter

Entity["Solid","CorkPlug"]["GeneralizedDiameter"]

Solid

Entity["Solid","CorkPlug"]["Region"]

assum=Entity["Solid","CorkPlug"]["VariableConstraints"][a,h]

With[{
reg=Entity["Solid","CorkPlug"]["Region"][a,h],
assum=Entity["Solid","CorkPlug"]["VariableConstraints"][a,h]
},
Assuming[assum,Maximize[
{
SquaredEuclideanDistance[{x1,y1,z1},{x2,y2,z2}],
{x1,y1,z1}∈reg&&{x2,y2,z2}∈reg
},
{x1,y1,z1,x2,y2,z2}]]]//Timing

Graphics3D[{{Opacity[.5],SolidData["Trihyperboloid","Graphics3D"][[1]]},PointSize[Large],Point[{{x1,y1,z1},{x2,y2,z2}}/.soln]}]

Surface

With[{\[FormalA]=1,\[FormalH]=1},RegionIntersection[Cylinder[{{0,0,0},{0,0,\[FormalH]}},\[FormalA]],ImplicitRegion[-2 (\[FormalA]^2) \[FormalH]+2 \[FormalA] \[FormalH] \[FormalY]+2 (\[FormalA]^2) \[FormalZ]≤0&&-2 (\[FormalA]^2) \[FormalH]-2 \[FormalA] \[FormalH] \[FormalY]+2 (\[FormalA]^2) \[FormalZ]≤0,{\[FormalX],\[FormalY],\[FormalZ]}]]]

With[{p1=Array[p,3],p2=Array[q,3]},Maximize[
{
SquaredEuclideanDistance[p1,p2],
p1∈reg&&p2∈reg
},
Join[p1,p2]]]//Timing

InertiaTensor

(M/v)Integrate[InertiaTensor[{x,y,z}]Boole[(x^2)+(y^2)<(a^2)&&0<z<h&&-2 (a^2) h+2 a h y+2 (a^2) z<0&&-2 (a^2) h-2 a h y+2 (a^2) z<0],
{x,-∞,∞},{y,-∞,∞},{z,-∞,∞},Assumptions->h>0&&a>0]//FullSimplify

%20/.M->1

MeanCylindricalRadius

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(Sqrt[(x^2)+(y^2)]),{x,y,z}∈SolidData[ent,"Region"][a,h]]]]//Timing

Integrate Cartesian

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

Integrate Cylindrical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[r r Boole[ineq/.Thread[{x,y,z}->{r Cos[θ],r Sin[θ],z}]],{θ,0,2π},{r,0,∞},{z,-∞,∞}]]]//Timing

MeanSphericalRadius

$Version

Assuming[assum,Integrate[(Sqrt[(x^2)+(y^2)+(z^2)]),{x,y,z}∈reg]]//Timing

Assuming[assum,Integrate[(Sqrt[(x^2)+(y^2)+(z^2)]),{x,y,z}∈implreg]]//Timing

Older

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(Sqrt[(x^2)+(y^2)+(z^2)]),{x,y,z}∈reg]]]//Timing

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(Sqrt[(x^2)+(y^2)+(z^2)]),{x,y,z}∈reg,GenerateConditions->True]]]//Timing

Integrate Cartesian

$Version

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

Assuming[assum,Integrate[(Sqrt[(x^2)+(y^2)+(z^2)]),{x,y,z}∈reg]]//Timing

Assuming[assum,Integrate[(Sqrt[(x^2)+(y^2)+(z^2)]),{x,y,z}∈implreg]]//Timing

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

Integrate Cylindrical

$Version

Assuming[assum,Integrate[(Sqrt[(r^2)+(z^2)]) r Boole[ineq/.Thread[{x,y,z}->{r Cos[θ],r Sin[θ],z}]],{θ,0,2π},{r,0,∞},{z,-∞,∞}]]//Timing

XXX Does this crsh? XXX

Older

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(Sqrt[(r^2)+(z^2)]) r Boole[ineq/.Thread[{x,y,z}->{r Cos[θ],r Sin[θ],z}]],{θ,0,2π},{r,0,∞},{z,-∞,∞}]]]//Timing

SolidData["CorkPlug","Inequalities"]

...crash bug(296138)...

Integrate[(Sqrt[(r^2)+(z^2)]) r Boole[Simplify@SolidData["CorkPlug","Inequalities"][a,h][r Cos[θ],r Sin[θ],z]],{θ,0,2π},{r,0,∞},{z,-∞,∞}]

MeanSquareCylindricalRadius

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(x^2)+(y^2),{x,y,z}∈SolidData[ent,"Region"][a,h]]]]//Timing

Integrate Cartesian

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

Integrate Cylindrical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(r^2) r Boole[ineq/.Thread[{x,y,z}->{r Cos[θ],r Sin[θ],z}]],{θ,0,2π},{r,0,∞},{z,-∞,∞}]]]//Timing

MeanSquareSphericalRadius

Assuming[assum,FullSimplify[(vol^(-1))Integrate[(x^2)+(y^2)+(z^2),{x,y,z}∈SolidData[ent,"Region"][a,h]]]]//Timing

Integrate Cartesian

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

Integrate Cylindrical

Assuming[assum,FullSimplify[(vol^(-1))Integrate[((r^2)+(z^2)) r Boole[ineq/.Thread[{x,y,z}->{r Cos[θ],r Sin[θ],z}]],{θ,0,2π},{r,0,∞},{z,-∞,∞}]]]//Timing

Volume

SolidData[ent,"Volume"]

Integrate

Assuming[assum,Integrate[Boole[ineq],{x,-∞,∞},{y,-∞,∞},{z,-∞,∞}]]

RegionMeasure

Assuming[assum,FullSimplify@RegionMeasure[reg]]//Timing

Assuming[assum,FullSimplify@RegionMeasure[implreg]]//Timing

Assuming[assum,FullSimplify@RegionMeasure[SolidData[ent,"ImplicitRegion"][a,h]]]//Timing

Assuming[assum,FullSimplify@RegionMeasure[SolidData[ent,"ParametricRegion"][a,h]]]//Timing

Assuming[assum,FullSimplify@RegionMeasure[SolidData[ent,"Region"][a,h]]]//Timing

Volume

Assuming[assum,Simplify@Volume[reg]]//Timing

Assuming[assum,Simplify@Volume[implreg]]//Timing

Assuming[assum,FullSimplify@Volume[SolidData[ent,"ImplicitRegion"][a,h]]]//Timing

Assuming[assum,FullSimplify@Volume[SolidData[ent,"ParametricRegion"][a,h]]]//Timing

Assuming[assum,FullSimplify@Volume[SolidData[ent,"Region"][a,h]]]//Timing