from math import sqrt as rt2
from decimal import Decimal, getcontext
context = getcontext()
context.prec = 50

one = Decimal(1)  # 28 digits of precision by default, more on tap
two = Decimal(2)
three = Decimal(3)
five = Decimal(5)
nine = Decimal(9)
eight = Decimal(8)
sqrt2 = two.sqrt()
sqrt5 = five.sqrt()
Ø = (one + sqrt5)/two
S3 = (nine/eight).sqrt()  # Got Synergetics?

"""
Explanation: Oregon Curriculum Network <br />
Discovering Math with Python
FOCUSING ON THE S FACTOR
$\phi$ DOODLES Using $\LaTeX$
<a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/37271936814/in/photolist-D17NrN-YMAqPs-YMAqhf-YeD8Xh-ZPBUSB-Y3ouSi-XhBkg1-WtCTD7-WtFwVg-VhXZoN-VFDUfa-UXW4tu-VakADe-TWeHGx-TVX4PF-UzeozQ-UtGD6C-TZAAJw-TH8XUh-TRFNEP-Sv4eHf-SZBzQK-SkVmHf-RVG9nU-RYjrxF-Gcea6D-QVaS2M-QtgU8h-QcgRgB-MG4f5j-LMZHu8-LySA48-KVPQgq-KyFu4d-JqMX3i-JrLuuS-HsbyEL-HsbzWo-Hsbwff-Dc4EtD-CM5VMh-DzQtqC-AmvTwh-uyTQjq-sDbPe3-rb6EdZ-qcA5rT-puPHA3-qapc5R-qafBJE" title="Eyeballing Code"><img src="https://farm5.staticflickr.com/4492/37271936814_18e7e72217.jpg" width="500" height="281" alt="Eyeballing Code"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
First, some identity checks (not proofs), using Decimal objects:
$\sqrt{2}-(\sqrt{2}(\phi^{-3}))= 2\sqrt{2}(\phi^{-2})$
$(\phi^{-2})+(\phi^{-3})+(\phi^{2}) = 1$
End of explanation
"""


(Ø**-2) + (Ø**-3) + ( Ø**-2)

sqrt2 - sqrt2 * Ø**-3

"""
Explanation: In showing off the Decimal type, I'm advertising high precision, but not "infinite precision".  Please be tolerant of our epsilons (tiny abberations).
End of explanation
"""


two * sqrt2 * (Ø**-2)

icosa = five * sqrt2 * Ø ** 2
icosa

ve = Decimal(20)

s_factor = ve / icosa

s_factor  # see?

"""
Explanation: JITTERBUG TRANSFORMATION
We call this the S Factor by the way.  VE:Icosa :: S:E is what to remember.  VE is the 12-around-1 nuclear sphere based agglomeration whereas Icosa is dervied from Jitterbugging, a mathematical transformation with a more technical name if you're a math snob (I can be).
<a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/8393394058/in/photolist-dMGkCE-5y2HNo" title="Jitterbug Transformation"><img src="https://farm9.staticflickr.com/8195/8393394058_b096cc1e20.jpg" width="500" height="375" alt="Jitterbug Transformation"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
End of explanation
"""


SmallGuy = icosa * one/s_factor * one/s_factor
SmallGuy

"""
Explanation: "SMALLGUY"
Above is an expression for the volume of said Icosa in tetravolumes.  
We may think of it as "two applications of the S-Factor bigger" than a smaller cubocta, with edges, get this, equal in magnitude to the volume of the edge 2 icosa.  
David Koski and I got to calling this cubocta "SmallGuy" (feel free to substitute your own moniker).  
The Concentric Hierarchy has a Sesame Street flavor (kids' TV show) in some walkx of life, lending to our penchant for colloquialisms.
End of explanation
"""


ve * (one/s_factor)**3

SmallGuy_edge = two * (one/s_factor) # effect on edges
SmallGuy_edge

"""
Explanation: Another way to reach the SmallGuy is to start with the volume 20 cubocta and shrink its edges by the S Factor, which means volume shrinks by a factor of the reciprocal of said S Factor to the 3rd power or $1/s_factor ^{3}$
End of explanation
"""


superRT = ve * S3
superRT

"""
Explanation: RHOMBIC TRIACONTAHEDRON (RT)
<a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/4148457444/in/photolist-27mJSE2-9AU59Y-97TTvV-8dyvmP-8batBx-8awATh-7YZyV3-7nfvNf-7jzVRo-7jzVSm-5STUzp-5DsYfo-5zTRpB-JoybP-Joybi-6BkWWK" title="Rhombic Triacontahedron"><img src="https://farm3.staticflickr.com/2662/4148457444_60e88eee55.jpg" width="454" height="354" alt="Rhombic Triacontahedron"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
End of explanation
"""


