#!/usr/bin/env python
# coding: utf-8
# ![satacad](./images/satacadlogo.gif)
# TOC: [1](./mm1.ipynb) [2](./mm2.ipynb) [4](./mm4.ipynb) [5](./mm5.ipynb) [6](./mm6.ipynb)
#
# # A & B MODULES
#
# ![A & B modules](./images/abmod.gif )
#
# ![A & B modules](./images/a_b_modules.gif )
#
# # T & E MODULES
#
# ![T & E modules](./images/t-mod-from-rhombic-triac.gif)
#
# # S MODULE
#
#
# In[1]:
# build a Python dictionary of volumes
from math import sqrt
φ = (1 + sqrt(5))/2
volumes = dict((("tetrahedron", 1),
("cube", 3),
("octahedron", 4),
("rhombic dodecahedron", 6)))
modules = dict((("A module", 1/24),
("B module", 1/24),
("T module", 1/24),
("E module", (sqrt(2)/8) * (φ ** -3)),
("S module", (φ **-5)/2)))
volumes.update(modules)
template = "| {s:30} | {v:7} |"
print(template.format(s = "SHAPE", v = "VOLUME"))
print("-" * 45)
template = "| {s:30} | {v:6.5f} |"
# sorted by volume, not shape name
for shape, volume in sorted(tuple(volumes.items()), key=lambda x: x[1]):
print(template.format(s=shape, v=volume))