# Volume of n-dimensional solid w/ n-1 dimensional simplex as a base

Background

On an old MathForm discussion site I came across a very interesting method, which can find the center of mass of an n-dimensional solid, with an n-1 dimensional unit simplex as a base.

To ground this problem a 3D version of such a solid looks like the following:

Where the base is just a triangle with each side = 1 and the "vertical" sides stand orthogonal to the base.

In Mathematica code the method as presented looks like this:

h = {3, 4, 2};  (* heights at right angles to the base simplex *)
n = Length[h];

A = Transpose[Prepend[#, 03]&/@CholeskyDecomposition[(IdentityMatrix[n - 1] + 1)/2]];

((h/Total[h] + 1)/(1 + n)) . A

For some further insight into this, the matrix "A" used in the dot product calculation looks like this:

One of the contributors to the old site described this approach as, "finding moments e.g. averaging a coordinate over the object (which is what you do, in effect, to find the center of mass)."

The guy who came up with this appears to have found a formulation that does exactly that, and avoiding integration. It has a couple of distinct advantages over other methods:

• being very fast to calculate (at least in Mathematica) and
• it can handle any number of dimensions.

Questions

I need a similar fast method to calculate the volume of precisely these kinds of n-dimensional solids.

The approach to finding the center of mass seems promising, but I'm not familiar enough with the ideas behind it to work it all out by myself. I keep taking the pieces of this approach apart trying to understand it more clearly, but can't think of a way through it.

Breaking down the problem into more manageable parts might help. Wikipedia shows a formula to calculate the volume of a regular n dimensional simplex with unit side length as:

This leaves figuring out how to calculate the orthogonal "cap".

The Cholesky decomposition approach does seem promising. I wondered if anyone had some insight into how to apply this (or an equally speedy) approach to calculating the volumes of such solids?

Some discussion around the original MathForum question suggested that one could calculate the volume of the kinds of solids described above by taking the hyperarea of the base and multiplying it by the average of the heights.

Wolfram Alpha provides a formula for calculating the "hyper-surface area" of a simplex:

As I only need this for a unit simplex (all sides = 1), I think this simplifies to:

Symbolically, in Mathematica code, for n=3 with a base simplex of n-1 dimensions it looks like this:

hyperarea[n_] := Sqrt[(2^(1 - n) *n)] *(n + 1) * 1^(n - 1) / (n-1)!

heights = {h1, h2, h3};
hyperarea[n]* Mean@heights

Plug in some simple values for the heights:

heights = {1, 2, 3};
n = Length[heights];
N[hyperarea[n]* Mean@heights]

3.4641

BUT, this does not seem to work correctly.

Take a simple example of this kind of solid, a prism with equilateral triangle for the base and top and all edges = 1. Its volume should equal:

(1^2) * Sqrt[3]/4 * 1 = 0.433013

But when I use the hyperarea approach with heights {1, 1, 1}, I get 1.73205.

Any thoughts and guidance on what I've missed appreciated.

Apologies for all the edits.

• An approach which would be more complicated than this “heights only” thing in higher dimension, but still easier than brute force integration, would be a generalization of the shoelace formula to arbitrary dimensions, as used e.g. here. A CAS might help you obtain a heights-only formula from this, but I don't know how easy or not this formula would be.
– MvG
Jul 3, 2013 at 14:45
• @MvG -- I've also come across another idea to do this which looks simpler and fast but I haven't quite got it to work. The idea presented was to calculate the hyperarea of the base (a unit simplex) and multiply it by average of the heights. Not certain if I should add this info to this question as it would change it character significantly. I just posted a question about whether to do this on Meta. Thoughts? Jul 3, 2013 at 14:56
• I've reached the opinion that average heights should work as well. Haven't found the time to work out a proof, though. I think you should edit the question in any case. Either include the new info, possibly using headings to separate different ideas. Or explicitely ask for an adaptation of the idea you presented, excluding other approaches. The latter will yield less answers and have less practical value, I guess, so I'd do the former. By the way, here is the meta post.
– MvG
Jul 3, 2013 at 15:08
• You're just using the wrong formula for the area. The one you're using gives you the perimeter of a triangle and the surface area of a tetrahedron. You should be multiplying the hypervolume of the base with the mean of the heights.
– user856
Jul 3, 2013 at 18:36
• @RahulNarain -- We had the same idea at the same time. See my answer below, posted with seconds of your comment. Many thanks for confirming that I've finally gotten on the right track ;-) Jul 3, 2013 at 18:38

I struggled with this one, but it finally became clear. I hope this answer helps someone else along the way.

The comment around the original MathForum question that suggested that one could calculate the volume of the kinds of solids described above by taking the hyperarea of the base and multiplying it by the average of the heights, while technically on the mark, its wording sent me down the wrong road.

To find the volume of these kinds of solids one needs to multiply the volume formula for a regular simplex (also shown in the original post):

times the average of the heights of the cap.

Calculating a solid with 3 heights to the cap will need a 2 dimensional regular simplex as a base (an equilateral triangle). In this case the formula for the volume of a regular simplex will give the triangle's area, hence the confusion about hyperarea.

When calculating for heights of n dimensions, the base simplex will have n-1 dimensions.

So, a little Mathematica function will do the trick:

volSimplexWithHyperCap[heights_List] := Module[{n, simplexVolume},
n = Length[heights] - 1;
simplexVolume = Sqrt[n + 1]/(n! * Sqrt[2^(n)]);
N[simplexVolume * Mean[heights]]]

volSimplexWithHyperCap[3, {1, 1, 1}]

0.433013

This corresponds correctly to the prism volume in the question. It also, readily extends to higher dimensions:

volSimplexWithHyperCap[{1, 3, 2, 3, 5}]
0.0652186

This has the advantage over integration of being relatively simple and very fast to calculate. Not a Cholesky decomposition solution like I imagined at first, but it looks serviceable.

Maybe @MvG will think of a proof.

Thanks to everyone for their patients with all the edits.