{ "cells": [ { "cell_type": "markdown", "id": "1e789bf7-cbdc-48f1-8fff-a8eb38ce2d1a", "metadata": {}, "source": [ "##### Algorithms and Data Structures (Winter - Spring 2022)\n", "\n", "\n", "* [Table of Contents](ADS_TOC.ipynb)\n", "* \"Open\n", "* [![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.org/github/4dsolutions/elite_school/blob/master/ADS_sandbox.ipynb)\n", "\n", "\n", "
\n", "\"Nested\n", "\n", "\n", "## Practice with pandas\n", "\n", "[pandas](https://pandas.pydata.org/), the Python Data Analysis Library, is an important resource. pandas will give you many ways to practice your brand of data science, whatever the walk of life.\n", "\n", "The pandas.DataFrame type lets you join pandas.Series type columns into a multi-column data table, complete with row and column names of your choice, both re-orderable.\n", "\n", "Once you have a DataFrame defined, adding new columns based on the old, getting summary statistics, applying functions, generating visualizations, is all within reach." ] }, { "cell_type": "code", "execution_count": 30, "id": "b6114f65-cb48-4e34-a3c4-bd10491c2022", "metadata": {}, "outputs": [], "source": [ "import math as clc" ] }, { "cell_type": "code", "execution_count": 2, "id": "ab279057-b37f-40c5-aae1-6b19b7d895bc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "clc.sin(clc.radians(90)) # remembering trig" ] }, { "cell_type": "code", "execution_count": 3, "id": "4d4c048b-bea2-4cc4-84b0-7a9e0d13a69a", "metadata": {}, "outputs": [], "source": [ "# and now for something completely different...\n", "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "aa7c6642-782f-4ded-82e0-3a24eae10ee8", "metadata": {}, "source": [ "Lets stack up a column of polyhedron names, using a kind of jargon or shorthand." ] }, { "cell_type": "code", "execution_count": 4, "id": "ad1864a7-4ac2-4e7d-a3c5-9bcd030b9ad3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['Tetra', 'Cubocta', 'Icosa', 'Cube', 'Octa', 'RT5', 'RT5+', 'RD',\n", " 'RT', 'PD', 'Icosa', 'Cubocta', 'SuperRT', 'Cube'], dtype='\"S\n", "\n", "24 S modules, 12 left and 12 right, wedge between Octa 4 and the Icosahedron inscribed inside it.\n", "\n", "\"Rhombic\n", "\n", "120 E modules, 120 left and 120 right, comprise the rhombic triacontahedron inside of which, and tangent to its 30 faces, is the unit radius ball." ] }, { "cell_type": "code", "execution_count": 6, "id": "17fd5511-6b21-4dad-9a2d-46ac24eadc22", "metadata": {}, "outputs": [], "source": [ "# geometric constants\n", "phi = (1 + clc.sqrt(5))/2\n", "\n", "# volumes of specific tetrahedral wedges\n", "Emod = clc.sqrt(2)/8 * 1/phi**3\n", "Emod3 = clc.sqrt(2)/8\n", "emod3 = Emod * (phi**-3)\n", "Smod = (phi**-5) / 2\n", "\n", "Sfactor = Smod/Emod\n", "\n", "S3 = clc.sqrt(9/8)\n", "\n", "# defined to have edges = 2R or 1D\n", "Icosa = 100 * Emod3 + 20 * Emod\n", "PentDodeca = 84 * Emod3 + 12 * Emod # 348 * Emod + 84 * emod3\n", "\n", "# volumes corresponding to our shapes\n", "volumes = np.array([1, 2.5, 2.5 * Sfactor**2, \n", " 3, 4, 5, 120 * Emod, 6, \n", " 7.5, PentDodeca, Icosa, 20, \n", " 20 * S3, 24], dtype=np.float)" ] }, { "cell_type": "code", "execution_count": 7, "id": "20092cbb-0059-4bf3-8467-99ea4849b7ec", "metadata": {}, "outputs": [], "source": [ "volumes_col = pd.Series(volumes, name=\"IVM Volume\") # turn np.array into a pd.Series" ] }, { "cell_type": "code", "execution_count": 8, "id": "2047be0f-d03a-459b-bc52-b77343b90e26", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 1.000000\n", "1 2.500000\n", "2 2.917961\n", "3 3.000000\n", "4 4.000000\n", "5 5.000000\n", "6 5.007758\n", "7 6.000000\n", "8 7.500000\n", "9 15.350018\n", "10 18.512296\n", "11 20.000000\n", "12 21.213203\n", "13 24.000000\n", "Name: IVM Volume, dtype: float64" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "volumes_col" ] }, { "cell_type": "code", "execution_count": 9, "id": "59b27db3-3eb9-41db-9589-2b81601aa27e", "metadata": {}, "outputs": [], "source": [ "vols_table = pd.DataFrame({\"Shape\": shapes_col, \"IVM Volume\":volumes_col})\n", "# vols_table.index = shapes_col # the shapes column is the index" ] }, { "cell_type": "markdown", "id": "b4b5e7fa-0bc3-4e14-9771-83ba519fa437", "metadata": {}, "source": [ "\"Concentric" ] }, { "cell_type": "code", "execution_count": 10, "id": "bf8c0e87-6c3b-4581-bb31-6cea1dc2213c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM Volume
0Tetra1.000000
1Cubocta2.500000
2Icosa2.917961
3Cube3.000000
4Octa4.000000
5RT55.000000
6RT5+5.007758
7RD6.000000
8RT7.500000
9PD15.350018
10Icosa18.512296
11Cubocta20.000000
12SuperRT21.213203
13Cube24.000000
\n", "
" ], "text/plain": [ " Shape IVM Volume\n", "0 Tetra 1.000000\n", "1 Cubocta 2.500000\n", "2 Icosa 2.917961\n", "3 Cube 3.000000\n", "4 Octa 4.000000\n", "5 RT5 5.000000\n", "6 RT5+ 5.007758\n", "7 RD 6.000000\n", "8 RT 7.500000\n", "9 PD 15.350018\n", "10 Icosa 18.512296\n", "11 Cubocta 20.000000\n", "12 SuperRT 21.213203\n", "13 Cube 24.000000" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vols_table" ] }, { "cell_type": "code", "execution_count": 11, "id": "1811085d-215b-4eae-8dd1-5edd51696084", "metadata": {}, "outputs": [], "source": [ "vols_table['XYZ Volume'] = vols_table['IVM Volume'] * 1/S3" ] }, { "cell_type": "code", "execution_count": 12, "id": "1804f934-9920-43ca-9cf3-26760d71c282", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM VolumeXYZ Volume
0Tetra1.0000000.942809
1Cubocta2.5000002.357023
2Icosa2.9179612.751080
3Cube3.0000002.828427
4Octa4.0000003.771236
5RT55.0000004.714045
6RT5+5.0077584.721360
7RD6.0000005.656854
8RT7.5000007.071068
9PD15.35001814.472136
10Icosa18.51229617.453560
11Cubocta20.00000018.856181
12SuperRT21.21320320.000000
13Cube24.00000022.627417
\n", "
" ], "text/plain": [ " Shape IVM Volume XYZ Volume\n", "0 Tetra 1.000000 0.942809\n", "1 Cubocta 2.500000 2.357023\n", "2 Icosa 2.917961 2.751080\n", "3 Cube 3.000000 2.828427\n", "4 Octa 4.000000 3.771236\n", "5 RT5 5.000000 4.714045\n", "6 RT5+ 5.007758 4.721360\n", "7 RD 6.000000 5.656854\n", "8 RT 7.500000 7.071068\n", "9 PD 15.350018 14.472136\n", "10 Icosa 18.512296 17.453560\n", "11 Cubocta 20.000000 18.856181\n", "12 SuperRT 21.213203 20.000000\n", "13 Cube 24.000000 22.627417" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vols_table" ] }, { "cell_type": "markdown", "id": "df0f0c9d-33d0-41ed-87df-b837bac930c0", "metadata": {}, "source": [ "Practice with `df.loc[rows, columns]`." ] }, { "cell_type": "code", "execution_count": 13, "id": "2657ed55-170e-4006-8c93-7689180652fa", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Shape SuperRT\n", "IVM Volume 21.213203\n", "XYZ Volume 20.0\n", "Name: 12, dtype: object" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vols_table.iloc[12] # entire row" ] }, { "cell_type": "code", "execution_count": 14, "id": "a2c0c8a5-fe0f-4271-b3a5-27597e28581b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Shape Tetra\n", "IVM Volume 1.0\n", "XYZ Volume 0.942809\n", "Name: 0, dtype: object" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vols_table.iloc[0] # entire row" ] }, { "cell_type": "markdown", "id": "71cbbce3-d633-4bcc-961c-69ffdcbb1c2a", "metadata": {}, "source": [ "`df.loc[df['col1'] == value]`" ] }, { "cell_type": "code", "execution_count": 15, "id": "dd54d71c-4e48-40f3-82f0-8987683a64cd", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM VolumeXYZ Volume
12SuperRT21.21320320.0
\n", "
" ], "text/plain": [ " Shape IVM Volume XYZ Volume\n", "12 SuperRT 21.213203 20.0" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vols_table.loc[vols_table['Shape'] == \"SuperRT\" ] # specific cell" ] }, { "cell_type": "markdown", "id": "592bc7ac-83fe-4bbd-ab9e-710464c8bfdb", "metadata": {}, "source": [ "Now lets add some constituent modules that may be used to assemble the above shapes." ] }, { "cell_type": "code", "execution_count": 16, "id": "409c5a28-292c-42e5-8f84-ecbcf511d358", "metadata": {}, "outputs": [], "source": [ "modules = np.array([\"A\",\"B\", \"T\", \"E\", \"S\"],\n", " dtype=np.str_) \n", "\n", "mods_col = pd.Series(modules, name=\"Shape\")\n", "\n", "mod_vols = np.array([1/24, 1/24, 1/24, Emod, (phi**-5) / 2], dtype=np.float)\n", "mod_vols_col = pd.Series(mod_vols, name=\"IVM Volume\")\n", "\n", "mods_table = pd.DataFrame({\"Shape\":mods_col, \"IVM Volume\":mod_vols_col})\n", "# mods_table.index = mods_col" ] }, { "cell_type": "code", "execution_count": 17, "id": "07046a0d-501b-49e6-a0c9-42b56bc7ba90", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM Volume
0A0.041667
1B0.041667
2T0.041667
3E0.041731
4S0.045085
\n", "
" ], "text/plain": [ " Shape IVM Volume\n", "0 A 0.041667\n", "1 B 0.041667\n", "2 T 0.041667\n", "3 E 0.041731\n", "4 S 0.045085" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mods_table" ] }, { "cell_type": "code", "execution_count": 18, "id": "1084d98c-1366-41ec-9d17-afa75b3118d5", "metadata": {}, "outputs": [], "source": [ "mods_table['XYZ Volume'] = mods_table['IVM Volume'] * 1/S3" ] }, { "cell_type": "markdown", "id": "53f8e231-99ff-419f-a81c-0dcd3ef02651", "metadata": {}, "source": [ "\"A" ] }, { "cell_type": "code", "execution_count": 19, "id": "03b6756a-006f-4fa5-8122-880fff6aa928", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM VolumeXYZ Volume
0A0.0416670.039284
1B0.0416670.039284
2T0.0416670.039284
3E0.0417310.039345
4S0.0450850.042507
\n", "
" ], "text/plain": [ " Shape IVM Volume XYZ Volume\n", "0 A 0.041667 0.039284\n", "1 B 0.041667 0.039284\n", "2 T 0.041667 0.039284\n", "3 E 0.041731 0.039345\n", "4 S 0.045085 0.042507" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mods_table" ] }, { "cell_type": "markdown", "id": "4f9a552a-72d2-4590-a8c7-e069192b2f4f", "metadata": {}, "source": [ "And now it's time to assemble the full table." ] }, { "cell_type": "code", "execution_count": 20, "id": "2271c1a2-aeba-4eee-98b7-87b4c286a688", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM VolumeXYZ Volume
0A0.0416670.039284
1B0.0416670.039284
2T0.0416670.039284
3E0.0417310.039345
4S0.0450850.042507
0Tetra1.0000000.942809
1Cubocta2.5000002.357023
2Icosa2.9179612.751080
3Cube3.0000002.828427
4Octa4.0000003.771236
5RT55.0000004.714045
6RT5+5.0077584.721360
7RD6.0000005.656854
8RT7.5000007.071068
9PD15.35001814.472136
10Icosa18.51229617.453560
11Cubocta20.00000018.856181
12SuperRT21.21320320.000000
13Cube24.00000022.627417
\n", "
" ], "text/plain": [ " Shape IVM Volume XYZ Volume\n", "0 A 0.041667 0.039284\n", "1 B 0.041667 0.039284\n", "2 T 0.041667 0.039284\n", "3 E 0.041731 0.039345\n", "4 S 0.045085 0.042507\n", "0 Tetra 1.000000 0.942809\n", "1 Cubocta 2.500000 2.357023\n", "2 Icosa 2.917961 2.751080\n", "3 Cube 3.000000 2.828427\n", "4 Octa 4.000000 3.771236\n", "5 RT5 5.000000 4.714045\n", "6 RT5+ 5.007758 4.721360\n", "7 RD 6.000000 5.656854\n", "8 RT 7.500000 7.071068\n", "9 PD 15.350018 14.472136\n", "10 Icosa 18.512296 17.453560\n", "11 Cubocta 20.000000 18.856181\n", "12 SuperRT 21.213203 20.000000\n", "13 Cube 24.000000 22.627417" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.concat([mods_table, vols_table])" ] }, { "cell_type": "code", "execution_count": 21, "id": "cc714313-6a54-44f6-8e31-7348c3b00908", "metadata": {}, "outputs": [], "source": [ "CH = pd.concat([mods_table, vols_table])" ] }, { "cell_type": "code", "execution_count": 22, "id": "f9ec788d-53be-43ed-9b90-f2d5eb535249", "metadata": {}, "outputs": [], "source": [ "CH = CH.reset_index(drop=True)" ] }, { "cell_type": "code", "execution_count": 23, "id": "d4fc2643-cd26-4974-9ba0-827eebed5855", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 19 entries, 0 to 18\n", "Data columns (total 3 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Shape 19 non-null object \n", " 1 IVM Volume 19 non-null float64\n", " 2 XYZ Volume 19 non-null float64\n", "dtypes: float64(2), object(1)\n", "memory usage: 584.0+ bytes\n" ] } ], "source": [ "CH.info()" ] }, { "cell_type": "code", "execution_count": 24, "id": "a9e565bc-dcc7-4e13-8fc8-8d887d2b11d5", "metadata": {}, "outputs": [], "source": [ "# df['new'] = pd.Series(dtype='int')\n", "CH['Comments'] = pd.Series(dtype='str_')" ] }, { "cell_type": "code", "execution_count": 25, "id": "91e34720-d10d-4dd8-957b-02a33a7a013f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM VolumeXYZ VolumeComments
0A0.0416670.039284NaN
1B0.0416670.039284NaN
2T0.0416670.039284NaN
3E0.0417310.039345NaN
4S0.0450850.042507NaN
5Tetra1.0000000.942809NaN
6Cubocta2.5000002.357023NaN
7Icosa2.9179612.751080NaN
8Cube3.0000002.828427NaN
9Octa4.0000003.771236NaN
10RT55.0000004.714045NaN
11RT5+5.0077584.721360NaN
12RD6.0000005.656854NaN
13RT7.5000007.071068NaN
14PD15.35001814.472136NaN
15Icosa18.51229617.453560NaN
16Cubocta20.00000018.856181NaN
17SuperRT21.21320320.000000NaN
18Cube24.00000022.627417NaN
\n", "
" ], "text/plain": [ " Shape IVM Volume XYZ Volume Comments\n", "0 A 0.041667 0.039284 NaN\n", "1 B 0.041667 0.039284 NaN\n", "2 T 0.041667 0.039284 NaN\n", "3 E 0.041731 0.039345 NaN\n", "4 S 0.045085 0.042507 NaN\n", "5 Tetra 1.000000 0.942809 NaN\n", "6 Cubocta 2.500000 2.357023 NaN\n", "7 Icosa 2.917961 2.751080 NaN\n", "8 Cube 3.000000 2.828427 NaN\n", "9 Octa 4.000000 3.771236 NaN\n", "10 RT5 5.000000 4.714045 NaN\n", "11 RT5+ 5.007758 4.721360 NaN\n", "12 RD 6.000000 5.656854 NaN\n", "13 RT 7.500000 7.071068 NaN\n", "14 PD 15.350018 14.472136 NaN\n", "15 Icosa 18.512296 17.453560 NaN\n", "16 Cubocta 20.000000 18.856181 NaN\n", "17 SuperRT 21.213203 20.000000 NaN\n", "18 Cube 24.000000 22.627417 NaN" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "CH" ] }, { "cell_type": "code", "execution_count": 28, "id": "b62eca1a-738b-462a-a5a4-3777affe378c", "metadata": {}, "outputs": [], "source": [ "CH.iloc[0, -1] = '24 make a Tetra'\n", "CH.iloc[1, -1] = 'AAB = BAA = Mite'\n", "CH.iloc[2, -1] = '1/120 RT5'\n", "CH.iloc[3, -1] = '1/120 RT5+'\n", "CH.iloc[4, -1] = '(φ**-5) / 2'\n", "CH.iloc[5, -1] = \"edges D, from 4 IVM balls\"\n", "CH.iloc[6, -1] = 'some faces flush with Octa 4'\n", "CH.iloc[7, -1] = 'some faces flush with Octa 4'\n", "CH.iloc[8, -1] = 'Duo-Tet, face diagonals = D'\n", "CH.iloc[9, -1] = 'Dual of Cube, edges D'\n", "CH.iloc[10, -1] = '120 T mods'\n", "CH.iloc[11, -1] = '120 E mods'\n", "CH.iloc[12, -1] = 'Rhombic Dodeca, long diagonals = D'\n", "CH.iloc[13, -1] = 'some vertexes shared with RD'\n", "CH.iloc[14, -1] = 'Pentagonal Dodeca, dual of Icosa'\n", "CH.iloc[15, -1] = 'edges D'\n", "CH.iloc[16, -1] = 'edges = D, 1F, 12-balls around nuclear ball'\n", "CH.iloc[17, -1] = 'icosa of edges D + dual PD'\n", "CH.iloc[18, -1] = 'face diagonals = 2D, 2F'" ] }, { "cell_type": "code", "execution_count": 29, "id": "1b7c5540-5cd5-4a2e-b5ce-e39bd306e8d4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ShapeIVM VolumeXYZ VolumeComments
0A0.0416670.03928424 make a Tetra
1B0.0416670.039284AAB = BAA = Mite
2T0.0416670.0392841/120 RT5
3E0.0417310.0393451/120 RT5+
4S0.0450850.042507(φ**-5) / 2
5Tetra1.0000000.942809edges D, from 4 IVM balls
6Cubocta2.5000002.357023some faces flush with Octa 4
7Icosa2.9179612.751080some faces flush with Octa 4
8Cube3.0000002.828427Duo-Tet, face diagonals = D
9Octa4.0000003.771236Dual of Cube, edges D
10RT55.0000004.714045120 T mods
11RT5+5.0077584.721360120 E mods
12RD6.0000005.656854Rhombic Dodeca, long diagonals = D
13RT7.5000007.071068some vertexes shared with RD
14PD15.35001814.472136Pentagonal Dodeca, dual of Icosa
15Icosa18.51229617.453560edges D
16Cubocta20.00000018.856181edges = D, 1F, 12-balls around nuclear ball
17SuperRT21.21320320.000000icosa of edges D + dual PD
18Cube24.00000022.627417face diagonals = 2D, 2F
\n", "
" ], "text/plain": [ " Shape IVM Volume XYZ Volume \\\n", "0 A 0.041667 0.039284 \n", "1 B 0.041667 0.039284 \n", "2 T 0.041667 0.039284 \n", "3 E 0.041731 0.039345 \n", "4 S 0.045085 0.042507 \n", "5 Tetra 1.000000 0.942809 \n", "6 Cubocta 2.500000 2.357023 \n", "7 Icosa 2.917961 2.751080 \n", "8 Cube 3.000000 2.828427 \n", "9 Octa 4.000000 3.771236 \n", "10 RT5 5.000000 4.714045 \n", "11 RT5+ 5.007758 4.721360 \n", "12 RD 6.000000 5.656854 \n", "13 RT 7.500000 7.071068 \n", "14 PD 15.350018 14.472136 \n", "15 Icosa 18.512296 17.453560 \n", "16 Cubocta 20.000000 18.856181 \n", "17 SuperRT 21.213203 20.000000 \n", "18 Cube 24.000000 22.627417 \n", "\n", " Comments \n", "0 24 make a Tetra \n", "1 AAB = BAA = Mite \n", "2 1/120 RT5 \n", "3 1/120 RT5+ \n", "4 (φ**-5) / 2 \n", "5 edges D, from 4 IVM balls \n", "6 some faces flush with Octa 4 \n", "7 some faces flush with Octa 4 \n", "8 Duo-Tet, face diagonals = D \n", "9 Dual of Cube, edges D \n", "10 120 T mods \n", "11 120 E mods \n", "12 Rhombic Dodeca, long diagonals = D \n", "13 some vertexes shared with RD \n", "14 Pentagonal Dodeca, dual of Icosa \n", "15 edges D \n", "16 edges = D, 1F, 12-balls around nuclear ball \n", "17 icosa of edges D + dual PD \n", "18 face diagonals = 2D, 2F " ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "CH" ] }, { "cell_type": "markdown", "id": "3b80d855-db7c-4a54-9df5-a0b22736a1ec", "metadata": {}, "source": [ "For further reading:\n", "\n", "* [Synergetics Constant](https://groups.io/g/synergeo/message/1078)\n", "* [Tetravolume Formulae](https://github.com/4dsolutions/School_of_Tomorrow/blob/master/VolumeTalk.ipynb)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }