Random_CCP_Tet_Vols


Random IVM Tetrahedron Volumes

According to a proof by Dr. Robert Gray, at one time archived on a Synergetics listserv, any tetrahedron of IVM vertexes (assuming non-coplanar) will have a whole number volume.

In this Notebook, we randomly generate IVM tetrahedrons and compute their volumes. Within the error of floating point, we demonstrate this result.


In [1]:
from tetravolume import Qvector

In [2]:
from itertools import permutations

In [3]:
combos = set()
for combo in permutations((0,1,1,2)):
    combos.add(combo)
combos = list(combos)
combos


Out[3]:
[(0, 1, 1, 2),
 (1, 2, 0, 1),
 (0, 2, 1, 1),
 (0, 1, 2, 1),
 (2, 1, 0, 1),
 (1, 1, 2, 0),
 (1, 2, 1, 0),
 (2, 1, 1, 0),
 (1, 0, 2, 1),
 (2, 0, 1, 1),
 (1, 0, 1, 2),
 (1, 1, 0, 2)]

One frequency:


In [4]:
import random

def any_ball():
    # random coefficients for arbitrary choice of vectors...
    coeffs = [random.randint(0, 300) for _ in range(12)]
    vectors = ([coeffs[i] * Qvector(combos[i]) for i in range(12)])
    vector_sum = Qvector((0,0,0,0))
    for v in vectors:
        vector_sum = vector_sum + v
    return vector_sum

any_ball()


Out[4]:
ivm_vector(a=365, b=159, c=336, d=0)

In [5]:
A,B,C,D = any_ball(), any_ball(), any_ball(), any_ball()

In [6]:
lengths = [("AB", (A-B).length()),
           ("AC", (A-C).length()),
           ("AD", (A-D).length()),
           ("BC", (B-C).length()),
           ("CD", (C-D).length()),
           ("DB", (D-B).length())]

In [7]:
lengths


Out[7]:
[('AB', 373.0321701944753),
 ('AC', 333.39616074574104),
 ('AD', 476.14808620848197),
 ('BC', 534.9635501601955),
 ('CD', 544.9155897935019),
 ('DB', 280.3194606159194)]

In [8]:
from tetravolume import Tetrahedron

In [9]:
t = Tetrahedron(*[lengths[i][1] for i in range(6)])

In [10]:
t.ivm_volume()


Out[10]:
44190451.00000004

In [11]:
def demo():
    A,B,C,D = any_ball(), any_ball(), any_ball(), any_ball()
    lengths = [("AB", (A-B).length()),
           ("AC", (A-C).length()),
           ("AD", (A-D).length()),
           ("BC", (B-C).length()),
           ("CD", (C-D).length()),
           ("DB", (D-B).length())]
    t = Tetrahedron(*[lengths[i][1] for i in range(6)])
    return t.ivm_volume()

demo()


Out[11]:
14170140.999999965

In [12]:
t.xyz_volume()


Out[12]:
41663156.754389174

In [13]:
from IPython.display import YouTubeVideo
YouTubeVideo("v8vjw3gCBgs") # https://youtu.be/v8vjw3gCBgs


Out[13]: