10
$\begingroup$

Bug introduced in 10.2 and fixed in 10.3

SphericalShell and CapsuleShape are new in 10.2


Mathematica 10.2 introduced some new geometric regions. Two of the new regions include SphericalShell and CapsuleShape. Mathematica seems to be having difficulty computing the surface area of both regions. For example both

Area @ RegionBoundary @ CapsuleShape[{{-1, 0, 0}, {1, 0, 0}}, 1]

and

Area @ RegionBoundary @ SphericalShell[{0, 0, 0}, {3, 4}]

computes indefinitely (I end up aborting the computation after about 10 minutes). I'm using Mathematica 10.2 on Windows, is this a bug or missing implementation?

$\endgroup$
1
  • 6
    $\begingroup$ I'd say missing implementation (in 10.2 it probably attempts a general symbolic CAD-based method). In fact the implementation for these has already been added in the development version. For a numerical approximation, DiscretizeRegion should work and give something in the ballpark of $8 \pi$ and $100 \pi$ respectively. $\endgroup$
    – ilian
    Commented Jul 19, 2015 at 7:19

2 Answers 2

5
$\begingroup$

Until this is fixed in a future version, here is a workaround for now:

Unprotect[RegionBoundary];
RegionBoundary /: Area @ RegionBoundary @ SphericalShell[c_, {ri_, r_}] :=
                  Area @ Sphere[c, r] + Area @ Sphere[c, ri];
RegionBoundary /: Area @ RegionBoundary @ CapsuleShape[{v1_, v2_}, r_] :=
                  2 π r (2 r + EuclideanDistance[v2, v1]);
Protect[RegionBoundary];

The idea is to add the definition to RegionBoundary instead of Area to avoid returning a wrong value if one applies Area directly to these 3D regions. So e.g. these

Area @ CapsuleShape[{{-1, 0, 0}, {1, 0, 0}}, 1];
Area @ SphericalShell[{0, 0, 0}, {3, 4}]

still correctly returns Infinity as they should; but with RegionBoundary we get:

Area @ RegionBoundary @ SphericalShell[{0, 0, 0}, {3, 4}]
Area @ RegionBoundary @ CapsuleShape[{{-1, 0, 0}, {1, 0, 0}}, 1]

$100\pi$

$8\pi$

as expected.

$\endgroup$
1
$\begingroup$

As recommended in comment by @ilian

acap = Area@
  RegionBoundary@DiscretizeRegion@CapsuleShape[{{-1, 0, 0}, {1, 0, 0}}, 1]

25.0897

Round[acap/Pi, 1/10]*Pi

8 Pi

ashell = Area@
  RegionBoundary@DiscretizeRegion@SphericalShell[{0, 0, 0}, {3, 4}]

313.472

Round[ashell/Pi]*Pi

100 Pi

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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