{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![satacad](./images/satacadlogo.gif)\n",
"TOC: [1](./mm1.ipynb) [2](./mm2.ipynb) [4](./mm4.ipynb) [5](./mm5.ipynb) [6](./mm6.ipynb)\n",
"\n",
"# A & B MODULES\n",
"\n",
"![A & B modules](./images/abmod.gif )\n",
"\n",
"![A & B modules](./images/a_b_modules.gif )\n",
"\n",
"# T & E MODULES\n",
"\n",
"![T & E modules](./images/t-mod-from-rhombic-triac.gif)\n",
"\n",
"# S MODULE\n",
"\n",
""
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"| SHAPE | VOLUME |\n",
"---------------------------------------------\n",
"| A module | 0.04167 |\n",
"| B module | 0.04167 |\n",
"| T module | 0.04167 |\n",
"| E module | 0.04173 |\n",
"| S module | 0.04508 |\n",
"| tetrahedron | 1.00000 |\n",
"| cube | 3.00000 |\n",
"| octahedron | 4.00000 |\n",
"| rhombic dodecahedron | 6.00000 |\n"
]
}
],
"source": [
"# build a Python dictionary of volumes\n",
"from math import sqrt\n",
"\n",
"φ = (1 + sqrt(5))/2\n",
"\n",
"volumes = dict(((\"tetrahedron\", 1), \n",
" (\"cube\", 3), \n",
" (\"octahedron\", 4), \n",
" (\"rhombic dodecahedron\", 6)))\n",
"\n",
"modules = dict(((\"A module\", 1/24), \n",
" (\"B module\", 1/24), \n",
" (\"T module\", 1/24), \n",
" (\"E module\", (sqrt(2)/8) * (φ ** -3)),\n",
" (\"S module\", (φ **-5)/2)))\n",
"\n",
"volumes.update(modules)\n",
"template = \"| {s:30} | {v:7} |\"\n",
"print(template.format(s = \"SHAPE\", v = \"VOLUME\"))\n",
"print(\"-\" * 45)\n",
"\n",
"template = \"| {s:30} | {v:6.5f} |\"\n",
"\n",
"# sorted by volume, not shape name\n",
"for shape, volume in sorted(tuple(volumes.items()), key=lambda x: x[1]):\n",
" print(template.format(s=shape, v=volume))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}