high school "Pythonic math": Vector as pivotal (+ addendum on recent recipes)

Per these paragraphs to a listserv for Physics teachers -- to which I was invited by one Dr. Bob Fuller, a former AAPT chairman -- I'm underlining a Vector type as one of the hallmarks of high school math: === [ posted about 2.5 hours ago ] === Your remarks on fluency are well taken. I'm just about to post something to edu-sig about the Vector class (class as in "type of object") and its pivotal role in grades 9-12 (as we say in this namespace). That'd be along both the delta and lambda tracks, continuous and discrete. Luciano Ramalho has recently published the book 'Fluent Python' which is appearing in several languages (I've met the guy a few times, been in his workshops or seen them on video). Luciano does a really fluent Vector type, as many dimensions as you want. With operator overloading, you can add them (v1 + v2), scale them (3 * v1), multiply them by matrices to get more vectors. You could say, when applying a rotation matrix, that "it's the same vector, just moved" but more disciplined functional programmers prefer immutable objects begetting new immutable objects, minimizing hidden (contained) state. Even with OO languages, there's something called programming in a more functional way. 'Functional Python' by Mertz is another popular title. The sympy library has a Clifford Algebra bivector submodule that I've not played with yet. === ... continuing that thought ... Once you have the bare bones model, the mathematical Vector, then you get to wire it up to different strategies for rendering. A simple and mathematically correct approach has all Vectors originating at the origin, pointing to points, such that the edges of a Polyhedron around said origin are each defined by two endpoint Vectors. e = Edge(v0, v1). Rendering edges, vertexes and faces (E, V, F) is a common theme, regardless of rendering back and, be that ray tracer, Pi3D or what have you. This was my approach in stickworks.py -- separate model from visualization code to some degree. I experimented with tighter and looser coupling. Like if you can interactively make graphics happen in a window, from a REPL in real time, so much the better. http://4dsolutions.net/ocn/python/stickworks.py (source) https://youtu.be/4iMSGKXJ_Ds (Youtube intro) A wrinkle in my curriculum writing is we may go on to re-implement the Vector concept using "quadray coordinates" (see Wikipedia) per this Jupyter notebook: ' http://nbviewer.jupyter.org/github/4dsolutions/Python5/blob/master/Polyhedro... ' I'm thinking lots of math teachers might like to go this route, not necessarily starting with my source code or anyone else's in particular (maybe Luciano's) as an exercise in learning / teaching pure Python. --------------------------------- Addendum re Raspberry Pi, as a polyhedrons rendering machine (the theme of my last two posts): I'm still working with Adrian Rossiter on OpenGL issues. His antiview runs but is not yet rendering properly https://flic.kr/p/KBCcqy (messed up antiview view in upper right) probably because Pi use OpenGL ES, not what he'd coded for? I may see a fix? https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=63264 However, when it comes to this pipeline: antiprism generating program -> OFF file -> off2pov -> POV -> povray things are working great: https://flic.kr/p/LoXhEG Kirby
participants (1)
-
kirby urner