Decimal('15') * sqrt2

"""
Explanation: S3 is our conversion constant for going between XYZ cube volumes and IVM tetra volumes.  The two mensuration systems each have their own unit volume, by convention a .5 radius edge cube versus a 1.0 diametered edged tetrahedron, or use edges 1 and 2 if preferred, their ratio will be the same, with the cube a bit bigger.
<a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/9530922237/in/album-72157624750749042/" title="Regular and Right Tetrahedrons Compared"><img src="https://farm4.staticflickr.com/3790/9530922237_dcc672a68a.jpg" width="500" height="375" alt="Regular and Right Tetrahedrons Compared"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
SuperRT is the RT (rhombic triacontahedron) formed by the Icosa and its dual, the Pentagonal Dodecahedron, the two five-fold symmetric shapes in the Platonic set of five polys.  The Icosa we're talking about is the one above, derived from the VE of volume 20, through Jitterbugging.
If we shrink SuperRT down by $\phi^{-3}$ volume-wise (all edges are now $\phi^{-1}$ their initial length), and carve it into 120 modules (60 left, 60 right), then lo and behold, we have the E modules.
Another expression for SuperRT volume is $15\sqrt{2}$.
End of explanation
"""


emod = (superRT * Ø**-3)/Decimal(120)

emod

smod = emod * s_factor
smod

smod/emod

"""
Explanation: E MODULE
<a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/39286474584/in/photolist-22RBsb5-CwvwpP-vLby2U-ujipN3-f75zUP-aDSfHf-8ryEix-8ryECF-7mcmne-5zTRjp-5zY9gA-7k4Eid-7k4Em5-7jZLe2-7jZLhp-7k4Ejf" title="module_studies"><img src="https://farm5.staticflickr.com/4626/39286474584_2df7913f05.jpg" width="500" height="271" alt="module_studies"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
End of explanation
"""


Decimal(24) * emod + Decimal(8) * emod * Ø**-3

"""
Explanation: The S factor again, yes?  
$\sqrt{2}-(\sqrt{2}(\phi^{-3}))= 2\sqrt{2}(\phi^{-2})$ = S Factor.
Another expression for the S Factor is $24E + 8e3$ where E means emod, and $e3$ means $E * \phi^{-3}$.
End of explanation
"""


small_ve = ve / Decimal(8)

"""
Explanation: S MODULE
Now lets shrink the 20 volumed VE by halving all edges, reducing volume by a factor of 8, to 2.5
End of explanation
"""


skew_icosa = small_ve * s_factor * s_factor

skew_icosa

skew_icosa + (24 * smod)

"""
Explanation: <a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/6335726352/in/photolist-vLby2U-ujipN3-f75zUP-aDSfHf-8ryEix-8ryECF-7mcmne-5zTRjp-5zY9gA-7k4Eid-7k4Em5-7jZLe2-7jZLhp-7k4Ejf" title="S Module"><img src="https://farm7.staticflickr.com/6114/6335726352_902009df40.jpg" width="500" height="441" alt="S Module"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
As every grade schooler knows, if at all aware of their heritage, said VE inscribes inside the octahedron of volume 4, as does an Icosahedron with flush faces.  We do a kind of jitterbugging that makes the VE larger instead of smaller.  Two applications of the S Factor does the trick.
End of explanation
"""


Decimal(60) * smod + Decimal(20) * smod * Ø**-3

Decimal(20) * Ø**-4

"""
Explanation: The figure below is an S-Factor radius, meaning from the center to each diamond face center on the surface.
<a data-flickr-embed="true"  href="https://www.flickr.com/photos/kirbyurner/37516435114/in/photolist-Zacx7b-f763Kv-PjPfT-PjPdz" title="S-Factor Radius"><img src="https://farm5.staticflickr.com/4551/37516435114_d4687b378c.jpg" width="500" height="312" alt="S-Factor Radius"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>
<div align="center">by D.B. Koski using vZome</div>

David Koski writes (on Facebook):  
The volume 4, edge 2 octahedron, has a volume of 4 tetrahedral units or 84S + 20s3 modules
S = $(\phi^{-5})/2$ = .045084
s3 = $(\phi^{-8})/2$ = .010643
The icosahedron inside of this octahedron has a volume of 84S+20s3 - 24S = 60S+20s3 = 2.917960 = $20(\phi^{-4})$.
Surprisingly, this icosahedron has an edge of 1.08036 or the Sfactor!
End of explanation
"""


