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]:
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]:
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]:
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]:
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]:
In [12]:
t.xyz_volume()
Out[12]:
In [13]:
from IPython.display import YouTubeVideo
YouTubeVideo("v8vjw3gCBgs") # https://youtu.be/v8vjw3gCBgs
Out[13]: