<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Apologies in advance for my ramblings.  Something here might be of interest to anonymous readers...</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Last night and today were all about dusting off old skills and using Python in a Jupyter Notebook to showcase renderings by the free raytracer POV-Ray (<a href="http://povray.org">povray.org</a>).  The topic is pure geometry, no fancy textures required.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">In the meantime I'm looking at both Rhino (proprietary) and Blender (open source), partly because C6XTY / Flextegrity wants to get itself into the hands of more software engineers and partly because Coding with Kids is looking at teaching more 2D / 3D graphics (partially covered in the current suite of tools, but room for growth).<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">These are both CAD programs for doing 3D animations and renderings, both with Python APIs.  <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">I learned from my teaching job with kids that even Chromebooks have access to some kind of Blender in the cloud.  Didn't know that until last week.  This kid sounds like one of our students:  <a href="https://youtu.be/JlydssSG5Iw" target="_blank">https://youtu.be/<wbr>JlydssSG5Iw</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Here's the Jupyter Notebook in question.  The only dependency is qrays.py in the same Github repo [and of course povray if the goal is to do renderings].</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="https://github.com/4dsolutions/Python5/blob/master/Generating%20the%20FCC.ipynb">https://github.com/4dsolutions/Python5/blob/master/Generating%20the%20FCC.ipynb</a><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Zooming out:  what I think might interest high schoolers, just learning about XYZ, spherical coordinates and so on, is some exposure to these arcane alien esoteric "quadray coordinates" that use 4-tuples instead of 3-tuples to map points in space (no negative numbers required).  I've got lots of material on 'em but don't claim credit for inventing them (more a popularizer, implemented 'em in Python and Clojure, Tom Ace in C++).<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="http://mathforum.org/library/view/6236.html">http://mathforum.org/library/view/6236.html</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">What's appealing is they're conceptually accessible, not hard to grok, yet there's so much room for original research.  Clearly four spokes divide space into four quadrants and any point is reachable by adding up to three (stretched or shrunk -- but not reversed) per the usual vector scaling and addition operations.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">The centers of all balls in what we call the FCC or CCP packing (core in crystallography), starting with a nuclear sphere then 1, 12, 42, 92... balls packing outward in shells (see OEIS [1]) may be given all-integer 4-tuple coordinates using qrays.  <br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Example (these are the 12 ball centers around a nuclear center, at the corners of a cuboctahedron with origin at (0,0,0,0) (note: ivm_vector is same thing as qray, of namedtuple type in collections library).<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">{ivm_vector(a=0, b=1, c=1, d=2),<br> ivm_vector(a=1, b=2, c=0, d=1),<br> ivm_vector(a=0, b=1, c=2, d=1),<br> ivm_vector(a=0, b=2, c=1, d=1),<br> ivm_vector(a=2, b=1, c=0, d=1),<br> ivm_vector(a=1, b=2, c=1, d=0),<br> ivm_vector(a=1, b=1, c=2, d=0),<br> ivm_vector(a=2, b=1, c=1, d=0),<br> ivm_vector(a=1, b=0, c=2, d=1),<br> ivm_vector(a=2, b=0, c=1, d=1),<br> ivm_vector(a=1, b=0, c=1, d=2),<br> ivm_vector(a=1, b=1, c=0, d=2)}<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Today I realized that to add Qrays to a set, they'd need to be (a) hashable and (b) usable with == i.e. __eq__ would need to have meaning. Without __eq__, every instance was being seen as unique.  That add to the set OK, but dupes were not thrown out. They'd hash, but not on the 4-tuple content, what __eq__ now provides.  Here's that code fragment:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><span style="font-family:monospace,monospace">    <br>    def __eq__(self, other):<br>        return self.coords == other.coords<br>        <br>    def __hash__(self):<br>        return hash(self.coords)</span><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Most recent qrays (there's an ordinary XYZ vector type too -- and the means to go back and forth):</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="https://github.com/4dsolutions/Python5/blob/master/qrays.py">https://github.com/4dsolutions/Python5/blob/master/qrays.py</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">(I keep updating this, like I notice I need to update the comments to say I updated the file just today)<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">The algorithm for getting successive layers of balls (1, 12, 42, 92...) is to add all 12 balls around every ball in shell N, but then discard (simply by using the set object for storage) all those balls already in shell N or shell N-1, generating only balls in shell N+1.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><span style="font-family:monospace,monospace"><br>nucleus = {qrays.Qvector((0,0,0,0))}<br><br>layer1 = tuple(map(qrays.Qvector, <br>         ((0, 1, 1, 2), (1, 0, 1, 2), <br>          (2, 0, 1, 1), (0, 2, 1, 1), <br>          (0, 1, 2, 1), (1, 2, 1, 0), <br>          (1, 1, 2, 0), (2, 1, 1, 0), <br>          (1, 0, 2, 1), (1, 2, 0, 1), <br>          (2, 1, 0, 1), (1, 1, 0, 2))))<br><br>def next_layer(curr_layer, prev_layer):<br>    next_layer = set()<br>    for qv in curr_layer:<br>        for bv in layer1:<br>            v_sum = qv + bv<br>            if (not v_sum in curr_layer <br>                and not v_sum in prev_layer):<br>                next_layer.add(v_sum)<br>    return next_layer<br><br>nl   = next_layer(nucleus, nucleus) # 1-freq<br>nnl  = next_layer(nl, nucleus)      # 2-freq<br>nnnl = next_layer(nnl, nl)          # 3-freq<br>print("Number of balls in successive layers:")<br>print(len(nl))<br>print(len(nnl))<br>print(len(nnnl))</span><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">If you click on the Notebook you'll see what I mean by "shells".  More here:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="https://github.com/4dsolutions/Python5/blob/master/STEM%20Mathematics.ipynb">https://github.com/4dsolutions/Python5/blob/master/STEM%20Mathematics.ipynb</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Anyway, quadrays or "caltrop coordinates" are pretty freaky and I think help XYZers better appreciate what the orthodoxy is.  When you've seen something alien, you better appreciate the status quo.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">I took C6XTY out to Saturday Academy on the campus of University of Portland [2], to see Rhino and Jupyter Notebooks running on Windows7.  Jupyter Notebooks at least is something to have on your resume if thinking about college.  It's about working with way more than just Python.  I think I posted those recent articles already.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">Kirby</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">[1]   <a href="http://oeis.org/A005901">http://oeis.org/A005901</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">(my name under links, still trying to make it viral)<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">[2]   C6XTY @ sa: this Thursday:<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="https://flic.kr/p/HnGeut">https://flic.kr/p/HnGeut</a><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large">(sa: is where I've taught Martian Math before)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="http://www.4dsolutions.net/satacad/martianmath/toc.html">http://www.4dsolutions.net/satacad/martianmath/toc.html</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><a href="http://wikieducator.org/Martian_Math">http://wikieducator.org/Martian_Math</a></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:large"><br></div></div>