Overlapping Hyperspheres

54 views
Skip to first unread message

Joshua Searle

unread,
Oct 28, 2024, 7:01:08 PM10/28/24
to SeqFan
Take two unit spheres a unit distance apart. What fraction of their surfaces lie within the other?

in 0D its 1 (the points overlap)
in 1D its 1/2
in 2D its 1/3
in 3D its 1/4
so you guessed it:
in 4D its 1/3 - sqrt3/(4*pi) = 0.1955011...
Ah...

There is a wiki page that has a general hyperspherical cap formula: https://en.wikipedia.org/wiki/Spherical_cap#Hyperspherical_cap
Which simplifies a bit for this use case.

The general formula for our problem in n dimensions is 1/2 * I_{3/4}(1/2 * (n-1), 1/2), where I_{x}(a, b) is the regularised incomplete beta function. It turns out that when b = 1/2 the results are nice enough to compute by hand, which I did to 8 dimensions purely for fun.

The algorithm can be found here: DiDonato, A. R., and M. P. Jarnagin. "The efficient calculation of the incomplete beta-function ratio for half-integer values of the parameters 𝑎, 𝑏." Mathematics of Computation 21.100 (1967): 652-662.

The 4D case is not in the OEIS, so is probably a good addition. But to how many dimensions should I make an entry for?

Joshua Searle

Arthur O'Dwyer

unread,
Oct 28, 2024, 8:02:38 PM10/28/24
to seq...@googlegroups.com
On Mon, Oct 28, 2024 at 7:01 PM Joshua Searle <jprs...@gmail.com> wrote:
Take two unit spheres a unit distance apart. What fraction of their surfaces lie within the other?

There are two ways to interpret "surface" there, I guess.
You might be talking about
  a(n) = Fraction of the n-dimensional hypersurface of an n-sphere located within the hypervolume of an n-ball at distance 1
  a(0...) = .500, .333+, .250, .196-, .156+, .126+, .103+, .085+, ...
or
  a(n) = Fraction of the n+1-dimensional hypervolume of an n-ball located within the hypervolume of a second n-ball at distance 1
  a(0...) = .500, .391+, .313-, .253+, .207-, .170+, .141+, .117+, ...
In both cases, a(0) would be talking about a 0-sphere (i.e. a pair of points) and a 0-ball (i.e. a line segment) in a 1-dimensional universe.

The 4D case is not in the OEIS, so is probably a good addition. But to how many dimensions should I make an entry for?

These both look like sequences of real numbers, not sequences of integers. How do you propose to make integers out of them?

–Arthur

M F Hasler

unread,
Oct 28, 2024, 8:25:06 PM10/28/24
to SeqFan
On Monday, October 28, 2024 at 8:02:38 PM UTC-4 Arthur O'Dwyer wrote:
On Mon, Oct 28, 2024 at 7:01 PM Joshua Searle <jprs...@gmail.com> wrote:
Take two unit spheres a unit distance apart. What fraction of their surfaces lie within the other?
There are two ways to interpret "surface" there, I guess.
You might be talking about
  a(n) = Fraction of the n-dimensional hypersurface of an n-sphere located within the hypervolume of an n-ball at distance 1

I think the natural generalization of the n=3 dimensional case, 
where we consider the area of the unit 2-sphere S2 = { (x,y,z) | x² + y² + z² = 1 }
within the unit 3-ball B = { (x,y,z) |  x² + y² + z² <= 1 }

is to consider, in n dimensions, the unit (n-1)-sphere S^{n-1} = { x in R^n : |x|=1 }  
within the unit n-ball B = { x in R^n : | x-(1,0,...) | < 1 } (or its closure).

The 4D case is not in the OEIS, so is probably a good addition. But to how many dimensions should I make an entry for?

These both look like sequences of real numbers, not sequences of integers. How do you propose to make integers out of them?

As continued fraction, of course! 
Did you really think he'd consider the "arbitrary" base-10 expansion?
;-)

- Maximilian

M F Hasler

