# [R] volume of ellipsoid

David Winsemius dwinsemius at comcast.net
Fri Nov 15 17:15:52 CET 2013

```On Nov 15, 2013, at 8:16 AM, Michael Friendly wrote:

> On 11/14/2013 9:35 AM, yuanzhi wrote:
>> Hi, Carl Witthoft
>>
>> yes, it looks like a mathematical question. I will try based on your
>> suggestion to calculate the volume of the intersection. But I still
>> want to
>> know whether there are some functions in R which can calculate the
>> volume of
>> an ellipsoid(area for p=2, hypervolume for p>3) containing X, just
>> like the
>> "convhulln" function in "geometry" package which can calculate the
>> volume of
>> convex hull containing X.
>>
>
> See the Appendix A.2 in my paper on Elliptical Insights ...
> http://www.datavis.ca/papers/ellipses-STS402.pdf

Thank you so much for that reference, Michael, as well as the
programming supplements that you constructed and linked in that
encyclopedic review.

>
> for the properties of ellipsoids and calculation of (hyper)volumes
> based on a spectral decomposition.
>

Copying back the omitted text from the OP who probably is under the
misapprehension that we are all using Nabble:

>>> But the problem is how to calculate the volume of intersection
>>> between 2, 3 or more ellipsoids. Are there some functions which
>>> can calculate the volume of intersection between two region or
>>> functions which directly calculate the volume of a union of two
>>> region(the region here is ellipsoid). OR yo you have any good
>>> ideas solving this problem in R? Thank you all in advance!

> The intersection of general ellipsoids is mathematically extremely
> complex.  You can approximate it by acceptance sampling -- finding the
> proportion of random points in R^p in the bounding box of the
> ellipsoids which are contained in both.

So that reduces the problem to defining a function that returns TRUE
for a point when it is in the interior of an ellipse. So reading your
section on statistical ellipsoids, I think an intersection test for
n=2 could require that the squared Mahalanobis distance from the
centroids be less than the c_1^2 and c_2^2 values for the two
ellipsoids under consideration.

> --
> Michael Friendly     Email: friendly AT yorku DOT ca
--

David Winsemius, MD
Alameda, CA, USA

```