MM @ Reed (Earlier Edition)
Martian Math is an introduction to some mathematics against the backdrop of science fiction stories.
These ETs (lets call them Martians) seem much more interested in 60 degree angles than we are. When they multiply two numbers, they consider the area to be a triangle.
Here is 6 x 2 = 12:
Here is what it looks like when they multiply three numbers together, 2 x 2 x 5 = 20.
Their volumes seem simpler than ours in a lot of ways.
# build a Python dictionary from this information, then loop over the items, printing a table
volumes = dict((("tetrahedron", 1), ("cube", 3), ("octahedron", 4), ("rhombic dodecahedron", 6)))
template = "| {s:30} | {v:6} |"
print(template.format(s = "SHAPE", v = "VOLUME"))
print("-" * 44)
for shape, volume in volumes.items():
print(template.format(s=shape, v=volume))
| SHAPE | VOLUME | -------------------------------------------- | tetrahedron | 1 | | cube | 3 | | octahedron | 4 | | rhombic dodecahedron | 6 |
import tetravolume as tv
import qrays as qv
unit_volume = tv.Tetrahedron(1,1,1,1,1,1)
print(unit_volume.ivm_volume())
print(unit_volume.xyz_volume())
1.0 0.9428090415820635
a = qv.Qvector((1,0,0,0))
b = qv.Qvector((0,1,0,0))
c = qv.Qvector((0,0,1,0))
d = qv.Qvector((0,0,0,1))
tet = tv.Tetrahedron((a-b).length(), (a-c).length(), (a-d).length(),
(b-c).length(), (c-d).length(), (d-b).length())
print(tet.ivm_volume())
print(tet.xyz_volume())
1.0 0.9428090415820635