unread,
Oct 28, 2024, 9:47:43 PM10/28/24
to seq...@googlegroups.com
On Mon, Oct 28, 2024 at 7:01 PM Joshua Searle <jprs...@gmail.com> wrote:
in 2D its 1/3
in 3D its 1/4
so you guessed it:
in 4D its 1/3 - sqrt3/(4*pi) = 0.1955011...

in n dimensions is 1/2 * I_{3/4}(1/2 * (n-1), 1/2), where I_{x}(a, b) is the regularised incomplete beta function. 
results are nice enough to compute by hand, which I did to 8 dimensions purely for fun.

Did you get the same as sympy:

>>> import sympy as sp ; l = sp.S.One
>>> {n: sp.betainc_regularized((n-l)/2, l/2, 0, l*3/4).rewrite(sp.hyper).gammasimp().simplify().expand()/2
for n in range(2,13)}

{2: 1/3, 3: 1/4, 4: -sqrt(3)/(4*pi) + 1/3,
 5: 5/32, 6: -3*sqrt(3)/(8*pi) + 1/3,
 7: 53/512, 8: -9*sqrt(3)/(20*pi) + 1/3, 
 9: 289/4096, 10: -279*sqrt(3)/(560*pi) + 1/3,
 11: 6413/131072, 12: -297*sqrt(3)/(560*pi) + 1/3}

If sympy didn't err, it seems that 
for odd dimensions we have a rational fraction with denominator a power of 2,
and for even dimensions : 1/3 - (fraction)*sqrt(3)/pi
(Note the almost identical fractions for n=10 and 12,
similar to 13² vs 14² ... is base 10 not that arbitrary?)
 
- Maximilian

Joshua Searle

unread,
Oct 29, 2024, 6:21:11 PM10/29/24
to SeqFan
I was intending to add it as a base 10 decimal expansion, yeah. I'd add in the comments more general details, but I was wondering whether I should do an entry for 5D and so on and if so, to what point? I *could* also do a continued fraction representation, is it worth doing?

Those results look right to me! I did the calculations a year ago and have recently reorganised my room so I'm not entirely sure where my notepad that had the calculations is but the numbers look right as does the pattern.

The results for 5 and 7 are also similar, and 9 is (17/64)^2. All highly likely to be nothing significant!
I have in recent years become fond of base 6 :)

Joshua

Ruud H.G. van Tol

unread,
Oct 29, 2024, 7:00:37 PM10/29/24
to seq...@googlegroups.com

On 2024-10-29 23:21, Joshua Searle wrote:
> [...] I have in recent years become fond of base 6 :)

Next: base 30. Sure, then 210.

-- Ruud

Where integers seem only the pawns, keep looking.
Quantum is all about how integers ride the waves.

Neil Sloane

unread,
Oct 29, 2024, 7:24:32 PM10/29/24
to SeqFan

> Where integers seem only the pawns, keep looking.
Quantum is all about how integers ride the waves

Did you mean "prawns"?

Ruud H.G. van Tol

unread,
Oct 29, 2024, 7:36:14 PM10/29/24
to seq...@googlegroups.com

On 2024-10-30 00:24, Neil Sloane wrote:
> > Where integers seem only the pawns, keep looking.
> Quantum is all about how integers ride the waves.
>
> Did you mean "prawns"?

They immediately became part of the view.
See them jump!

-- Ruud

M F Hasler

unread,
Oct 29, 2024, 8:45:25 PM10/29/24
to SeqFan
On Tuesday, October 29, 2024 at 6:21:11 PM UTC-4 jprs...@gmail.com wrote:
I was intending to add it as a base 10 decimal expansion, yeah.

I think it's OK to add the value for d=4 (as decimal expansion but consider also cont.frac.), 
I thought the "basis" element sqrt(3)/pi might also be added, but looking it up
we find A343235 = sqrt(3)/pi - 0.5
so one might even add the other values (for even d) just as comment in that sequence from 2021
(which is motivated by a similar geometric consideration concerning spheres).

Looking up the cont.frac. of sqrt(3)/pi we find A132116.

I'd add in the comments more general details, but I was wondering whether I should do an entry for 5D and so on and if so, to what point?

For d=5, the value 5/32 = 0.15625 would correspond to 
the sequence (1,5,6,2,5). I don't think that's useful.
There are already 4 pages of matches for this search,
people won't even find the new entry ...
 
I *could* also do a continued fraction representation, is it worth doing?

I think for the n=4 value it might be worth while, then please XREF also the cont.frac. of sqrt(3)/pi (see above).
FWIW, I get  contfrac( 1/3 - sqrt(3)/pi/4 ) =
[0; 5, 8, 1, 2, 4, 4, 1, 1, 2, 5, 4, 1, 6, 13, 37, 20, 2, 1, 3, 1, 37, 1, 5, 1, 1, 4, 3, 1, 2, 1, 1, 5, 2, 4, 10, 1, 3, 15, 3, 6, 2, 2, 7, 1, 1, 6, 4, 2, 2, 6, 1, 1100, 3, 13, 1, 2, 1, 5, 348, 1, 2, 1, 6, 1, 25, 1, 1, 1, 18, 2, 10, 1, 56, 1, 1, 1, 1, 2, 12, 1, 20, 10, 1, 2, 3, 5, 1, 54, 2, 1, 43, 1, 1, 1, 1, 1, 17, 36, ...]

>>> from sympy import *
>>> {n: betainc_regularized(S(n-1)/2, S(1)/2, 0, S(3)/4).rewrite(hyper).gammasimp().simplify().expand()/2
for n in range(2,13)}

{2: 1/3, 3: 1/4, 4: -sqrt(3)/(4*pi) + 1/3,
 5: 5/32, 6: -3*sqrt(3)/(8*pi) + 1/3,
 7: 53/512, 8: -9*sqrt(3)/(20*pi) + 1/3, 
 9: 289/4096, 10: -279*sqrt(3)/(560*pi) + 1/3,
 11: 6413/131072, 12: -297*sqrt(3)/(560*pi) + 1/3}
 
Those results look right to me!

Thanks for the confirmation!
 
I have in recent years become fond of base 6 :)

Hm. I'm not sure base-6 expansions are useful, mainly because no-one will search for them,
otherwise it's obviously not much worse than base 10
(except that 6^9 ~ 10^7 means that you'll need about 30% more digits on the average).
 
BTW, I read that the 6-legged ants have probably more total biomass than all birds and mammals combined,
but the 10-legged crustaceans like prawns but esp. their small cousins krill, might outnumber and outweigh them!

- Maximilian

PS: Just to confirm that in an earlier post I indeed (and quite obviously) forgot to displace by one unit the 3-dimensional unit ball or corresponding unit 2-sphere, when trying to clarify what intersection/part of the surface we consider. (It was correct for the n-dim. variant.)

Joshua Searle

unread,
Oct 30, 2024, 4:51:26 PM10/30/24
to SeqFan
I'm still getting to grips with using these groups, is it best practice in general to use reply all here? Does just reply get archived and added to the chain and so on.

On Wednesday 30 October 2024 at 00:45:25 UTC M F Hasler wrote:
For d=5, the value 5/32 = 0.15625 would correspond to 
the sequence (1,5,6,2,5). I don't think that's useful.
There are already 4 pages of matches for this search,
people won't even find the new entry ...
 
I didn't think about that! I'll only do the 4D one in that case as well as its continued fraction because why not. Will do the appropriates xrefs.

Hm. I'm not sure base-6 expansions are useful, mainly because no-one will search for them,
otherwise it's obviously not much worse than base 10
(except that 6^9 ~ 10^7 means that you'll need about 30% more digits on the average).

I wasn't intending to add base 6 expansions to the OEIS haha, I meant in a more general (and infinitely less practical) sense of replacing our current base 10 system :) Yes the strings are longer, but the multiplication grid is 1/3 the size and has simple expansions for thirds, fifths and sevenths among a number of other benefits!

Josh

Joshua Searle

unread,
Oct 30, 2024, 7:12:47 PM10/30/24
to SeqFan
Submitted as:
Decimal expansion: A377522
Continued Fraction: A377523

Josh.

Reply all
Reply to author
Forward
0 new messages