From gerry.lowry at abilitybusinesscomputerservices.com Thu Jan 1 20:18:13 2009 From: gerry.lowry at abilitybusinesscomputerservices.com (gerry_lowry (alliston ontario canada)) Date: Thu, 1 Jan 2009 14:18:13 -0500 Subject: [Edu-sig] ACM Urges Obama to Include CS as Core ComponentofScience, Math Education References: <40ea4eb00812231901u549104b0l55021ac7abd99113@mail.gmail.com><1A1B4FA259C6443DA6471C66A5E5E937@zentrumvegan> Message-ID: Actually, I was not talking about prodigies of any age. The idea was not about "hitting a pre-teen with ... J", rather it's about using J as a workbench with which educators can rapidly mentor your average student to experiment and grow with J and with the J IDE. In the following example, I recall a book called "Confessions of a Sneaky Organic Cook (Or, How to Make Your Family Healthy When They're Not Looking!)". Perhaps, with appropriate prepartion, an educator might mentor a number of students with a technique that might be called "Confessions of a Sneaky Educator (or How to get average students to learn above average computer and mathematics skills)". very simplistic example in J: ADD =. +/ NB. here "ADD" means to add some numbers ADD 2 2 4 ADD 1 3 5 7 11 13 17 19 76 SUM =. ADD NB. here "SUM" is another word for "ADD" SUM 2 2 4 NB. we now have THREE similar ways to add some numbers: +/ 2 2 4 ADD 2 2 4 SUM 2 2 4 If we only focus on prodigies, we short change society. There are many potential students who are highly capable even though they are not prodigies. Further, providing and mentoring a variety of tools via OLPC XO-1 may even help the educators to discover the next Srinivasa Ramanujan before she/he is washed out to sea by a tsunami or blown to bits by a roadside IED. Regards, Gerry P.S.: Best wishes to all and especially to the underprivileged in 2009 and beyond. From kirby.urner at gmail.com Sat Jan 3 01:38:59 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 2 Jan 2009 16:38:59 -0800 Subject: [Edu-sig] ACM Urges Obama to Include CS as Core ComponentofScience, Math Education In-Reply-To: References: <40ea4eb00812231901u549104b0l55021ac7abd99113@mail.gmail.com> <1A1B4FA259C6443DA6471C66A5E5E937@zentrumvegan> Message-ID: On Thu, Jan 1, 2009 at 11:18 AM, gerry_lowry (alliston ontario canada) wrote: > Actually, I was not talking about prodigies of any age. > > The idea was not about "hitting a pre-teen with ... J", rather it's about using J as a workbench > with which educators can rapidly mentor your average student to experiment and grow with J > and with the J IDE. In the following example, I recall a book called "Confessions of a Sneaky Organic Cook > (Or, How to Make Your Family Healthy When They're Not Looking!)". To say "your average student" subtracts info from my "pre-teen" as at least I was giving an age bracket. Given my premise that the XO, because of design and appearance, is really designed for pre secondary school aged kids (more for elementary), I am seeing the proposal to have J on the XO as a commitment to writing curriculum for the J language for pre-teens ("curriculum writing" doesn't necessarily imply paper books, though it still might in some circles). The pipeline I've derived (from a process of many meetings) is more "controlling an avatar" (puppets) starting early (continuing onward -- fine to use not-computerized puppets of course, rear projection as in Indonesia is cool), then immersion in various environments designed to facilitate learning of this and that (ala Sims, Spore, Second Life, Active Worlds, and that Smalltalky one -- forgetting the name at the moment). The final phase is starting to dig behind the scenes to study the implementations of these things, getting into math and source code in a deeper way (I call this "tunnels under Disney World" -- realizing most might not call it that). Myself, I'm a big believer in hybrid environments meaning we don't standardize on any one language or environment, aren't in any way trying to get everyone on the same page. No "national curriculum" (blech), no lock-stepping with ETS, a strategy that has destroyed a generation already, so no need to keep repeating that same mistake over and over. I believe in competing models, different states (nations, corporations) trying different approaches. For marketing purposes, we intimate that if your high school doesn't teach you any SQL, you should be concerned, very concerned, but that's not the same thing as calling for a nationalized curriculum with some top-down "advisory board" (guffaw). Here's a link to some of my "tourism literature" FYI: http://mathforum.org/kb/thread.jspa?threadID=1876104&tstart=0 (mentions Iverson, XO etc.) Note I have no objection whatsoever to anyone's efforts to put J on the XO. I just hope I also have access to it when I'm working with my target demographic, the students I'm more trained to work with (too old for the XO, more AK-47 age (could be on Wii)). > > Perhaps, with appropriate prepartion, an educator might mentor a number of students > with a technique that might be called "Confessions of a Sneaky Educator (or How to get > average students to learn above average computer and mathematics skills)". > I'm all for that. Subversion of this kind is what education is all about no? So many messages have a discouraging spin, keep students feeling it's beyond their ken. Great of they might grow up less intimidated by such as J, used unscrupulously in some circles to conceal Ponzi schemes etc. (same as Python, same as any language where obfuscation is a possibility -- English especially good at this). > If we only focus on prodigies, we short change society. There are many potential students > who are highly capable even though they are not prodigies. Yes. On the other hand, prodigies fall through the cracks way too often, something I'm very aware of given my place of employment (a school that attracts prodigies). > > Further, providing and mentoring a variety of tools via OLPC XO-1 may even help the educators > to discover the next Srinivasa Ramanujan before she/he is washed out to sea by a tsunami > or blown to bits by a roadside IED. > > Regards, > Gerry Great song about that guy, plus stuff in my blogs: http://www.archive.org/details/Ramanujan http://worldgame.blogspot.com/search?q=Ramanujan Kirby > P.S.: Best wishes to all and especially to the underprivileged in 2009 and beyond. > Yes, anyone not being taught any SQL in high school would count as a member of an oppressed group I think. Automated record keeping is core to civilization itself. This is not about "computer science" so much as about government, administration, the practive of medicine, human resources (matching the right folks to the right positions). From gerry.lowry at abilitybusinesscomputerservices.com Sat Jan 3 16:09:49 2009 From: gerry.lowry at abilitybusinesscomputerservices.com (gerry_lowry (alliston ontario canada)) Date: Sat, 3 Jan 2009 10:09:49 -0500 Subject: [Edu-sig] ACM Urges Obama to Include CS as CoreComponentofScience, Math Education References: <40ea4eb00812231901u549104b0l55021ac7abd99113@mail.gmail.com><1A1B4FA259C6443DA6471C66A5E5E937@zentrumvegan> Message-ID: k: =. kirby urner (partial quotes) g: =. gerry lowry (reponses to k) k: To say "your average student" subtracts info from my "pre-teen" as at least I was giving an age bracket. g: I'm referring to "average students" of any age. Individual nurtured growth is relevant to me. Age is merely a less relevant factor. k: "Given my premise that the XO, because of design and appearance, is really designed for pre secondary school aged kids (more for elementary) g: like this one: http://www.olpcnews.com/images/cherlin-xo.jpg B-) Sadly, I've not had the opportunity to experience an XO-1 personally and tactiley. Hence, I'm hopeful that the OLPC XO-1 will be useful to any person fortunate enough to have one. k: I am seeing the proposal to have J on the XO as a commitment to writing curriculum for the J language for pre-teens. g: currucula for all ages and abilities could be written for J on the XO. J's IDE "Studio, Labs..." capability facilitates electronic curricula for diverse age groups, et cetera. This in turn could substantially diminish need for paper based curricula. k: I'm a big believer in hybrid environments meaning we don't standardize on any one language or environment, aren't in any way trying to get everyone on the same page. No "national curriculum" (blech), no lock-stepping with ETS, a strategy that has destroyed a generation already, so no need to keep repeating that same mistake over and over. g: I'm reminded of the computing world's oft repeated mantra: "If your only tool is a hammer, then all of your problems will tend to look like nails". Also, the Perl community's TIMTOWTDI (There IS More Than One Way To Do It). In my own words, many tools make fine minds. Ken Iverson referred to "Notation as a tool of thought" * in his 1979 Turing award essay wherein Ken quoted A. N. Whitehead: "By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and in effect increases the mental power of the race". *ACM SIGAPL APL Quote Quad, Volume 35 , Issue 1-2 (March, June 2007) In honor of Kenneth E. Iverson; Pages: 2 - 31; ISSN:0163-6006 Communications of the ACM; Volume 23 , Issue 8 (August 1980) table of contents Pages: 444 - 465; ISSN:0001-0782 ACM Turing award lectures book contents, Page: 1979; Year of Publication: 2007 ISBN:0-201-0779X-X So I'm not implying "J way or no way". In fact, I'm very strongly opposed to such a restrictive idea. Rather, I'm simply saying J and the J IDE offer certain advantages for their inclusion in the "ships with installed" list for the OLPC XO-1. Of course, I'm powerless to do more than suggest this. I'd also like to see C++, FORTH, LISP, LOGO, Pascal, and PROLOG as part of the "ships with installed" list as well as a version of MASM since the OLPC XO-1 CPU is programable with x86 assembly language. k: I believe in competing models, different states (nations, corporations) trying different approaches. g: I prefer co-operating models wherein we learn from each others different approaches with the goal of improving the learner's environment and positively affective the learner's success potential. k: For marketing purposes, we intimate that if your high school doesn't teach you any SQL, you should be concerned, very concerned g: Perhaps one should be even more concerned if there's too much emphasis on SQL ... there are other potentially better ways to stream and process data than via the relational database model. Not every data mapping fits conveniently into tuples; otherwise, normalization might be more normal. k: ... calling for a nationalized curriculum with some top-down "advisory board" (guffaw). g: I think I'm agreeing with kirby here. National goals are good things, e.g., the spirit of the "No child left behind" act. ** ** http://www.ed.gov/policy/elsec/leg/esea02/index.html The problem is that nationalized curricula can too swiftly become a political vehicle for denial of services and thus restricting otherwise possible growth. A not so abstract example is the absense in many locales of effective sex education and the corresponding number of illegitimate enfants born because of ignorance induced pregnancies caused by myths such as "You can't get pregnant the first time you have sexual intercourse". k: prodigies fall through the cracks way too often g: agreed. apparently the world's smartest person is employed as a bartender. it pains me when imho a good mind goes to waste. at the same time, many minds could still be more productive and more rounded in humanistic and scientific ways with a better educational system ... too often some educational systems want to separate carpenters from financial wizards. This practice forgets the fact that many of us are late bloomers and also that in the care of different gardeners, we might blossom in unforeseen ways. k: Great song about that guy [Srinivasa Ramanujan] http://www.archive.org/details/Ramanujan g: thanks!!! k: http://worldgame.blogspot.com/search?q=Ramanujan g: more thanks!!! Fuller would have liked to have seen an experiment where 100 000 persons were paid NOT to work. He felt one of them would be likely to make a grand contribution to society that would justify the experiment. I like to think Fuller almost correct; imho, I think that collectively, they sum of the participants' contributions would justify the experiment. While we will not likely see such an experiment, it's nevertheless possible that equivalent societal benefits might occur if schemes (sic) like OLPC become successes. k: anyone not being taught any SQL in high school would count as a member of an oppressed group g: but nowhere nearly as oppressed as the children who die of hunger related diseases, one every few seconds. k: human resources (matching the right folks to the right positions). g: I've been around since before the term "human resources" was introduced AFAIK; when first introduced, the emphasis was on "human"; in the last few decades, the emphasis has shifted from "human" to "resources" and not in a positive way. i.e., humans are now seen as resources, specifically as things rather than as people. Regards, Gerry From kirby.urner at gmail.com Sat Jan 3 17:28:57 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 3 Jan 2009 08:28:57 -0800 Subject: [Edu-sig] ACM Urges Obama to Include CS as CoreComponentofScience, Math Education In-Reply-To: References: <40ea4eb00812231901u549104b0l55021ac7abd99113@mail.gmail.com> <1A1B4FA259C6443DA6471C66A5E5E937@zentrumvegan> Message-ID: Yes Gerry, sounds like we're in agreement on many points. It'd be lovely to be at a point where we're questioning SQL as the best way to go, but alas you don't find many students ready for that discussion in Portland, as they still don't know what SQL is, the Oregonian (town newspaper) rarely mentions it (even though I bet they use it). 'Dilbert' is a great comic, but xkcd is taking the cake in some ways (I'm not persuaded Dilbert really knows much SQL, Wally either -- pointy haired boss uses Office I bet). SQL is required for government and administration. Easy to topple a gov't that has no databases, as there's not really a gov't then, whereas anything with big iron behind it (like IBM behind the Nazis) has real muscle, and that big iron runs SQL (Hollerith keeping tabs, on steroids). SQL is required for industrial scale medicine, as you want that infant associated with a treatment program. This image of doctors without borders seeing people just once is ridiculous, you need repeat visits and you need medical record keeping. These days, that usually means SQL, though it could mean Google appengine, so GQL then ( http://gql.sourceforge.net/ ). That you can become an adult in this culture and not know what SQL is reminds me of when people couldn't read the Bible, had to go to a priest who would likely leave out the juicy bits (e.g. certain demented passages in Leviticus) and spoil the fun. Thanks to Gutenberg, we're able to read our own source code (whatever ethnicity) and in geek world (e.g. GOSCON, GIS), that includes (but is not limited to) SQL. Computer algebra is our way of bridging the digital divide, getting that world class education to South Chicago and places. In today's idiocracy, we flood the cube farms with cube monkeys who beat their heads against that padded cell called Microsoft Access, a fat client piece of Office, but never grasp what's going on behind the scenes, in which case they'd be able to fire up like a shell and go at it directly, hitting those tables with the likes of Django (manage.py shell) or what have you. Access is notoriously not "shell mode friendly", same with VBA in general, whereas J, Scheme, Python... all the decent agiles (Ruby, bash...), have one. So let's just agree to keep Access *off* the XO (for the sake of our children's sanity) and I think we'll be fine. As for the smartest person in the world being a bartender, that makes a lot of sense, as HR/people skills are among the most intensely difficult. One of the smartest people I've ever met was a barista, ran a friendly, happy wifi cafe here in Portland. Yet this person could also coordinate international disaster relief, take guff from egomaniacs (with grace), and champion the plight of orphans around the world (she's been one), forgetting which NGO at the moment. Anyway, a battlehard genius, all of 5 feet tall, kickboxer, Asian model equipment. I've only met two or three other people that intelligent, and I've met a *lot* of really smart people. I think the Indonesians have it right with the shadow puppets. A lot of enculturation will involve projecting and turn taking, people getting up in front of the group and doing show & tell, Q&A. Python's "lightning talk" practice is a great encapsulation of this meme, which isn't that new, except for the technology, having YouTube for showing '16 Words' or whatever. This is the direction we're moving as Quakers (small ethnic cult). Picture us out in Montana, bed sheet strung between two trees, quiet battery powered projector showing J IDE out under the stars someplace, one of our teens giving a short lecture, camp fire crackling. Picture this happening in 2009, already storyboarded (NPYM meets in Montana this year). The XO models the laptop you carry around like a brief case. Once you get to the work place, it may be more like mission control, with lots of people sharing the same screens, big, up in front, more like TVs but really Django and JQuery out the back, talking to Oracle or PostGIS or whatever, helping coordinate food buying (thinking of FoodHub by Ecotrust, or something similar). These are interesting, sought-after jobs, available right out of high school if you're ready for NGO work, internships, or as a part of a college's work/study program if aiming for one of academia's certifications. Having had training on the XO will have been a big boost. You'll thank G1G1 and all those kind people in Hollywood like Angelina and Britney (billboards around Portland again too -- plus we have our own Hollywood (around 42nd and Sandy, used to rent space there)). http://www.olpcnews.com/forum/index.php?topic=15.msg27989;topicseen Kirby [ see previous messages on edu-sig, public archive, Python community, for context ]: Message just prior: http://mail.python.org/pipermail/edu-sig/2009-January/008986.html On Sat, Jan 3, 2009 at 7:09 AM, gerry_lowry (alliston ontario canada) wrote: > k: =. kirby urner (partial quotes) > g: =. gerry lowry (reponses to k) > From jurgis.pralgauskis at gmail.com Sun Jan 4 23:37:27 2009 From: jurgis.pralgauskis at gmail.com (Jurgis Pralgauskis) Date: Mon, 5 Jan 2009 00:37:27 +0200 Subject: [Edu-sig] happy new python interactive tutorial :) Message-ID: <34f4097d0901041437g481cb5a4hfc494f6850e6a238@mail.gmail.com> my weekend project in the mood of tryruby https://launchpad.net/intro-to-code what I liked most, that it nicely plays with IDLE but I still don't know, how to handle multiline inputs?? and how to start IDLE on windows... -- Jurgis Pralgauskis tel: 8-616 77613; jabber: jurgis at akl.lt; skype: dz0rdzas; Don't worry, be happy and make things better ;) From kirby.urner at gmail.com Tue Jan 6 00:03:58 2009 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 5 Jan 2009 15:03:58 -0800 Subject: [Edu-sig] some "place based" curriculum writing (with Python) Message-ID: I've continued exploring my "dodeca-cams in the Gorge" scenario, in connection with "memory banking" the environment as a legitimate school activity, similar to what my daughter's ecology school did around Oaks Bottom (Winterhaven, still going strong, but my daughter is in high school this year, whereas Winterhaven is a middle school -- where I taught Python to the entire 8th grade, GIS emphasis, lots of Google Earth (an entry point into XML, for registering location, location, location)).[1] These studies led me to connect the dots backward, to the beginning of photography in the Gorge in 1867, guy named Watkins. Landscape photography was a very new idea as the original degueurrotypes were one-offs and small, no such thing as large prints, forget about color. The only market that made sense at first, was taking pictures of individuals, portraits, close ups. Then a new chemical process was invented, very messy and sticky, that required development on the spot. So Watkins had literally tons of equipment to lug, back along the route taken by Lewis & Clark, to Celilo Falls, a natural wonder of the world until March 10, 1957 (Kodachrome comes into being around that same time).[2] Over on the Math Forum, it's again a conservative cabal saying "not our fault we control all future technology (we white guys, we proud)", me suggesting it's still a more complicated picture: lots of reorganization going on, town-gown relations in flux -- they always talk about "Main Street versus Wall Street" but other polarities matter as much, e.g. Google is very gowny.[3] To finish my story, a big consumer of "Celilo Falls power" i.e. of what became of it, The Dalles Dam, is our good friend and sponsor Google, right there at the site, with Amazon thinking to plug in to the same ecology. There's lots of optical fiber. Someone had foresight.[4] You'll see a lot more of the history in link [2] but I'm probably skipping over some IMAX movie about the Gorge, perhaps already out there i.e. I'm not giving anything close to a comprehensive story. This is all good material for public school students though, inspires them to keep studying in preparation for an interesting career with higher bandwidth multimedia, such as the Immersive Media recordings (e.g. Google Streets, filmed with dodeca-cams). A big trend in education is to make it "place based" i.e. really customize like crazy to make it cram packed with local history and lore, help students orient to exactly where they are, not some hum drum fictional Anytown USA or wherever. I'm adding momentum to that trend, yakking in very locally geographic terms, knowing each one of us has this same ability to assume local focus. Python works in many of these places, plays well in most ecosystems, a very cosmopolitan, "big city" language -- accessible, urbane, civic minded -- that does well in the wilderness (marketing angle). I'm still pushing the Rich Data Structure idea, again with local (custom) data, accepting bridges to JSON and XML, not trying to say "all Python, all the time" to anybody (that'd be boring). Kirby [1] http://www.4dsolutions.net/ocn/winterhaven/ [2] http://worldgame.blogspot.com/2009/01/columbia-gorge-recent-history.html [3] http://mathforum.org/kb/thread.jspa?threadID=1876834&tstart=0 [4] http://www.channelregister.co.uk/2008/12/12/amazon_goes_containers/ From kirby.urner at gmail.com Wed Jan 7 23:34:59 2009 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 7 Jan 2009 14:34:59 -0800 Subject: [Edu-sig] input from physics teaching Message-ID: I had a productive meeting with Dr. Bob Fuller, University of Nebraska, emeritus, yesterday, a long time associate on that First Person Physics proposal to NSF (close, no cigar). He's working on the Karplus legacy, in turn stemming from Piaget. http://controlroom.blogspot.com/2009/01/physics-update.html Science teaching went through a more successful transformation to "constructivist" (in the sense of student centered, construct your own model of reality) than USA math teaching managed (talking later 1900s), as the latter was mostly a panic response too Sputnik (so-called SMSG) and it's been a backlash ever since ("back to basics" to the point of near extinction of the subject, in terms of attracting fresh thinking). I'm not sure how it went in the UK, other Anglophone cultures. Others on edu-sig will have more place-based stories of curriculum writing (the evolution thereof) in your respective necks of the woods. Anyway, the physics community has been interested in video games as teaching devices right from the get go, with museum-grade simulators (like the ones pilots train in) representing a kind of high end state of the art (people actually get sick in those, given the realism). Speaking of getting sick, you'll find in my Vilnius slides, other places, a strong emphasis on "grossology" when working with kids. That's a part of kid culture I've always found missing from Squeak, which seems too squeaky clean, not sufficiently demented. For example, if using a system language and defining a function, you'll like encounter strong type awareness, meaning every type declared *and* in a specific order e.g. f(int x, str y) and g(str y, int x) are quite strict about what they "eat" (function as mouth) and if you send them the wrong args, they will "barf" (has to be OK to say that, or you lose a lot of would-be attenders). The "type awareness" we want to induce is very traditional and follows that time-honored sequence: N, W, Z, Q, R, C. You might not think if quite those terms (namespaces differ) but we're talking natural, whole, integer, rational, real and complex respectively. These are types, and there's an historical narrative explaining the drive to expand to new horizons, starting with simple geometric ratios such as the body diagonal of a cube (math.sqrt(3)) or of the 1 x 2 rectangle (math.sqrt(5)). Given the historical dimension, it's quite appropriate to give these primitive geometric relationships a somewhat neolithic spin i.e. some talk of "cave people". This helps anchor some data points for later, when we get into trigonometry and navigation techniques (over desert, over sea). http://www.flickr.com/photos/17157315 at N00/sets/72157612202599023/ (gnu math teacher Glenn Stockton, expert in neolithic tool making, including for astronomical purposes) You get these right simple surds (e.g. phi, math.sqrt(2)) out of the gate, with compass and ruler, scribing in sand (on a spherical surface, so only locally Euclidean -- "close enough for folk music" as we say in geography class, zooming in on Greece in Google Earth maybe). Pi, unlike phi, is transcendental, not just irrational. I agree with posters here than Ramanujan is a great source of generators (in the Pythonic sense), plus I like playing that epic song. http://worldgame.blogspot.com/2008/02/reflective-fragment.html The complex numbers get added by those in the Italian peninsula, seeking to solve Polynomial Puzzles (Pisa a center for this kind of game playing, lots of betting, not unlike cockfighting). Fractals ala the Mandelbrot pattern, scribed in the complex plane, come latter ("phi is the first fractal" -- a mnemonic we use). However, given this is alpha-numeric literacy i.e. string-oriented as well as numerical, we don't stop with a recap of basic algebra. We need those regular expressions (good for URL parsing) and Unicode studies. Fine if the language arts teachers want to pick up the story at this point, take it away from the algebra teachers. We're talking DOM (Document Object Model), XML... what became of "the outline" in Roman times (structured thinking, rhetoric). I'd like to thank Ian Benson of Sociality / Tizard for confirming my impression that R0ml is correct in his approach, with strong emphasis on Liberal Arts (in healthy doses at OSCONs -- the guy is simply brilliant). 'Godel Escher Bach' is another trailblazing work, in making sure we keep the string games going, don't propagate the misinformation that "number crunching" is all that we're about. Knuth called 'em *semi*-numerical algorithms for a reason. But the question remains, if you *are* committed to keeping regular expressions within math: where to put them? I think the answer is pretty obvious: students need to work as a team to maintain some kind of Django web site, could be exclusively in-house (not public), with time line data, events in math history, adding and morphing over time. Actually parse URLs, triggering real SQL behind the scenes. This is all completely topical, very job market oriented. Yet we're in a constructivist realm, giving imaginations free play and lots of open-ended exploration time. I continue with the "gnu math" and "computer algebra" labeling, adding the Bucky stuff as a "secret sauce" -- spices it up to have something a little questioning of authority, especially in a math learning context, where some adults are accustomed to unchallenged authority. No longer, rest assured. Kirby From kirby.urner at gmail.com Thu Jan 8 01:35:29 2009 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 7 Jan 2009 16:35:29 -0800 Subject: [Edu-sig] input from physics teaching In-Reply-To: References: Message-ID: On Wed, Jan 7, 2009 at 2:34 PM, kirby urner wrote: > I had a productive meeting with Dr. Bob Fuller, University of > Nebraska, emeritus, yesterday, a long time associate on that First > Person Physics proposal to NSF (close, no cigar). He's working on the > Karplus legacy, in turn stemming from Piaget. OK, so that had a lot of typos. If you're sharing my materials with a peer group, may I recommend the URL below, likewise no login required, i.e. public (world readable): http://mathforum.org/kb/thread.jspa?threadID=1879421&tstart=0 Kirby PS: dunno who this might be, just thought I'd mention the bounce: On Wed, Jan 7, 2009 at 2:35 PM, wrote: > Sorry. Your message could not be delivered to: > Archive Services (Mailbox or Conference is full.) > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > From aranafireheart at mac.com Thu Jan 8 22:01:07 2009 From: aranafireheart at mac.com (Arana Fireheart) Date: Thu, 08 Jan 2009 16:01:07 -0500 Subject: [Edu-sig] Python 2.6.1 build problems Message-ID: Hi, I am trying to build Python 2.6.1 (upgrade) on Ubuntu 8.10 in preparation for a class next week. When I try to build it from the source files I run into two problems. 1. The first (resolved) was: Failed to find the necessary bits to build these modules: bsddb185 sunaudiodev I was able to reslove this by using a patch "python2.6-disable-old- modules.patch" 2. The second and currently un-resolvable issue is that the build fails to link in tkinter. I can't quite figure this one out, since I thought that this was part of Python. *** WARNING: renaming "_tkinter" since importing it failed: libtk8.5.so.0: cannot open shared object file: No such file or directory Failed to build these modules: _tkinter running build_scripts arana at arana-linux:~/Desktop/Python-2.6.1$ Is there anyone out there that has figured out how to get this build to finish? I've kinda run out of tricks! Arana -------------- next part -------------- An HTML attachment was scrubbed... URL: From Scott.Daniels at Acm.Org Thu Jan 8 23:11:52 2009 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Thu, 08 Jan 2009 14:11:52 -0800 Subject: [Edu-sig] Python 2.6.1 build problems In-Reply-To: References: Message-ID: Arana Fireheart wrote: > ... The second and currently un-resolvable issue is that the build fails > to link in tkinter. I can't quite figure this one out, since I thought > that this was part of Python. > > Is there anyone out there that has figured out how to get this build to > finish? I've kinda run out of tricks! It is essential to have a Tcl/Tk development package installed before configuring Python. I don't know enough about what packages you need for Ubuntu, but check into it; that may be the problem (than make clean ./configure, ....) --Scott David Daniels Scott.Daniels at Acm.Org From ccosse at gmail.com Thu Jan 8 23:59:07 2009 From: ccosse at gmail.com (=?ISO-8859-1?Q?Charles_Coss=E9?=) Date: Thu, 8 Jan 2009 15:59:07 -0700 Subject: [Edu-sig] Python 2.6.1 build problems In-Reply-To: References: Message-ID: On Thu, Jan 8, 2009 at 3:11 PM, Scott David Daniels wrote: > Arana Fireheart wrote: >> >> ... The second and currently un-resolvable issue is that the build fails >> to link in tkinter. I can't quite figure this one out, since I thought that >> this was part of Python. >> >> Is there anyone out there that has figured out how to get this build to >> finish? I've kinda run out of tricks! > > It is essential to have a Tcl/Tk development package installed before > configuring Python. I don't know enough about what packages you need > for Ubuntu, but check into it; that may be the problem (than make clean > ./configure, ....) if you're building from source then check the configure options: ./configure --help and hopefully you can add a flag to configure without Tcl/Tk/TkInter at all ... ie ... ./configure --without-tk --without-tkinter (something like that .... maybe) -Charles > > --Scott David Daniels > Scott.Daniels at Acm.Org > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -- AsymptopiaSoftware|Software at theLimit http://www.asymptopia.org From vceder at canterburyschool.org Fri Jan 9 00:26:39 2009 From: vceder at canterburyschool.org (Vern Ceder) Date: Thu, 08 Jan 2009 18:26:39 -0500 Subject: [Edu-sig] Python 2.6.1 build problems In-Reply-To: References: Message-ID: <49668BAF.7000907@canterburyschool.org> To get a full build of Python 2.6 ( or Python 3, for that matter) you need to install the following packages: libsqlite3-dev libreadline5-dev libncurses5-dev zlib1g-dev libbz2-dev libssl-dev libgdbm-dev tk-dev This will give you a working IDLE... Cheers, Vern Arana Fireheart wrote: > Hi, > > I am trying to build Python 2.6.1 (upgrade) on Ubuntu 8.10 > in preparation for a class next week. When I try to build it from the > source files I run into two problems. > > 1. The first (resolved) was: > Failed to find the necessary bits to build these modules: bsddb185 > sunaudiodev > I was able to reslove this by using a patch > "python2.6-disable-old-modules.patch" > > > 2. The second and currently un-resolvable issue is that the build fails > to link in tkinter. I can't quite figure this one out, since I thought > that this was part of Python. > > *** WARNING: renaming "_tkinter" since importing it failed: libtk8.5.so.0: > cannot open shared object file: No such file or directory > > Failed to build these modules: > _tkinter > > running build_scripts > arana at arana-linux:~/Desktop/Python-2.6.1$ > > > Is there anyone out there that has figured out how to get this build to > finish? I've kinda run out of tricks! > > Arana > > > ------------------------------------------------------------------------ > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig -- This time for sure! -Bullwinkle J. Moose ----------------------------- Vern Ceder, Director of Technology Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804 vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137 From kirby.urner at gmail.com Fri Jan 9 23:44:42 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 9 Jan 2009 14:44:42 -0800 Subject: [Edu-sig] Many Laptops per Adult Message-ID: So I met with an Eee guy @ Chaos place this afternoon, talking about branding: http://www.flickr.com/photos/17157315 at N00/3182546603/in/photostream/ Given the XO is so identified with OLPC, we were talking MLPA perhaps -- many laptops per adult. The idea is you check them out from work, differently configured per the job at hand, e.g. sometimes you're presenting about Apache on Linux, other times about Apache on Windows, so might have a "stable" of laptops. I'm not saying every adult cares to have all these laptops, just its a way to market separately from OLPC without muddying the waters. The Eee is an Intel box, doesn't have to run Windows, or maybe get a Dell preloaded with Ubuntu as your other top choice (closer to my configuration). Of course both OLPC and MLPA need funding sources, sponsors. I expect the UN will keep thinking of ways to jump in. Here's some more pro Django stuff on PPUG list (somewhat apropos, in terms of demoing Apache to lifers in cube farms): http://mail.python.org/pipermail/portland/2009-January/000538.html Kirby From gerry.lowry at abilitybusinesscomputerservices.com Sun Jan 11 15:23:38 2009 From: gerry.lowry at abilitybusinesscomputerservices.com (gerry_lowry (alliston ontario canada)) Date: Sun, 11 Jan 2009 09:23:38 -0500 Subject: [Edu-sig] Many Laptops per Adult References: Message-ID: If the idea is shared laptops, probably a single laptop configuration would suffice for the following reasons: -- it's likely that most adults are barely competent to configure an operating systems -- "administrators" need to be able to maintain the revolving door laptops with minimal, consistent effort -- hard disks tend to be of sufficient size to host multiple operating systems -- someone grabbed the Ubuntu laptop but she/he needed the Windows laptop for________________ (fill in) -- someone needed the Ubuntu laptop but it was unfortunately already checked out -- individual's need to control their own data -- more efficient would be a single laptop to update perhaps by dropping a new image of a virtual configuration set -- a smaller pool of laptops would be required per "team" of shared users since all laptops would have a shared configuration No matter what, some end-user training would be required to explain how to use whatever laptop the adult was checking out ... therefore, with a SINGLE laptop, a SINGLE instruction booklet would require one extra section explaining how to boot into one's required environment. Shared data (e.g. a slide presentation) could reside in a common folder on each "team" laptop. USB flash drives are relatively inexpensive, hence individuals would keep their unique files on their own USB flash drive. g. From kirby.urner at gmail.com Sun Jan 11 19:06:37 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 11 Jan 2009 10:06:37 -0800 Subject: [Edu-sig] Many Laptops per Adult In-Reply-To: References: Message-ID: Yes lots of excitement about booting from flash sticks, makes the laptop itself the peripheral, might have no OS at all when powered down, takes on "personality" of whichever stick. Nadine of Friends Peace Teams, doing AVP in Aceh, right through the Tsunami chapter, was all aglow about memory sticks when I saw her in Portland, thinking at least she'd be free of all those viruses and slow poke machines, hampered with cruft, trojans, mostly zombies by the time she gets to 'em.[1] My own DWA / 4D has: Satellite Toshiba x1 (x2 counting mom's when she's around, plus she has a Sony Vaio which I'm not counting); OLPC XO x2; Ubuntu Dell laptops x2; various PC desktops x4 (3 in office, one for Spores etc., working on Spores-based Cockfight! concept, an alternative to violence against chickens (roosters), with real money bets possible, more on Wanderers Yahoo! list (have to knock to get in)). I take different laptops to work depending on whom I'm trying to impress. If it's OSCON, take the Ubuntu Dell and rotate the Compix cube because that's what Miguel de Icaza does and everyone claps (when I do it they stare politely -- need more jokes). When I go to some other gigs, I only take Windows because Linux is still scary to them, as is Python. You have to understand that North Americans live in a state of abject fear, brought on by television and misinformation in the schools. Anything "Linux" or "GNU" means "hacker" and that's just too scary to talk about. The other device we might power up with different memory, depending on driver, is the "Bizmo" or business mobile, a van or bus or even SUV sized vehicle that's designed to keep the busy cube farmer in touch with her workplace, plus offers a meeting space and the ability to put on a circus, if caravaning with others (my preferred model -- unless the culture is biased against anything "gypsy" in which case split up, don't attract attention). Truckers are already very familiar with the "bizmo" cab concept, as they make their livelihoods on the road, just aren't geeks in the same way, so have to haul freight, whereas I'm hauling access to future career possibilities, showing up in schools to signal a bright future (that's the storyboard -- so far just using Razz, a "clown car" (Portland has lots of clown cars [2])). Think of flying into a remote city, going to your company's garage or lot, and checking out a bizmo (like a laptop), and installing your favorite, customized software. Ulmer (not Urner -- different dude), a full time bizmo guy, invented geocaching, uses his software to find ghost towns and mine shafts in the North American southwest.[3] Others would have other goals. Thanks to the separation of hardware from software, you don't have to specialize the fleet too much, just what's on the memory sticks. Science fiction I realize but I think we're moving in this direction, based on what I see in the tea leaves. Kirby [1] http://worldgame.blogspot.com/2008/03/peace-teams.html (Nadine et al) [2] http://mybizmo.blogspot.com/search?q=Razz ( = Subaru Bizmo) [3] http://controlroom.blogspot.com/2005/12/we-win.html (Ulmer, click link for details (not current, but gives the idea)) On Sun, Jan 11, 2009 at 6:23 AM, gerry_lowry (alliston ontario canada) wrote: > If the idea is shared laptops, probably a single laptop configuration would suffice for the following reasons: > -- it's likely that most adults are barely competent to configure an operating systems > -- "administrators" need to be able to maintain the revolving door laptops with minimal, consistent effort > -- hard disks tend to be of sufficient size to host multiple operating systems > -- someone grabbed the Ubuntu laptop but she/he needed the Windows laptop for________________ (fill in) > -- someone needed the Ubuntu laptop but it was unfortunately already checked out > -- individual's need to control their own data > -- more efficient would be a single laptop to update perhaps by dropping a new image of a virtual configuration set > -- a smaller pool of laptops would be required per "team" of shared users since all laptops would have a shared configuration > > No matter what, some end-user training would be required to explain how to use whatever laptop > the adult was checking out ... therefore, with a SINGLE laptop, a SINGLE instruction > booklet would require one extra section explaining how to boot into one's required environment. > > Shared data (e.g. a slide presentation) could reside in a common folder on each "team" laptop. > > USB flash drives are relatively inexpensive, hence individuals would keep their unique files > on their own USB flash drive. > > > > > g. > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From Scott.Daniels at Acm.Org Sun Jan 11 19:38:24 2009 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Sun, 11 Jan 2009 10:38:24 -0800 Subject: [Edu-sig] Many Laptops per Adult In-Reply-To: References: Message-ID: gerry_lowry (alliston ontario canada) wrote: > If the idea is shared laptops, probably a single laptop configuration would suffice for the following reasons: > .... That's a very nice idea, as long as you figure out how to make me right-handed, convert my eyes to 20-20, and fix my former colleague's color-blindness. Some customization is (or should be) portable, and it is, in fact, necessary. When I was younger, I used the smallest font that I could read, in order to get the most letters on the screen. In essence I do that now, by choosing a high-resolution display and picking a font carefully for legibility. The letters are larger now in absolute terms, and _much_ larger in pixels, so I suffer with web pages and applications that think they know what size text takes. "One size fits all" is short for "one size fits all that fit." --Scott David Daniels Scott.Daniels at Acm.Org From gerry.lowry at abilitybusinesscomputerservices.com Sun Jan 11 20:08:21 2009 From: gerry.lowry at abilitybusinesscomputerservices.com (gerry_lowry (alliston ontario canada)) Date: Sun, 11 Jan 2009 14:08:21 -0500 Subject: [Edu-sig] Many Laptops per Adult References: Message-ID: <3C9BCABA6A52495297A20B7CB0C77976@zentrumvegan> Scott, regarding your vision problems, from your e-mail header, it looks like you're using the virus a.k.a. Windows (User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)). Me too. My bread and soy butter world is Gates based. Windows has options to help your text reading: -- I prefer ZoomIt (http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx) -- under Programs, Accessories, Accessibility, you'll find the Magnifier applet. -- with Internet Explorer you can change text size via the View Menu (success here is sometimes suppressed by the individual web page's internal structure) -- Firefox 3 has a Zoom Menu which behaves similar to ZoomIt with the Firefox window. Linux and other O/S's likely have tools akin to ZoomIt and Magnifier. (Fortunately for me, I'm very near sighted, so I just have to move things closer to my eyeballs.) Sinister Scott, I too am left handed .... not a problem with most laptops. Sucks for hammers, though. B-) Scott, I did not say to avoid customization ~~ remember, however, we are talking SHARED laptops here. When I wrote "probably a single laptop configuration would suffice", I'm talking some form of multi-boot or equivalent. Because today's hard disks are relatively large, it's possible to easily configure a single laptop to run more than a few operating systems. -- As for your former colleague's colour-blindness, while likely not fixable, those with a basic understanding of accessiblity issues will design for issues like blindness, colour blindness, hearing loss, et cetera. Of course, not every disability will be easily supported. Those will advanced forms of paralysis will be disadvantaged in our current world as will fully blind persons. CUSTOMIZATION POSSIBILITIES =========================== Not only can a USB flash drive have one's private data, it could also store individual profiles and other methods of customization. See also kirby's response. regards ~~ gerry From kirby.urner at gmail.com Sun Jan 11 20:26:46 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 11 Jan 2009 11:26:46 -0800 Subject: [Edu-sig] Many Laptops per Adult In-Reply-To: <3C9BCABA6A52495297A20B7CB0C77976@zentrumvegan> References: <3C9BCABA6A52495297A20B7CB0C77976@zentrumvegan> Message-ID: Like with my Ubuntu Dell, I have MySQL which I access in a terminal window (people call that non-GUI but of course the window itself is an animation, even wiggles, has a frame rate (desktop is OpenGL)), then I go > manage.py runserver or whatever it is and get the Django thing going on 127.0.0.1:8000, after which we start poking around in Mathy, my database of mvp mathematicians, very tiny so far, and not all Latin-1 by any stretch of the imagination. I have an Optoma projector, am trying to sell local schools (like Cleveland and Grant) on the idea they need an in-house Django database as a part of math class, student-designed and run, similar to the one I'm showing. Yes, that means teaching about regular expressions and DOM (document object model) maybe instead of so much time on factoring polynomials, repeating the same poopka year to year, degeniusing them, making them think it's all way harder than it is (the first step towards having a docile population, ready for Bud + NFL). I took 'Idiocracy' to Vilnius that time, to explain our culture. Here's the opening screen: http://www.flickr.com/photos/17157315 at N00/1023081047/in/set-72157601248882665/ (conference venue, Reval Hotel, Vilnius). Speaking of Django, I'm running a Subversion version and still don't see Microsoft SQL Server as an option, just flavors of Postgres, MySQL, and Oracle. Patrick leans strongly towards Oracle with an "all you can eat" license. Maybe some folks here have war stories about Django? I posted this query to my local group, but the only nibble so far is from Dylan, who thinks my idea of doing all reports as PDFs is kinda stupid: http://mail.python.org/pipermail/portland/2009-January/000542.html Kirby Related reading @ Math Forum: http://mathforum.org/kb/thread.jspa?threadID=1879421&tstart=0 (last three paragraphs about Django), also mention Ian Benson again (someone I met at the last Pycon, high up in UK curriculum writing, here's a page on the guy): http://tizard.stanford.edu/groups/sociality/wiki/d4276/Visiting_Professorship_(Kingston_University).html From kirby.urner at gmail.com Mon Jan 12 17:33:14 2009 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 12 Jan 2009 08:33:14 -0800 Subject: [Edu-sig] python teacher = mathematics teacher (namespace) Message-ID: I get emails from math teachers in training sometimes, wanted to run by an excerpt of a recent reply. The math guy writing me says: """ My name is ____________, I'm currently training to be a maths teacher in the UK. I have a degree in maths and program as a hobby. For my PGCE I'm required to write a masters level assignment and I've decided I want to research into how python can be used to teach mathematics to 11-16 year old children. I'm very much impressed with your existing work and will be studying it closely. I was wondering, however, if you would be able to point me in the direction of other work done in the field (if there is any), since I have only been able to find work by yourself. """ Some of what I wrote back was: """ -----Original Message----- From: Kirby Urner [mailto:urnerk at qwest.net] Sent: Sunday, January 11, 2009 12:28 PM To: [ math guy ] Subject: RE: Python and Mathematics research There's something of a nomenclature issue in that I'd say anyone teaching Python is teaching mathematics, as executable notations are what Leibniz had in mind, and Ada Byron was thinking Bernoulli numbers etc., i.e. from the beginning, a programmable computer has been the "piano forte" of mathematics, going through many iterations to where now you don't have to be big industry to employ professional math people, various types of computer scientist, to operate them. I would look to Kenneth Iverson for strong articulations of this viewpoint, and Roger Hui's work in the J language for how math teaching (of traditional topics) is accomplished through that language, as Python's emergence in this field somewhat along the same lines. If you go back to the start of the Edu-Sig archives, where I do most of this work, you'll find Tim Peters and Arthur Siegal using a math-through-programming approach. Tim cites 'Concrete Mathematics', Knuth a co-author, and similar to 'The Book of Numbers' in some ways (what Iverson-Hui take on). Siegal is doing projective geometry with Pygeo, which I think you'll still find, c/o his estate. I work with Ian Benson, a top curriculum writer in the UK, who is very connected in the Python community. Although Python itself is open source, a lot of private sector business do curriculum writing for profit, so some of these efforts aren't going to feature in academic papers. http://tizard.stanford.edu/groups/sociality/wiki/d4276/Visiting_Professorship_(Kingston_University).html I gave a talk to London Knowledge Lab on how I do Python, which you may be interested in, also my Chicago talk at Pycon last year drew large crowds, expecting even more this year, plus I have 3 hours this time [ and blah blah ] http://www.bfi.org/our_programs/bfi_community/python http://blog.showmedo.com/2008/07/30/your-pythonic-math-class-of-the-future-chicago-pycon-screencast/ Kirby """ So the way I'm thinking of it, we're all math teachers if we teach Python, a live (executable) math notation (MN) for implementing logic-numeric solutions to problems. We've been trained, especially in the Anglophone tradition, to maintain all these sharp turf lines, such that we might be computer scientists in some way, but even there, we're supposed to respect these various record locking schemes based on degrees and such claptrap. Mathematics is something removed from our purview and relegated to some elite that maybe only uses paper and pencil (or so "they" like to pretend -- many use Mathematica or MathCad most of the time i.e. live MNs, just as we do). Now that the concept of "namespace" has reached some maturity, I think it's easy to explain that namespaces differ in how they use key words (like "maths") and equating describing Python teaching or programming in general as mathematics is maybe not university-speak, but consistency in design is what we're looking for, not necessarily the approval of Oxbridge dons or whatever gowned authorities. So, on with the math teaching! Kirby PS: some of you may have wondered about my "Cockfight!" allusion, saying one of my computers was set aside for that purpose. It's just a concept. I'm not able to write a game as sophisticated as Spore coming from a tiny office with only a few partners, most of whom have other day jobs as well. I clarify this humble truth in my blog this morning, with a link back to this list. http://controlroom.blogspot.com/2009/01/cockfight.html From gregor.lingl at aon.at Mon Jan 12 22:24:29 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Mon, 12 Jan 2009 22:24:29 +0100 Subject: [Edu-sig] python teacher = mathematics teacher (namespace) In-Reply-To: References: Message-ID: <496BB50D.2060204@aon.at> kirby urner schrieb: > ... > If you go back to the start of the Edu-Sig archives, where I do most > of this work, you'll find Tim Peters and Arthur Siegal using a > math-through-programming approach. Hi Kirby, I do strongly sympathize with your approach to this question - alas: in contrast to most of my students (of math), which do not because of the same reason they do not like to play the piano, even if they like to hear piano playing. Nevertheless I think, that not only executable notations have to be correct but also the notations of people's names (in pythonista's namespace) - even if they are not alive anymore. Arthur Siegel was a very vivid and exiting (sometimes excited) opponent in discussions with you and therefore I'm sure that you will miss him a lot. He deserves to be cited by his correct name. I expect to visit chicago too this year and I hope to have the opportunity to meet you there and also to find a tiny place in the ever growing crowd that will be listening to your presentation. Regards, Gregor P. S.: notwithstanding the overall appropriateness of your comparison there is perhaps special difference between the world of mathematics and the world of electronic computing. Supposed that proofs of mathematical theorems are at the heart of mathematicians' output, those proofs *have* to be correct. On the other hand - as far as I was told and what I experienced - there are very few substantial computer programs which are correct (i. e. bugfree). > Tim cites 'Concrete Mathematics', > Knuth a co-author, and similar to 'The Book of Numbers' in some ways > (what Iverson-Hui take on). Siegal is doing projective geometry with > Pygeo, which I think you'll still find, c/o his estate. > > I work with Ian Benson, a top curriculum writer in the UK, who is very > connected in the Python community. > > Although Python itself is open source, a lot of private sector > business do curriculum writing for profit, so some of these efforts > aren't going to feature in academic papers. > > http://tizard.stanford.edu/groups/sociality/wiki/d4276/Visiting_Professorship_(Kingston_University).html > > I gave a talk to London Knowledge Lab on how I do Python, which you > may be interested in, also my Chicago talk at Pycon last year drew > large crowds, expecting even more this year, plus I have 3 hours this > time [ and blah blah ] > > http://www.bfi.org/our_programs/bfi_community/python > > http://blog.showmedo.com/2008/07/30/your-pythonic-math-class-of-the-future-chicago-pycon-screencast/ > > Kirby > """ > > So the way I'm thinking of it, we're all math teachers if we teach > Python, a live (executable) math notation (MN) for implementing > logic-numeric solutions to problems. We've been trained, especially > in the Anglophone tradition, to maintain all these sharp turf lines, > such that we might be computer scientists in some way, but even there, > we're supposed to respect these various record locking schemes based > on degrees and such claptrap. Mathematics is something removed from > our purview and relegated to some elite that maybe only uses paper and > pencil (or so "they" like to pretend -- many use Mathematica or > MathCad most of the time i.e. live MNs, just as we do). > > Now that the concept of "namespace" has reached some maturity, I think > it's easy to explain that namespaces differ in how they use key words > (like "maths") and equating describing Python teaching or programming > in general as mathematics is maybe not university-speak, but > consistency in design is what we're looking for, not necessarily the > approval of Oxbridge dons or whatever gowned authorities. > > So, on with the math teaching! > > Kirby > > PS: some of you may have wondered about my "Cockfight!" allusion, > saying one of my computers was set aside for that purpose. It's just > a concept. I'm not able to write a game as sophisticated as Spore > coming from a tiny office with only a few partners, most of whom have > other day jobs as well. I clarify this humble truth in my blog this > morning, with a link back to this list. > > http://controlroom.blogspot.com/2009/01/cockfight.html > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > > From vceder at canterburyschool.org Mon Jan 12 23:19:21 2009 From: vceder at canterburyschool.org (Vern Ceder) Date: Mon, 12 Jan 2009 17:19:21 -0500 Subject: [Edu-sig] Edu-sig BoF at PyCon Message-ID: <496BC1E9.1000001@canterburyschool.org> It seems to me that it's time to start talking about what we'll do at PyCon. I'm assuming we'll want a space for a BoF meeting, as well as maybe going out dinner at least one night. Any thoughts? I've created an OpenSpace page on the PyCon09 site. the URL is http://us.pycon.org/2009/openspace/EduSig/ Once you create a site account (which you'll need to do to register anyway) you can edit it and your own info and suggestions. Cheers, Vern -- This time for sure! -Bullwinkle J. Moose ----------------------------- Vern Ceder, Director of Technology Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804 vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137 From andre.roberge at gmail.com Mon Jan 12 23:40:04 2009 From: andre.roberge at gmail.com (Andre Roberge) Date: Mon, 12 Jan 2009 18:40:04 -0400 Subject: [Edu-sig] Edu-sig BoF at PyCon In-Reply-To: <496BC1E9.1000001@canterburyschool.org> References: <496BC1E9.1000001@canterburyschool.org> Message-ID: <7528bcdd0901121440q3641c422m40cf00f547e7b47a@mail.gmail.com> On Mon, Jan 12, 2009 at 6:19 PM, Vern Ceder wrote: > It seems to me that it's time to start talking about what we'll do at PyCon. > > I'm assuming we'll want a space for a BoF meeting, as well as maybe going > out dinner at least one night. > > Any thoughts? > > I've created an OpenSpace page on the PyCon09 site. the URL is > http://us.pycon.org/2009/openspace/EduSig/ > Thanks for doing this. I'll be there for sure! (just to as to put additional pressure on myself: ) Expect a new cool demo from me! :-) Andr? > Once you create a site account (which you'll need to do to register anyway) > you can edit it and your own info and suggestions. > > Cheers, > Vern > > -- > This time for sure! > -Bullwinkle J. Moose > ----------------------------- > Vern Ceder, Director of Technology > Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804 > vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137 > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From kirby.urner at gmail.com Mon Jan 12 23:54:35 2009 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 12 Jan 2009 14:54:35 -0800 Subject: [Edu-sig] python teacher = mathematics teacher (namespace) In-Reply-To: <496BB50D.2060204@aon.at> References: <496BB50D.2060204@aon.at> Message-ID: Hi Gregor -- I appreciate your fixing for the record my spelling of Arthur's last name (Siegel, not Siegal). I actually double checked, did all that "making sure" behavior before hitting the send button, and *still* got it wrong. I even reread his obituary in the NYT, though didn't include the link in my email. Here it is: http://query.nytimes.com/gst/fullpage.html?res=9B0DE7DD163AF930A35751C0A9619C8B63 For those joining us recently, Arthur was a voluminous contributor to this list, someone I also knew in person, my last dinner with him, David Lansky and the latter's two boys (another Ben) was a joyous occasion. He loved passionate argument, was very good at it. Yes Gregor, I'm very much looking forward to meeting you. The tutorial format is my playing "nutty professor" with Holden keeping me on track (I tend to wander, but within a discrete set of topics). My goal is to have something useful to anyone teaching Python as a part of their job, not just in academia, using a "already doing this with kids" backdrop in Portland i.e. realistic futurism. And in actual fact, I'll be flying home to start teaching at Saturday Academy right after the conference. Regarding the difference between maths and computer science when it comes to proofs, both boil down to ultimate incompleteness ** i.e. there's no way to prove everything, so bootstrapping the system involves things *other than* provable inputs (same as with any language), and these inputs vary from namespace to namespace. For example, we're brow beaten in grade school into accepting that "space is 3D", but in Portland we use counter-arguments to box that way of thinking into a namespace, next to which we present others, just as valid. Here's a link to my recent essay on precisely this topic FYI (copy at Math Forum later today): http://worldgame.blogspot.com/2009/01/proposal-re-dimension.html See you soon, Kirby ** re Incompleteness: http://controlroom.blogspot.com/2007/05/incompleteness.html (about one of the world's chief Godel scholars) On Mon, Jan 12, 2009 at 1:24 PM, Gregor Lingl wrote: > > > kirby urner schrieb: >> >> ... >> If you go back to the start of the Edu-Sig archives, where I do most >> of this work, you'll find Tim Peters and Arthur Siegal using a >> math-through-programming approach. > > Hi Kirby, > > I do strongly sympathize with your approach to this question - alas: in > contrast > to most of my students (of math), which do not because of the same reason > they do not like to play the piano, even if they like to hear piano playing. > > Nevertheless I think, that not only executable notations have to be correct > but > also the notations of people's names (in pythonista's namespace) - even if > they > are not alive anymore. > > Arthur Siegel was a very vivid and exiting (sometimes excited) opponent > in discussions with you and therefore I'm sure that you will miss him a lot. > He deserves to be cited by his correct name. > > I expect to visit chicago too this year and I hope to have the opportunity > to > meet you there and also to find a tiny place in the ever growing crowd that > will be listening to your presentation. > > Regards, > Gregor > > P. S.: notwithstanding the overall appropriateness of your comparison there > is perhaps special difference between the world of mathematics and the world > of electronic computing. Supposed that proofs of mathematical theorems are > at > the heart of mathematicians' output, those proofs *have* to be correct. > On the other hand - as far as I was told and what I experienced - there are > very few substantial computer programs which are correct (i. e. bugfree). >> >> Tim cites 'Concrete Mathematics', >> Knuth a co-author, and similar to 'The Book of Numbers' in some ways >> (what Iverson-Hui take on). Siegal is doing projective geometry with >> Pygeo, which I think you'll still find, c/o his estate. >> >> I work with Ian Benson, a top curriculum writer in the UK, who is very >> connected in the Python community. >> >> Although Python itself is open source, a lot of private sector >> business do curriculum writing for profit, so some of these efforts >> aren't going to feature in academic papers. >> >> >> http://tizard.stanford.edu/groups/sociality/wiki/d4276/Visiting_Professorship_(Kingston_University).html >> >> I gave a talk to London Knowledge Lab on how I do Python, which you >> may be interested in, also my Chicago talk at Pycon last year drew >> large crowds, expecting even more this year, plus I have 3 hours this >> time [ and blah blah ] >> >> http://www.bfi.org/our_programs/bfi_community/python >> >> >> http://blog.showmedo.com/2008/07/30/your-pythonic-math-class-of-the-future-chicago-pycon-screencast/ >> >> Kirby >> """ >> >> So the way I'm thinking of it, we're all math teachers if we teach >> Python, a live (executable) math notation (MN) for implementing >> logic-numeric solutions to problems. We've been trained, especially >> in the Anglophone tradition, to maintain all these sharp turf lines, >> such that we might be computer scientists in some way, but even there, >> we're supposed to respect these various record locking schemes based >> on degrees and such claptrap. Mathematics is something removed from >> our purview and relegated to some elite that maybe only uses paper and >> pencil (or so "they" like to pretend -- many use Mathematica or >> MathCad most of the time i.e. live MNs, just as we do). >> >> Now that the concept of "namespace" has reached some maturity, I think >> it's easy to explain that namespaces differ in how they use key words >> (like "maths") and equating describing Python teaching or programming >> in general as mathematics is maybe not university-speak, but >> consistency in design is what we're looking for, not necessarily the >> approval of Oxbridge dons or whatever gowned authorities. >> >> So, on with the math teaching! >> >> Kirby >> >> PS: some of you may have wondered about my "Cockfight!" allusion, >> saying one of my computers was set aside for that purpose. It's just >> a concept. I'm not able to write a game as sophisticated as Spore >> coming from a tiny office with only a few partners, most of whom have >> other day jobs as well. I clarify this humble truth in my blog this >> morning, with a link back to this list. >> >> http://controlroom.blogspot.com/2009/01/cockfight.html >> _______________________________________________ >> Edu-sig mailing list >> Edu-sig at python.org >> http://mail.python.org/mailman/listinfo/edu-sig >> >> >> > From kirby.urner at gmail.com Wed Jan 14 00:42:24 2009 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 13 Jan 2009 15:42:24 -0800 Subject: [Edu-sig] news and views from Rams Head (PDX) Message-ID: News: Ian is promoting my Chicago talk, lots of details, feel free to link to this page if sharing with others, in addition to whatever official Pycon literature: http://mentor.sociality.tv/groups/pycontest/wiki/20372/Python_for_Teachers.html I did some good work with the XO today, working for 4D Studios: http://worldgame.blogspot.com/2009/01/saving-children.html Maths: I've got Midhat Gazale's 'Number' out from Multnomah Library again, wanting to get his "cardination" versus "ordination" distinction more clearly, been relying on memory. Cardination: establishment of one-to-one correspondence, or matching, "consists of pairing objects or groups of objects". "Nomen est numen" says the Latin adage (pg 11), meaning that to name is to know. Link to "right brain" for heuristical purposes. Ordination: i.e. counting, requires a notion of succession or sequence, Latin root "computare" (compter, conter). "According to studies conducted by Charles J. Brainerd and others, the faculty of ordination (establishing an asymmetrical relation of transitivity between three balls of increasing weight, or three sticks of increasing length **) is more fundamental than that of cardination or matching. Page 14: Says Tobias Dantzig, "Correspondence and succession, the two principles permeate all mathematics -- nay, all realms of exact thought -- are woven into the very fabric of number system."2 For all we know, and that does not amount to much, they are perhaps woven into the very fabric of our brain hemispheres... My comments: philosophically, "ordination" relates to "ranking" i.e. better versus worse, as in "the fall" into good versus evil (knowlege of). Cardination is "beyond good and evil" (more primitive than) in the sense of "noticing differences without judgment" e.g. in Python we have the integer type, string type, fraction type, but don't have to say "which we like better" (give some better examples?). All moral judgments aside, there's also the obvious hierarchy of "containership" as in "what contains what". We say Q > Z (rationals > integers) because the set of all rationals *contains* the set of all integers. This takes us to the ancient greek concept of "atoms" i.e. "that which everything contains" (relates to later talk of bosons, leptons etc.). Another obvious source of sequencing or ordination (left brain in Midhat's analogy) is temporal, what happens *after* or *before* what else in some given scenario. N < W < Z < Q < R < C is likewise temporal, especially if we use Roman Numerals to illustrate N, add zero from Baghdad (Algebra City) via Fibonacci of Pisa, to get W, then Z. My thanks to Juaquin, Ram's Head (McMenamins), for a fantastic lunch, complete with Bloody Mary. I'm on chauffeur duty for Quakers, one of my several routine gigs. Kirby Cc: 4dsp ** a nod to Gattegno, also Egyptian http://www.internationalpubmarket.com/clients/auc/books/AuthorDetail.aspx?id=9490 http://www.linkedin.com/pub/5/b9/308 From kirby.urner at gmail.com Thu Jan 15 05:13:50 2009 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 14 Jan 2009 20:13:50 -0800 Subject: [Edu-sig] Pythonic Math must include... Message-ID: Candidates: "Must include" would be like an intersection of many sets in a Venn Diagram, where we all gave our favorite movies and a very few, such as 'Bagdad Cafe' or 'Wendy and Lucy' or... proved common to us all (no suggesting those'd be -- just personal favorites). In this category, three candidates come to mind right away: Guido's for the gcd: def gcd(a,b): while b: a, b = b, a % b return a Then two generics we've all seen many times, generators for Pascal's Triangle and Fibonacci Sequence respectively: def pascal(): """ Pascal's Triangle ** """ row = [1] while True: yield row row = [ a + b for a, b in zip( [0] + row, row + [0] ) ] and: def fibonacci(a=0, b=1): while True: yield a a, b = a + b, a IDLE 1.2.1 >>> from first_steps import * >>> gcd(51, 34) 17 >>> g = pascal() >>> g.next() [1] >>> g.next() [1, 1] >>> g.next() [1, 2, 1] >>> g.next() [1, 3, 3, 1] >>> f = fibonacci() >>> f.next() 0 >>> f.next() 1 >>> f.next() 1 >>> f.next() 2 >>> f.next() 3 >>> f.next() 5 Check 'em out in kid-friendly Akbar font (derives from Matt Groening of Simpsons fame): http://www.wobblymusic.com/groening/akbar.html http://www.flickr.com/photos/17157315 at N00/3197681869/sizes/o/ ( feel free to link or embed in your gnu math website ) I'm not claiming these are the only ways to write these. I do think it's a feature, not a bug, that I'm eschewing recursion in all three. Will get to that later, maybe in Scheme just like the Scheme folks would prefer (big lambda instead of little, which latter I saw put to good use at PPUG last night, well attended (about 30)). http://mybizmo.blogspot.com/2009/01/ppug-2009113.html Rationale: In terms of curriculum, these belong together for a host of reasons, not just that we want students to use generators to explore On-Line Encyclopedia of Integer Sequences type sequences. Pascal's Triangle actually contains Fibonaccis along successive diagonals but more important we're laying the foundation for figurate and polyhedral ball packings ala The Book of Numbers, Synergetics, other late 20th century distillations (of math and philosophy respectively). Fibonaccis converge to Phi i.e. (1 + math.sqrt(5) )/2. gcd will be critical in our relative primality checks, leading up to Euler's Theorem thence RSA, per the review below (a literature search from my cube at CubeSpace on Grand Ave): http://cubespacepdx.com/ http://mathforum.org/kb/thread.jspa?threadID=1885121&tstart=0 http://www.flickr.com/photos/17157315 at N00/3195148912/ Remember, every browser has SSL, using RSA for handshaking, so it's not like we're giving them irrelevant info. Number theory goes into every DirecTV box thanks to NDS, other companies making use of this powerful public method.^^ You should understand, as a supermarket manager or museum administrator, something about encryption, security, what's tough to the crack and what's not. The battle to make RSA public property was hard won, so it's not like our public school system is eager to surrender it back to obscurity. Student geek wannabes perk up at the thought of getting how this works, not hard to show in Javascript and/or Python. Makes school more interesting, to be getting the low-down. By the same token, corporate trainers not having the luxury of doing the whole nine yards in our revamped grades 8-12, have the ability to excerpt specific juicy parts for the walk of life they're in. Our maths have a biological flavor, thanks to Spore, thanks to Sims. We do a Biotum class almost right away ("Hello World" is maybe part of it's __repr__ ?). I'm definitely tilting this towards the health professions, just as I did our First Person Physics campaign (Dr. Bob Fuller or leader, University of Nebraska emeritus). The reason for using bizarre charactersets in the group theory piece is we want to get their attention off numbers and onto something more generic, could be pictograms, icons, pictures of vegetables... Feedback welcome, Kirby ** http://www.flickr.com/photos/17157315 at N00/3198473850/sizes/l/ ^^ http://www.allbusiness.com/media-telecommunications/telecommunications/5923555-1.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From mpaul213 at gmail.com Thu Jan 15 15:35:32 2009 From: mpaul213 at gmail.com (michel paul) Date: Thu, 15 Jan 2009 06:35:32 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: References: Message-ID: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> I like this. I think another 'must include' for math classes would be list comprehension syntax. Not an algorithm in itself, but an important way of thinking. It's what we try to get them to do using set notation, but in math classes it seems simply like a formality for describing domains, nothing more. In Python, it DOES stuff. - Michel 2009/1/14 kirby urner > Candidates: > > "Must include" would be like an intersection of many sets in a Venn > Diagram, where we all gave our favorite movies and a very few, such as > 'Bagdad Cafe' or 'Wendy and Lucy' or... proved common to us all (no > suggesting those'd be -- just personal favorites). > > In this category, three candidates come to mind right away: > > Guido's for the gcd: > > def gcd(a,b): > while b: > a, b = b, a % b > return a > > Then two generics we've all seen many times, generators for Pascal's > Triangle and Fibonacci Sequence respectively: > > def pascal(): > """ > Pascal's Triangle ** > """ > row = [1] > while True: > yield row > row = [ a + b for a, b in zip( [0] + row, row + [0] ) ] > > and: > > def fibonacci(a=0, b=1): > while True: > yield a > a, b = a + b, a > > IDLE 1.2.1 > >>> from first_steps import * > >>> gcd(51, 34) > 17 > >>> g = pascal() > >>> g.next() > [1] > >>> g.next() > [1, 1] > >>> g.next() > [1, 2, 1] > >>> g.next() > [1, 3, 3, 1] > >>> f = fibonacci() > >>> f.next() > 0 > >>> f.next() > 1 > >>> f.next() > 1 > >>> f.next() > 2 > >>> f.next() > 3 > >>> f.next() > 5 > > Check 'em out in kid-friendly Akbar font (derives from Matt Groening of > Simpsons fame): http://www.wobblymusic.com/groening/akbar.html > > http://www.flickr.com/photos/17157315 at N00/3197681869/sizes/o/ > > ( feel free to link or embed in your gnu math website ) > > I'm not claiming these are the only ways to write these. I do think it's a > feature, not a bug, that I'm eschewing recursion in all three. Will get to > that later, maybe in Scheme just like the Scheme folks would prefer (big > lambda instead of little, which latter I saw put to good use at PPUG last > night, well attended (about 30)). > > http://mybizmo.blogspot.com/2009/01/ppug-2009113.html > > Rationale: > > In terms of curriculum, these belong together for a host of reasons, not > just that we want students to use generators to explore On-Line Encyclopedia > of Integer Sequences type sequences. Pascal's Triangle actually contains > Fibonaccis along successive diagonals but more important we're laying the > foundation for figurate and polyhedral ball packings ala The Book of > Numbers, Synergetics, other late 20th century distillations (of math and > philosophy respectively). Fibonaccis converge to Phi i.e. (1 + math.sqrt(5) > )/2. gcd will be critical in our relative primality checks, leading up to > Euler's Theorem thence RSA, per the review below (a literature search from > my cube at CubeSpace on Grand Ave): > > http://cubespacepdx.com/ > http://mathforum.org/kb/thread.jspa?threadID=1885121&tstart=0 > http://www.flickr.com/photos/17157315 at N00/3195148912/ > > Remember, every browser has SSL, using RSA for handshaking, so it's not > like we're giving them irrelevant info. Number theory goes into every > DirecTV box thanks to NDS, other companies making use of this powerful > public method.^^ > > You should understand, as a supermarket manager or museum administrator, > something about encryption, security, what's tough to the crack and what's > not. The battle to make RSA public property was hard won, so it's not like > our public school system is eager to surrender it back to obscurity. > Student geek wannabes perk up at the thought of getting how this works, not > hard to show in Javascript and/or Python. Makes school more interesting, to > be getting the low-down. > > By the same token, corporate trainers not having the luxury of doing the > whole nine yards in our revamped grades 8-12, have the ability to excerpt > specific juicy parts for the walk of life they're in. > > Our maths have a biological flavor, thanks to Spore, thanks to Sims. We do > a Biotum class almost right away ("Hello World" is maybe part of it's > __repr__ ?). I'm definitely tilting this towards the health professions, > just as I did our First Person Physics campaign (Dr. Bob Fuller or leader, > University of Nebraska emeritus). > > The reason for using bizarre charactersets in the group theory piece is we > want to get their attention off numbers and onto something more generic, > could be pictograms, icons, pictures of vegetables... > > Feedback welcome, > > Kirby > > > ** http://www.flickr.com/photos/17157315 at N00/3198473850/sizes/l/ > ^^ > http://www.allbusiness.com/media-telecommunications/telecommunications/5923555-1.html > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Thu Jan 15 15:47:25 2009 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 15 Jan 2009 06:47:25 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> Message-ID: Yes, note that my Pascal's includes it, with an embedded zip. Another place list comprehension comes up is in our naive definition of totatives as: def totative(n): return [ t for t in range(1, n) if gcd(t, n) == 1] i.e. all 0 < t < n such that (t, n) have no factors in common (are relatively prime). Then our totient function is simply the len of this list, giving us a quick way to assert (test) Euler's theorem: b ** totient(d) % d == 1 where gcd(b,d)==1. There's an easy enough proof in 'Number' by Midhat Gazale, a must have on our syllabus (I'm suggesting). Kirby On Thu, Jan 15, 2009 at 6:35 AM, michel paul wrote: > I like this. > > I think another 'must include' for math classes would be list comprehension > syntax. Not an algorithm in itself, but an important way of thinking. It's > what we try to get them to do using set notation, but in math classes it > seems simply like a formality for describing domains, nothing more. In > Python, it DOES stuff. > > - Michel > > 2009/1/14 kirby urner > >> Candidates: >> >> "Must include" would be like an intersection of many sets in a Venn >> Diagram, where we all gave our favorite movies and a very few, such as >> 'Bagdad Cafe' or 'Wendy and Lucy' or... proved common to us all (no >> suggesting those'd be -- just personal favorites). >> >> In this category, three candidates come to mind right away: >> >> Guido's for the gcd: >> >> def gcd(a,b): >> while b: >> a, b = b, a % b >> return a >> >> Then two generics we've all seen many times, generators for Pascal's >> Triangle and Fibonacci Sequence respectively: >> >> def pascal(): >> """ >> Pascal's Triangle ** >> """ >> row = [1] >> while True: >> yield row >> row = [ a + b for a, b in zip( [0] + row, row + [0] ) ] >> >> and: >> >> def fibonacci(a=0, b=1): >> while True: >> yield a >> a, b = a + b, a >> >> IDLE 1.2.1 >> >>> from first_steps import * >> >>> gcd(51, 34) >> 17 >> >>> g = pascal() >> >>> g.next() >> [1] >> >>> g.next() >> [1, 1] >> >>> g.next() >> [1, 2, 1] >> >>> g.next() >> [1, 3, 3, 1] >> >>> f = fibonacci() >> >>> f.next() >> 0 >> >>> f.next() >> 1 >> >>> f.next() >> 1 >> >>> f.next() >> 2 >> >>> f.next() >> 3 >> >>> f.next() >> 5 >> >> Check 'em out in kid-friendly Akbar font (derives from Matt Groening of >> Simpsons fame): http://www.wobblymusic.com/groening/akbar.html >> >> http://www.flickr.com/photos/17157315 at N00/3197681869/sizes/o/ >> >> ( feel free to link or embed in your gnu math website ) >> >> I'm not claiming these are the only ways to write these. I do think it's >> a feature, not a bug, that I'm eschewing recursion in all three. Will get >> to that later, maybe in Scheme just like the Scheme folks would prefer (big >> lambda instead of little, which latter I saw put to good use at PPUG last >> night, well attended (about 30)). >> >> http://mybizmo.blogspot.com/2009/01/ppug-2009113.html >> >> Rationale: >> >> In terms of curriculum, these belong together for a host of reasons, not >> just that we want students to use generators to explore On-Line Encyclopedia >> of Integer Sequences type sequences. Pascal's Triangle actually contains >> Fibonaccis along successive diagonals but more important we're laying the >> foundation for figurate and polyhedral ball packings ala The Book of >> Numbers, Synergetics, other late 20th century distillations (of math and >> philosophy respectively). Fibonaccis converge to Phi i.e. (1 + math.sqrt(5) >> )/2. gcd will be critical in our relative primality checks, leading up to >> Euler's Theorem thence RSA, per the review below (a literature search from >> my cube at CubeSpace on Grand Ave): >> >> http://cubespacepdx.com/ >> http://mathforum.org/kb/thread.jspa?threadID=1885121&tstart=0 >> http://www.flickr.com/photos/17157315 at N00/3195148912/ >> >> Remember, every browser has SSL, using RSA for handshaking, so it's not >> like we're giving them irrelevant info. Number theory goes into every >> DirecTV box thanks to NDS, other companies making use of this powerful >> public method.^^ >> >> You should understand, as a supermarket manager or museum administrator, >> something about encryption, security, what's tough to the crack and what's >> not. The battle to make RSA public property was hard won, so it's not like >> our public school system is eager to surrender it back to obscurity. >> Student geek wannabes perk up at the thought of getting how this works, not >> hard to show in Javascript and/or Python. Makes school more interesting, to >> be getting the low-down. >> >> By the same token, corporate trainers not having the luxury of doing the >> whole nine yards in our revamped grades 8-12, have the ability to excerpt >> specific juicy parts for the walk of life they're in. >> >> Our maths have a biological flavor, thanks to Spore, thanks to Sims. We >> do a Biotum class almost right away ("Hello World" is maybe part of it's >> __repr__ ?). I'm definitely tilting this towards the health professions, >> just as I did our First Person Physics campaign (Dr. Bob Fuller or leader, >> University of Nebraska emeritus). >> >> The reason for using bizarre charactersets in the group theory piece is we >> want to get their attention off numbers and onto something more generic, >> could be pictograms, icons, pictures of vegetables... >> >> Feedback welcome, >> >> Kirby >> >> >> ** http://www.flickr.com/photos/17157315 at N00/3198473850/sizes/l/ >> ^^ >> http://www.allbusiness.com/media-telecommunications/telecommunications/5923555-1.html >> >> >> _______________________________________________ >> Edu-sig mailing list >> Edu-sig at python.org >> http://mail.python.org/mailman/listinfo/edu-sig >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vceder at canterburyschool.org Thu Jan 15 16:09:14 2009 From: vceder at canterburyschool.org (Vern Ceder) Date: Thu, 15 Jan 2009 10:09:14 -0500 Subject: [Edu-sig] Compiling Python 3 and 2.6 on Ubuntu Message-ID: <496F519A.4070200@canterburyschool.org> If anyone is interested in running Python 3 or Python 2.6 on Ubuntu Intrepid and having all the bits work, like Tkinter, etc. I've written up the process and and the needed packages for compiling from source on a blog post here... http://learnpython.wordpress.com/2009/01/14/installing-python-30-on-ubuntu/ If you're used to building things from source, it's fairly obvious, but with the rise of Ubuntu, more and more users are not so familiar with the process. Cheers, Vern -- This time for sure! -Bullwinkle J. Moose ----------------------------- Vern Ceder, Director of Technology Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804 vceder at canterburyschool.org; 260-436-0746; FAX: 260-436-5137 From macquigg at ece.arizona.edu Fri Jan 16 00:09:03 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Thu, 15 Jan 2009 16:09:03 -0700 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.co m> References: Message-ID: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study. Additional suggestions are welcome. -- Dave From gregor.lingl at aon.at Fri Jan 16 02:33:38 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Fri, 16 Jan 2009 02:33:38 +0100 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> Message-ID: <496FE3F2.1050004@aon.at> I'd like to suggest, that some sort of sieve could be included, for instance as a non very fancy example something like def primes(n): s = set(range(3,n+1,2)) if n >= 2: s.add(2) m=3 while m * m < n: s.difference_update(range(m*m, n+1, 2*m)) m += 2 while m not in s: m += 2 return sorted(s) (as a starting point), or something similar, a bit beautified or perhaps you know some different more concise solution ... An even more compact albeit slightly slower version would be: def primes(n): s = set(range(3,n+1,2)) for m in range(3, int(n**.5)+1, 2): s.difference_update(range(m*m, n+1, 2*m)) return [2]*(2<=n) + sorted(s) Or something in between. These are imho nice applications of the set type. Gregor kirby urner schrieb: > Yes, note that my Pascal's includes it, with an embedded zip. Another > place list comprehension comes up is in our naive definition of > totatives as: > > def totative(n): > return [ t for t in range(1, n) if gcd(t, n) == 1] > > i.e. all 0 < t < n such that (t, n) have no factors in common (are > relatively prime). Then our totient function is simply the len of > this list, giving us a quick way to assert (test) Euler's theorem: b > ** totient(d) % d == 1 where gcd(b,d)==1. There's an easy enough > proof in 'Number' by Midhat Gazale, a must have on our syllabus (I'm > suggesting). > > Kirby > > > On Thu, Jan 15, 2009 at 6:35 AM, michel paul > wrote: > > I like this. > > I think another 'must include' for math classes would be list > comprehension syntax. Not an algorithm in itself, but an > important way of thinking. It's what we try to get them to do > using set notation, but in math classes it seems simply like a > formality for describing domains, nothing more. In Python, it > DOES stuff. > > - Michel > > 2009/1/14 kirby urner > > > Candidates: > > "Must include" would be like an intersection of many sets in a > Venn Diagram, where we all gave our favorite movies and a very > few, such as 'Bagdad Cafe' or 'Wendy and Lucy' or... proved > common to us all (no suggesting those'd be -- just personal > favorites). > > In this category, three candidates come to mind right away: > > Guido's for the gcd: > > def gcd(a,b): > while b: > a, b = b, a % b > return a > > Then two generics we've all seen many times, generators for > Pascal's Triangle and Fibonacci Sequence respectively: > > def pascal(): > """ > Pascal's Triangle ** > """ > row = [1] > while True: > yield row > row = [ a + b for a, b in zip( [0] + row, row + [0] ) ] > > and: > > def fibonacci(a=0, b=1): > while True: > yield a > a, b = a + b, a > > IDLE 1.2.1 > >>> from first_steps import * > >>> gcd(51, 34) > 17 > >>> g = pascal() > >>> g.next() > [1] > >>> g.next() > [1, 1] > >>> g.next() > [1, 2, 1] > >>> g.next() > [1, 3, 3, 1] > >>> f = fibonacci() > >>> f.next() > 0 > >>> f.next() > 1 > >>> f.next() > 1 > >>> f.next() > 2 > >>> f.next() > 3 > >>> f.next() > 5 > > Check 'em out in kid-friendly Akbar font (derives from Matt > Groening of Simpsons fame): > http://www.wobblymusic.com/groening/akbar.html > > http://www.flickr.com/photos/17157315 at N00/3197681869/sizes/o/ > > ( feel free to link or embed in your gnu math website ) > > I'm not claiming these are the only ways to write these. I do > think it's a feature, not a bug, that I'm eschewing recursion > in all three. Will get to that later, maybe in Scheme just > like the Scheme folks would prefer (big lambda instead of > little, which latter I saw put to good use at PPUG last night, > well attended (about 30)). > > http://mybizmo.blogspot.com/2009/01/ppug-2009113.html > > Rationale: > > In terms of curriculum, these belong together for a host of > reasons, not just that we want students to use generators to > explore On-Line Encyclopedia of Integer Sequences type > sequences. Pascal's Triangle actually contains Fibonaccis > along successive diagonals but more important we're laying the > foundation for figurate and polyhedral ball packings ala The > Book of Numbers, Synergetics, other late 20th century > distillations (of math and philosophy respectively). > Fibonaccis converge to Phi i.e. (1 + math.sqrt(5) )/2. gcd > will be critical in our relative primality checks, leading up > to Euler's Theorem thence RSA, per the review below (a > literature search from my cube at CubeSpace on Grand Ave): > > http://cubespacepdx.com/ > http://mathforum.org/kb/thread.jspa?threadID=1885121&tstart=0 > > http://www.flickr.com/photos/17157315 at N00/3195148912/ > > Remember, every browser has SSL, using RSA for handshaking, so > it's not like we're giving them irrelevant info. Number > theory goes into every DirecTV box thanks to NDS, other > companies making use of this powerful public method.^^ > > You should understand, as a supermarket manager or museum > administrator, something about encryption, security, what's > tough to the crack and what's not. The battle to make RSA > public property was hard won, so it's not like our public > school system is eager to surrender it back to obscurity. > Student geek wannabes perk up at the thought of getting how > this works, not hard to show in Javascript and/or Python. > Makes school more interesting, to be getting the low-down. > > By the same token, corporate trainers not having the luxury of > doing the whole nine yards in our revamped grades 8-12, have > the ability to excerpt specific juicy parts for the walk of > life they're in. > > Our maths have a biological flavor, thanks to Spore, thanks to > Sims. We do a Biotum class almost right away ("Hello World" > is maybe part of it's __repr__ ?). I'm definitely tilting > this towards the health professions, just as I did our First > Person Physics campaign (Dr. Bob Fuller or leader, University > of Nebraska emeritus). > > The reason for using bizarre charactersets in the group theory > piece is we want to get their attention off numbers and onto > something more generic, could be pictograms, icons, pictures > of vegetables... > > Feedback welcome, > > Kirby > > > ** http://www.flickr.com/photos/17157315 at N00/3198473850/sizes/l/ > ^^ > http://www.allbusiness.com/media-telecommunications/telecommunications/5923555-1.html > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From kirby.urner at gmail.com Fri Jan 16 03:56:44 2009 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 15 Jan 2009 18:56:44 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <496FE3F2.1050004@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> Message-ID: Yes thank you I completely agree. A stash of sieves, plus data mine this very archive for our earlier work on this topic. My only suggestion is you include a generator version e.g.: Using Python 3: >>> g = Primes() >>> next(g) -1 >>> next(g) 2 >>> next(g) 3 >>> next(g) 5 etc. Generators are cool for any infinite sequence, be it convergent, divergent, oscillatory, or chaotic (finite too). That's Conway's thing about -1 being prime, feel free to ignore (or not -- see link). Bottom line is I'm encouraging us to have RSA in the final mix for Portland Public (e.g. LEP High and such), meaning we need: (a) Miller-Rabin or one of those for highly probably prime numbers (Jython gives direct access to math.BigInteger.probablePrime woo hoo! or just use my http://markmail.org/message/v43sry4svsvk5nli -- lots of help from Tim Peters which I'm still happy about) and (b) Euclid's extended algorithm (Guido's for the GCD being non-extended). EEA has other uses, Diophantine equations, continued fractions... Cut the Knot a good web site. In other words, in addition to a sieve, we'd like some callables to test and return (probable) primes (we're talking hundreds of digits in RSA world). Kirby Da links! http://www.cut-the-knot.org/blue/extension.shtml http://www.youtube.com/watch?v=4GxP9EVKCjo (for engineers) http://mathforum.org/library/drmath/view/54241.html http://www.informationsuebertragung.ch/indexAlgorithmen.html http://eprints.iisc.ernet.in/11336/ http://mathforum.org/kb/message.jspa?messageID=1093178&tstart=0 (conway.primes) http://mlblog.osdir.com/python.education/2002-08/msg00084.shtml (clever marketing) http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html#probablePrime(int,%20java.util.Random) On Thu, Jan 15, 2009 at 5:33 PM, Gregor Lingl wrote: > I'd like to suggest, that some sort of sieve could be included, > for instance as a non very fancy example something like > > def primes(n): > s = set(range(3,n+1,2)) > if n >= 2: s.add(2) > m=3 > while m * m < n: > s.difference_update(range(m*m, n+1, 2*m)) > m += 2 > while m not in s: m += 2 > return sorted(s) > > (as a starting point), or something similar, a bit beautified or > perhaps you know some different more concise solution ... > > An even more compact albeit slightly slower version would be: > > def primes(n): > s = set(range(3,n+1,2)) > for m in range(3, int(n**.5)+1, 2): > s.difference_update(range(m*m, n+1, 2*m)) > return [2]*(2<=n) + sorted(s) > > Or something in between. > These are imho nice applications of the set type. > > Gregor > > > > > kirby urner schrieb: >> >> Yes, note that my Pascal's includes it, with an embedded zip. Another >> place list comprehension comes up is in our naive definition of totatives >> as: >> >> def totative(n): >> return [ t for t in range(1, n) if gcd(t, n) == 1] >> >> i.e. all 0 < t < n such that (t, n) have no factors in common (are >> relatively prime). Then our totient function is simply the len of this >> list, giving us a quick way to assert (test) Euler's theorem: b ** >> totient(d) % d == 1 where gcd(b,d)==1. There's an easy enough proof in >> 'Number' by Midhat Gazale, a must have on our syllabus (I'm suggesting). >> >> Kirby >> >> >> On Thu, Jan 15, 2009 at 6:35 AM, michel paul > > wrote: >> >> I like this. >> >> I think another 'must include' for math classes would be list >> comprehension syntax. Not an algorithm in itself, but an >> important way of thinking. It's what we try to get them to do >> using set notation, but in math classes it seems simply like a >> formality for describing domains, nothing more. In Python, it >> DOES stuff. >> >> - Michel >> >> 2009/1/14 kirby urner > > >> >> Candidates: >> >> "Must include" would be like an intersection of many sets in a >> Venn Diagram, where we all gave our favorite movies and a very >> few, such as 'Bagdad Cafe' or 'Wendy and Lucy' or... proved >> common to us all (no suggesting those'd be -- just personal >> favorites). >> >> In this category, three candidates come to mind right away: >> >> Guido's for the gcd: >> >> def gcd(a,b): >> while b: >> a, b = b, a % b >> return a >> >> Then two generics we've all seen many times, generators for >> Pascal's Triangle and Fibonacci Sequence respectively: >> >> def pascal(): >> """ >> Pascal's Triangle ** >> """ >> row = [1] >> while True: >> yield row >> row = [ a + b for a, b in zip( [0] + row, row + [0] ) ] >> >> and: >> >> def fibonacci(a=0, b=1): >> while True: >> yield a >> a, b = a + b, a >> >> IDLE 1.2.1 >>> from first_steps import * >> >>> gcd(51, 34) >> 17 >> >>> g = pascal() >> >>> g.next() >> [1] >> >>> g.next() >> [1, 1] >> >>> g.next() >> [1, 2, 1] >> >>> g.next() >> [1, 3, 3, 1] >> >>> f = fibonacci() >> >>> f.next() >> 0 >> >>> f.next() >> 1 >> >>> f.next() >> 1 >> >>> f.next() >> 2 >> >>> f.next() >> 3 >> >>> f.next() >> 5 >> >> Check 'em out in kid-friendly Akbar font (derives from Matt >> Groening of Simpsons fame): >> http://www.wobblymusic.com/groening/akbar.html >> >> http://www.flickr.com/photos/17157315 at N00/3197681869/sizes/o/ >> >> ( feel free to link or embed in your gnu math website ) >> >> I'm not claiming these are the only ways to write these. I do >> think it's a feature, not a bug, that I'm eschewing recursion >> in all three. Will get to that later, maybe in Scheme just >> like the Scheme folks would prefer (big lambda instead of >> little, which latter I saw put to good use at PPUG last night, >> well attended (about 30)). >> >> http://mybizmo.blogspot.com/2009/01/ppug-2009113.html >> >> Rationale: >> >> In terms of curriculum, these belong together for a host of >> reasons, not just that we want students to use generators to >> explore On-Line Encyclopedia of Integer Sequences type >> sequences. Pascal's Triangle actually contains Fibonaccis >> along successive diagonals but more important we're laying the >> foundation for figurate and polyhedral ball packings ala The >> Book of Numbers, Synergetics, other late 20th century >> distillations (of math and philosophy respectively). >> Fibonaccis converge to Phi i.e. (1 + math.sqrt(5) )/2. gcd >> will be critical in our relative primality checks, leading up >> to Euler's Theorem thence RSA, per the review below (a >> literature search from my cube at CubeSpace on Grand Ave): >> >> http://cubespacepdx.com/ >> http://mathforum.org/kb/thread.jspa?threadID=1885121&tstart=0 >> >> http://www.flickr.com/photos/17157315 at N00/3195148912/ >> >> Remember, every browser has SSL, using RSA for handshaking, so >> it's not like we're giving them irrelevant info. Number >> theory goes into every DirecTV box thanks to NDS, other >> companies making use of this powerful public method.^^ >> >> You should understand, as a supermarket manager or museum >> administrator, something about encryption, security, what's >> tough to the crack and what's not. The battle to make RSA >> public property was hard won, so it's not like our public >> school system is eager to surrender it back to obscurity. >> Student geek wannabes perk up at the thought of getting how >> this works, not hard to show in Javascript and/or Python. >> Makes school more interesting, to be getting the low-down. >> >> By the same token, corporate trainers not having the luxury of >> doing the whole nine yards in our revamped grades 8-12, have >> the ability to excerpt specific juicy parts for the walk of >> life they're in. >> Our maths have a biological flavor, thanks to Spore, thanks to >> Sims. We do a Biotum class almost right away ("Hello World" >> is maybe part of it's __repr__ ?). I'm definitely tilting >> this towards the health professions, just as I did our First >> Person Physics campaign (Dr. Bob Fuller or leader, University >> of Nebraska emeritus). >> >> The reason for using bizarre charactersets in the group theory >> piece is we want to get their attention off numbers and onto >> something more generic, could be pictograms, icons, pictures >> of vegetables... >> >> Feedback welcome, >> >> Kirby >> >> >> ** http://www.flickr.com/photos/17157315 at N00/3198473850/sizes/l/ >> ^^ >> >> http://www.allbusiness.com/media-telecommunications/telecommunications/5923555-1.html >> >> >> _______________________________________________ >> Edu-sig mailing list >> Edu-sig at python.org >> http://mail.python.org/mailman/listinfo/edu-sig >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Edu-sig mailing list >> Edu-sig at python.org >> http://mail.python.org/mailman/listinfo/edu-sig >> > From igor at tamarapatino.org Sat Jan 17 14:25:30 2009 From: igor at tamarapatino.org (Igor =?iso-8859-1?Q?T=E1mara?=) Date: Sat, 17 Jan 2009 08:25:30 -0500 Subject: [Edu-sig] Mercurial Book translated to spanish Message-ID: <20090117132530.GY11199@tamarapatino.org> Hi all, A good friend of mine and I have finished translating the Mercurial book to spanish. You can find it on PDF and 1-page HTML at http://devnull.li/libromercurial/index.es.html You can also find the sources for the book on http://mercurial.intuxication.org/hg/mercurial_book_es/ The translation still has some rough edges, and we are still working on it, but any external help (spelling, wrong translations, etc.) is really appreciated. Patches (to this mail address) would be excellent ;) We hope our work proves itself useful for you that speak spanish of have friends that does. -- Igor Tamara -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: From macquigg at ece.arizona.edu Sat Jan 17 20:30:11 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Sat, 17 Jan 2009 12:30:11 -0700 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> Message-ID: <5.2.1.1.0.20090117111156.0343da00@plus.pop.mail.yahoo.com> I've added a few more topics to http://ece.arizona.edu/~edatools/CS2/P4SE.txt, including Black Hole, and Wave-Particle Paradox. Any physicists on the list? I'll do the programming if you can advise me on the physics. H Bomb - start with a bowling ball of LiDT. Squeeze til it goes boom. How much compression is needed? Try smaller balls. Black Hole - start with a bowling ball of neutrons. Squeeze til it collapses. How big is the black hole (the radius at which photons get sucked in)? Wave-Particle Paradox - two detectors with equal probability of detecting any particle from a specific source. Prior to detection, the particle exists only as a wave function with equal intensity at both detectors. When the particle appears at detector A, how does detector B know instantly not to detect the same particle? Model the problem with two slits generating an interference pattern on a screen. Slow the simulation down until you can observe individual particles. Make sure you delete the wave, once its particle has been detected. That avoids the wave-particle problem, at least in the virtual reality of your simulation. Could the universe be a computer, and all we see of it is a virtual reality? The gods who wrote the program had everything worked out except the problem of what happens to the wave after it turns into a particle. So they just added an instruction to delete the wave. That seems to me more plausible than an infinite number of parallel universes, or the crazy story about Schrodinger's cat being nothing but a wave function that decides if it is dead or alive only when the box is opened. What about the guy opening the box? Is he also a wave function, waiting for someone to open the door to the lab? -- Dave At 04:09 PM 1/15/2009 -0700, David MacQuigg wrote: >I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. > >As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study. > >Additional suggestions are welcome. > >-- Dave From kirby.urner at gmail.com Sat Jan 17 22:41:24 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 17 Jan 2009 13:41:24 -0800 Subject: [Edu-sig] Gnu Geometry Message-ID: Awhile back I posted some scripts for defining and populating 'newgeom', a database of polyhedra in Sqlite.[1] The idea of a classroom database is not new. Enter http://myschool/ms_purky/geom/polyhedra/?poly=tetrahedron and get some view, courtesy of Django. http://myschool/mr_duffy/geography/usa/capitals/?state=OR and get whatever view of Salem (our state capital). What's somewhat intriguing about our Gnu Geometry approach is hinted at in this volumes column: sqlite> select greekname, shortname, volume from Polyhedra; Tetrahedron|tetra|1 Hexahedron|cube|3 Octahedron|octa|4 Rhombic Dodecahedron|cell|6 Cuboctahedron|cubocta|20 Through the close of the 20th century, most children were not exposed to such a simple treatment, continuing their entrapment in a "2D" (planar) world. Moving "beyond flatland" was one of the hallmarks of new millennium curricula, thanks in large degree to H.S.M Coxeter, aka the King of Geometry, who paved the way with his clear explorations and elucidations of the polytopal realm. [2] With the advent of powerful personal computers and their ability to render colorful, rotatable shapes in perspective, many teachers discovered exciting new ways to revive both geometry and geography as subjects of passionate interest. Fractal geometry and cellular automata (both branches of chaos mathematics) likewise fed this revival, as did the publication of global data for civilian use (a geographic application). Other news: We're continuing to plan for OS Bridge, a new open source conference in Portland where I will likely show off some XOs during one of my talks, still quite exotic in this neck of the woods). [3] Kirby [1] http://mail.python.org/pipermail/edu-sig/2008-September/008756.html [2] http://www.amazon.com/King-Infinite-Space-Coxeter-Geometry/dp/0802714994 http://www.rwgrayprojects.com/synergetics/intro/dedicate.html [3] http://controlroom.blogspot.com/2009/01/os-bridge.html http://worldgame.blogspot.com/2009/01/saving-children.html From gregor.lingl at aon.at Sun Jan 18 02:40:00 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Sun, 18 Jan 2009 02:40:00 +0100 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> Message-ID: <49728870.1040101@aon.at> kirby urner schrieb: > Yes thank you I completely agree. A stash of sieves, plus data mine > this very archive for our earlier work on this topic. > > My only suggestion is you include a generator version e.g.: > At first this seems an attractive idea, but in my opinion the idea of sieves is fairly antagonistic to that of generators. A sieve is used to eliminate from a given set elements that have not some desired property, while generators (ideally) create objects, one at atime, with that desired property. Drastically: you cannot sieve at first all even numbers from an infinite set or sequence. For educational purposes I'd prefer examples that display a single concept in a small and simple way. :-* A prime number generater based on some different algorithm of course may be interesting and useful. To continue work in this area one (or at least me) has to have some criteria to judge the solutions. Clearly it was advantageous if there was some consensus about these criteria in the community. There should be some criteria concerning (a) the choice of problems and themes, e.g. to prefer small problems that expose a single idea - or rather not ... etc., as well as some (b) code related criteria, like clarity, conciseness, efficiency, beauty (!) etc., ranked according to their priorities. Once I had the following idea: there are so many renowned pythonistas in the developers community, many of them also interested to promote Python in the educational area (see for instance the protagonists in Jeffrey Elkners "Introducing Python"). How about to ask them to make a personal donation to the educators and learners: a piece of code, 10 to 12 lines at most, that they individually consider to show most convincingly the power or the beauty of programming with Python - or the fun they have with it. Young people like role models ;-) Regrettably I didn't persue that idea further. What do you think of it. Ok, the days of the early pioneers are over, but perhaps it's still worth a try? Regards, Gregor > Using Python 3: > > >>>> g = Primes() >>>> next(g) >>>> > -1 > >>>> next(g) >>>> > .... > From kirby.urner at gmail.com Sun Jan 18 05:21:21 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 17 Jan 2009 20:21:21 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> Message-ID: Hi David -- I've been looking at your PythonOOP. Why use classes? All programming aside, I think it's a fairly strong grammatical model of how people think, basically in terms of noun.adjective (data attribute) and noun.verb() (callable method). All talk of computer languages aside, we're very noun-oriented, think in terms of "things" and these things either "are" or "have" attributes and "do" verby stuff. OOP is about making the language talk about the problem domain, help us forget that under the hood nightmare of chips and registers, needing to allocate memory... all that stupid computer stuff that nobody cares about (smile). Of course I like your nomenclature of a Cat inheriting from Animal as I'm always tying "hierarchy" back to "zoology" and "taxonomy" as those were original liberal arts tree structures (class hierarchies, kingdoms, domains, namespaces). We like "astral bodies" subclassed into stars, planets, planetoids (like Pluto), and moons. We like "Reptiles" including "Snakes" which of course includes "Pythons" (everything is a python in Python, i.e. an object with a __rib__ cage). Having a Dog and a Monkey motivates why ancestor classes are important: generic shared stuff, like digestion, might be handled in a shared eat() method, each with its own self.stomach of course. With a younger set (pre-college), those parentheses connote lips, with args as oral intake. In the class of classes though... we give birth. Per a recent PPUG, I'm these days thinking to use a collections.deque for my digestive tract maybe: >>> class Animal: def __init__(self): self.stomach = deque() def eat(self, item): self.stomach.append(item) def poop(self): if len(self.stomach)>0: return self.stomach.popleft() >>> zebra = Animal() >>> zebra.eat('straw') >>> zebra.stomach deque(['straw']) >>> zebra.poop() 'straw' >>> zebra.stomach deque([]) >>> Some will want to say digestive_tract instead of stomach. Now you can develop your Dog and Cat, inheriting eat() and __init__ from Animal, yet each subclass providing its own __repr__ methods. "Hello world, I'm a Cat at %s" % id(self). Yes, you could make the __repr__ invoke __class__.__name__ and share it -- show that later.... ? >>> class Animal: def __init__(self): self.stomach = deque() def eat(self, item): self.stomach.append(item) def poop(self): if len(self.stomach)>0: return self.stomach.popleft() def __repr__(self): return "I'm a %s at %s" % (self.__class__.__name__, id(self)) >>> class Dog(Animal): pass >>> class Cat(Animal): pass >>> thing1 = Dog() >>> thing2 = Cat() >>> thing1 I'm a Dog at 138223820 >>> thing2 I'm a Cat at 138223852 Students see how inheritance means specializing as you go down the tree (consistent with most introductory treatments). Your spin seems to tilted towards Cats with not enough other subclasses of Animal to make inheritance seem all that necessary. Your ancestor is mostly for "herding cats" (counting instances), isn't so much a "blueprint" for different subclasses of the Animal idea (aardvark versus eel). More generally I think using an ancestor class to do instance counting is a little on the "too difficult" side for a core introductory running example. It leads you to introduce an interception of __del__ as your first example of operator over-riding. This seems rather unpythonic, as the __del__ method is rather rarely intercepted, compared to say __set__ and __get__ (per Alex Martelli in this lecture @ Google: http://controlroom.blogspot.com/2009/01/oop-in-hour.html ). I was also struck by how often you compare classes to modules (modules in Chapter 16 right?), suggesting a Perlish upbringing -- as did your suggestion to use '_' in place of 'self' for "maximal uncluttering" (paraphrase). When Perl decided to make the leap to OO, it was "the module" that got blessed for this purpose yes? Are you a closet Perl Monger then? I notice you tend to favor your private terminology and don't resort to the CS vocabulary as often, e.g. "polymorphic" and "polymorphism" are not included. If you're wanting your students to gain fluency with the surrounding literature, I think at least that one deserves more focus, in conjunction with inheritance. I think the a first class could be all data (like a C struct). Like, this example says a lot: >>> class Foo: bar = 1 >>> f = Foo() >>> g = Foo() >>> f.bar = 1 >>> f.bar = 2 >>> g.bar 1 >>> f.bar 2 >>> f.__dict__ {'bar': 2} >>> g.__dict__ {} >>> g.bar 1 however once you start adding methods, I don't think postponing the appearance of __init__ for so long is a good idea. I would focus on a Dog and a Cat (or any other two animals), both with __init__ constructors and eat methods, then (as a next step) introduce the Animal superclass as a case of "refactoring" by inheritance -- a good time to mention the "is a" abstraction (a Dog "is an" Animal). Show how you're economizing on code by having an ancestor, make OO seem like a revelation (which it is/was). I don't think you're alone in finding __ribs__ somewhat intimidating, strange-looking (a hallmark of Python), but I think these should be tackled right away, perhaps with built-in data types first, i.e. that 2 .__add__(2) example. How about a function call ribs() that prints the special names in any object... >>> import re >>> ex = re.compile("__[a-z]+__") >>> def ribs(it): return re.findall(ex, " ".join(dir(it))) I think of __init__ as being triggered by a "birth syntax" i.e. to call a class directly, as in Animal(), is to call for an instance of that class, and that invokes __init__ (__new__ first though). >>> class Foo: def __init__(self): print("I am born!") @staticmethod def __call__(): print("What?") >>> f = Foo() I am born! >>> f() What? >>> Foo.__call__() What? I like your point that intercepting __add__ is just like "intercepting" an Animal's 'talk' method in a subclass, i.e. interception is happening in both cases, it's just that some names are special (as you say) in being triggered by *syntax* rather than their actual names -- although that form is also usable (as you point out using __add__) -- plus some special names *don't* have special triggering syntax, i.e. just use the __rib__ directly, as in "if __name__ == '__main__':" I like this section: Background on Languages - languages poster - progression of languages 1 2 - domain-specific (FORTRAN, COBOL) - general-purpose, high-level (C) - one step above assembler - problem was complexity, one big pile of data - object-oriented (C++) - data now contained within independent objects - human oriented (Java, Python) - garbage collection - dynamic typing ... and your focus on Mandelbrot / fractals. Lots of substance. Kirby On Thu, Jan 15, 2009 at 3:09 PM, David MacQuigg wrote: > I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. > > As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study. > > Additional suggestions are welcome. > > -- Dave > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From kirby.urner at gmail.com Sun Jan 18 06:31:12 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 17 Jan 2009 21:31:12 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <49728870.1040101@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> Message-ID: On Sat, Jan 17, 2009 at 5:40 PM, Gregor Lingl wrote: > > > kirby urner schrieb: >> >> Yes thank you I completely agree. A stash of sieves, plus data mine >> this very archive for our earlier work on this topic. >> >> My only suggestion is you include a generator version e.g.: >> > > At first this seems an attractive idea, but in my opinion the > idea of sieves is fairly antagonistic to that of generators. > A sieve is used to eliminate from a given set elements > that have not some desired property, while generators > (ideally) create objects, one at atime, with that desired > property. Drastically: you cannot sieve at first all even > numbers from an infinite set or sequence. For educational > purposes I'd prefer examples that display a single concept > in a small and simple way. :-* A prime number generater > based on some different algorithm of course may be > interesting and useful. Yes sir! Excellent clarification. The goal is to have a worthy generator that always gives the next prime. "Trial by division" is the simplest approach I can think of... >>> def primes(): sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway yield sofar[0] # get these out of the way yield sofar[1] # the only even prime yield sofar[2] # and then 3 candidate = 5 # we'll increment from here on while True: # go forever for factor in sofar[1:]: # skip -1 (or don't use it in the first place) if factor ** 2 > candidate: # did we pass? yield candidate # woo hoo! sofar.append(candidate) # keep the gold break # onward! if not candidate % factor: # oops, no remainder break # this is a composite candidate += 2 # next odd number please >>> g = primes() >>> next(g) -1 >>> next(g) 2 >>> next(g) 3 >>> next(g) 5 >>> next(g) 7 >>> next(g) 11 >>> next(g) 13 >>> next(g) 17 >>> next(g) 19 >>> next(g) 23 >>> next(g) 29 >>> next(g) 31 >>> next(g) 37 >>> next(g) 41 I think you're correct that the sieve best works with a pre-specified finite domain: sieve it completely, using divisors < math.sqrt(len(domain)) then iterate over it maybe, but the array is already populated, taking up memory. The above generator, in contrast, gradually takes up more memory (shows what generators are good for then: saving state between cycles). > To continue work in this area one (or at least me) has to have > some criteria to judge the solutions. > Clearly it was advantageous if there was some consensus about > these criteria in the community. Fortunately, we have hundreds of years of math pedagogy, so in terms of avoiding quarrels, start with what's already on the books are "must have" and just render it Pythonically. So, for example, every pre-college math curriculum I'm aware of makes the distinction between prime and composite numbers. On the other hand, few include the Fermat test or Fermat's Little Theorem, don't have RSA as a goal. So whereas generators for primes, fibonaccis, pascal's triangle, would seem non-controversial, anything having to do with Fermat's Little Theorem would seem an uphill battle, especially without buy in on the RSA bit. What makes a lot of this stuff more accessible than before is we have the ability to work with large numbers of digits. Both text books and calculators tend to crap out at more that 15 significant figures. Not so in Python or any significantly endowed language. 2 ** 10000 is no problem for us, is for the paper and pencil crowd, or the TI crowd (both pitiable). I don't think there's a way to avoid quarrels. People have different leadings, throw their hats in the ring, and we see what synergies develop. My goal is to keep the process open and participatory, not to close it down. The sight of people debating is far less disturbing than the sight of everyone in lockstep (the Borg). > > There should be some criteria concerning > (a) the choice of problems and themes, > e.g. to prefer small problems that expose a single idea - or rather not > ... etc., > as well as some > (b) code related criteria, like clarity, conciseness, efficiency, beauty (!) > etc., ranked according to > their priorities. This will be up to each professional teacher in whatever walk of life -- to judge what to include and what to exclude. Each teacher will find her or himself in agreement with some, disagreement with others, over what to include. Twas ever thus. What to avoid, in my book, is a restrictive environment which takes a one size fits all approach and dictates to all teachers how it must be, removing much individual freedom. Reduction in biodiversity is dangerous in my estimation. That's why I fight against "national curriculum" ideologues on the Math Forum, other places. > Once I had the following idea: there are so many renowned pythonistas > in the developers community, many of them also interested to promote > Python in the educational area (see for instance the protagonists in > Jeffrey Elkners "Introducing Python"). How about to ask them to make > a personal donation to the educators and learners: a piece of code, > 10 to 12 lines at most, that they individually consider to show most > convincingly the power or the beauty of programming with Python - > or the fun they have with it. Young people like role models ;-) > That's a fun idea. Another approach is to start some schools in which Python is defacto included as an important tool in the math curriculum, and compete with other schools that make different choices, see how that goes. Don't try to "convince the world" before starting your experiment. You need no one's permission to take the initiative. Individuals make all the difference in this world, alone and in groups. > Regrettably I didn't persue that idea further. What do you think of it. Ok, > the days of the early pioneers are over, but perhaps it's still worth a try? > I think the first generation of Pythoneers, counting myself as one of them, should be collecting momentos and souvenirs, as soon enough our generation will no longer be heard from, in terms of contributing new material. Your idea reminds me of the recipe book they made for Bucky Fuller, his many friends contributing their favorites. Looking back at 2008, random geek viewpoint: http://www.iht.com/articles/2008/12/22/arts/design22.php Kirby > Regards, > Gregor > > > > > >> >> Using Python 3: >> >> >>>>> >>>>> g = Primes() >>>>> next(g) >>>>> >> >> -1 >> >>>>> >>>>> next(g) >>>>> >> >> .... >> > From mpaul213 at gmail.com Sun Jan 18 08:59:11 2009 From: mpaul213 at gmail.com (michel paul) Date: Sat, 17 Jan 2009 23:59:11 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> Message-ID: <40ea4eb00901172359w5ef10198n66f5e3f1dbafc032@mail.gmail.com> I definitely believe that a good way to improve our current math curriculum would be to weave in computational number theory. This would be the 21st century answer to 'back to basics'. I think a huge problem in student math illiteracy has to do with not understanding division, remainders, and ratios. When dealing with division, our curriculum tends to focus on quotients, but understanding the nature of the remainder has a lot to do with what math and technology are about these days. Exploring how to find primes is definitely a 'must include' in a computational math curriculum. I think students should explore this in a variety of ways, including both sieves and generators, discussing why one might choose one approach or another in various situations. This would do a whole lot of good for both math and tech literacy simultaneously. An interesting fact is that, except for 2 and 3, all primes are adjacent to a multiple of 6. That is easy to prove: Let n be a multiple of 6. n+1 might be prime. n+2 is divisible by 2. n+3 is divisible by 3. n+4 is divisible by 2. n+5 might be prime n+6 is another multiple of 6. Here's a generator that uses this jumping by 6 approach: def primes(): p = [-1, 2, 3] for x in p: yield x def is_prime(n): for factor in p[1:]: if factor**2 > n: return True if n%factor == 0: return False multiple = 6 while True: if is_prime(multiple-1): yield multiple-1; p.append(multiple-1) if is_prime(multiple+1): yield multiple + 1; p.append(multiple+1) multiple += 6 - Michel On Sat, Jan 17, 2009 at 9:31 PM, kirby urner wrote: > On Sat, Jan 17, 2009 at 5:40 PM, Gregor Lingl wrote: > > > > > > kirby urner schrieb: > >> > >> Yes thank you I completely agree. A stash of sieves, plus data mine > >> this very archive for our earlier work on this topic. > >> > >> My only suggestion is you include a generator version e.g.: > >> > > > > At first this seems an attractive idea, but in my opinion the > > idea of sieves is fairly antagonistic to that of generators. > > A sieve is used to eliminate from a given set elements > > that have not some desired property, while generators > > (ideally) create objects, one at atime, with that desired > > property. Drastically: you cannot sieve at first all even > > numbers from an infinite set or sequence. For educational > > purposes I'd prefer examples that display a single concept > > in a small and simple way. :-* A prime number generater > > based on some different algorithm of course may be > > interesting and useful. > > Yes sir! Excellent clarification. The goal is to have a worthy > generator that always gives the next prime. "Trial by division" is > the simplest approach I can think of... > > >>> def primes(): > sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway > yield sofar[0] # get these out of the way > yield sofar[1] # the only even prime > yield sofar[2] # and then 3 > candidate = 5 # we'll increment from here on > while True: # go forever > for factor in sofar[1:]: # skip -1 (or don't use it in the > first place) > if factor ** 2 > candidate: # did we pass? > yield candidate # woo hoo! > sofar.append(candidate) # keep the gold > break # onward! > if not candidate % factor: # oops, no remainder > break # this is a composite > candidate += 2 # next odd number please > > > >>> g = primes() > >>> next(g) > -1 > >>> next(g) > 2 > >>> next(g) > 3 > >>> next(g) > 5 > >>> next(g) > 7 > >>> next(g) > 11 > >>> next(g) > 13 > >>> next(g) > 17 > >>> next(g) > 19 > >>> next(g) > 23 > >>> next(g) > 29 > >>> next(g) > 31 > >>> next(g) > 37 > >>> next(g) > 41 > > I think you're correct that the sieve best works with a pre-specified > finite domain: sieve it completely, using divisors < > math.sqrt(len(domain)) then iterate over it maybe, but the array is > already populated, taking up memory. The above generator, in > contrast, gradually takes up more memory (shows what generators are > good for then: saving state between cycles). > > > To continue work in this area one (or at least me) has to have > > some criteria to judge the solutions. > > Clearly it was advantageous if there was some consensus about > > these criteria in the community. > > Fortunately, we have hundreds of years of math pedagogy, so in terms > of avoiding quarrels, start with what's already on the books are "must > have" and just render it Pythonically. > > So, for example, every pre-college math curriculum I'm aware of makes > the distinction between prime and composite numbers. > > On the other hand, few include the Fermat test or Fermat's Little > Theorem, don't have RSA as a goal. So whereas generators for primes, > fibonaccis, pascal's triangle, would seem non-controversial, anything > having to do with Fermat's Little Theorem would seem an uphill battle, > especially without buy in on the RSA bit. > > What makes a lot of this stuff more accessible than before is we have > the ability to work with large numbers of digits. Both text books and > calculators tend to crap out at more that 15 significant figures. Not > so in Python or any significantly endowed language. 2 ** 10000 is no > problem for us, is for the paper and pencil crowd, or the TI crowd > (both pitiable). > > I don't think there's a way to avoid quarrels. People have different > leadings, throw their hats in the ring, and we see what synergies > develop. My goal is to keep the process open and participatory, not > to close it down. The sight of people debating is far less disturbing > than the sight of everyone in lockstep (the Borg). > > > > > There should be some criteria concerning > > (a) the choice of problems and themes, > > e.g. to prefer small problems that expose a single idea - or rather > not > > ... etc., > > as well as some > > (b) code related criteria, like clarity, conciseness, efficiency, beauty > (!) > > etc., ranked according to > > their priorities. > > This will be up to each professional teacher in whatever walk of life > -- to judge what to include and what to exclude. Each teacher will > find her or himself in agreement with some, disagreement with others, > over what to include. Twas ever thus. > > What to avoid, in my book, is a restrictive environment which takes a > one size fits all approach and dictates to all teachers how it must > be, removing much individual freedom. > > Reduction in biodiversity is dangerous in my estimation. > > That's why I fight against "national curriculum" ideologues on the > Math Forum, other places. > > > Once I had the following idea: there are so many renowned pythonistas > > in the developers community, many of them also interested to promote > > Python in the educational area (see for instance the protagonists in > > Jeffrey Elkners "Introducing Python"). How about to ask them to make > > a personal donation to the educators and learners: a piece of code, > > 10 to 12 lines at most, that they individually consider to show most > > convincingly the power or the beauty of programming with Python - > > or the fun they have with it. Young people like role models ;-) > > > > That's a fun idea. > > Another approach is to start some schools in which Python is defacto > included as an important tool in the math curriculum, and compete with > other schools that make different choices, see how that goes. > > Don't try to "convince the world" before starting your experiment. > > You need no one's permission to take the initiative. > > Individuals make all the difference in this world, alone and in groups. > > > Regrettably I didn't persue that idea further. What do you think of it. > Ok, > > the days of the early pioneers are over, but perhaps it's still worth a > try? > > > > I think the first generation of Pythoneers, counting myself as one of > them, should be collecting momentos and souvenirs, as soon enough our > generation will no longer be heard from, in terms of contributing new > material. > > Your idea reminds me of the recipe book they made for Bucky Fuller, > his many friends contributing their favorites. > > Looking back at 2008, random geek viewpoint: > http://www.iht.com/articles/2008/12/22/arts/design22.php > > Kirby > > > > Regards, > > Gregor > > > > > > > > > > > >> > >> Using Python 3: > >> > >> > >>>>> > >>>>> g = Primes() > >>>>> next(g) > >>>>> > >> > >> -1 > >> > >>>>> > >>>>> next(g) > >>>>> > >> > >> .... > >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sun Jan 18 17:47:40 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 18 Jan 2009 08:47:40 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <40ea4eb00901172359w5ef10198n66f5e3f1dbafc032@mail.gmail.com> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <40ea4eb00901172359w5ef10198n66f5e3f1dbafc032@mail.gmail.com> Message-ID: On Sat, Jan 17, 2009 at 11:59 PM, michel paul wrote: > I definitely believe that a good way to improve our current math curriculum > would be to weave in computational number theory. This would be the 21st > century answer to 'back to basics'. > Yes. OSCON avatar R0ml has puts a strong liberal arts spin, says these language games with computers are the new rhetoric, the basis for responsible civic participation. If they deny you access to these skills, that's a clear conspiracy to disempower you, or feel free to treat it that way: blend in, act like nothing is wrong, then network with your friends like crazy after school, do peer to peer teaching. Bone up on what they're withholding, your right as a citizen. Fortunately, Portland makes that easy, what with OS Bridge, Saturday Academy and so on. Plus some of our public schools have already turned the corner. LEP High is all open source Ubuntu on wireless, had me in peer teaching Python years ago by now (realized they could do it). > I think a huge problem in student math illiteracy has to do with not > understanding division, remainders, and ratios. When dealing with division, > our curriculum tends to focus on quotients, but understanding the nature of > the remainder has a lot to do with what math and technology are about these > days. > Per our Shuttleworth meetup in London that time (some years ago), in South Africa at least they're just bored out of their skulls if you didn't share the cool toys with them (the students). "When do we get to learn about computers? That's what we're here for. We know this knowledge is necessary to run companies, governments, any large scale service. If that's not what we're learning, why are we here?" Tuxlabs, Freedom Toasters, OLPC... all pieces of the puzzle. Many (not all) North Americans are more docile and controllable, weren't oppressed by years of apartheid, and so take it sitting down when you say you're "teaching math" but teach nothing about the executable math notations except on a TI (very anemic and underpowered, a joke if you're trying to run a railroad). > Exploring how to find primes is definitely a 'must include' in a > computational math curriculum. I think students should explore this in a > variety of ways, including both sieves and generators, discussing why one > might choose one approach or another in various situations. This would do a > whole lot of good for both math and tech literacy simultaneously. Yes, and the literature is already well developed. The Fermat Test works pretty well actually. If 2**(p-1) % p is 1, you're likely dealing with a prime. Let's test it: >>> sequence = fermat_test() >>> next(sequence) 5 >>> next(sequence) 7 >>> next(sequence) 11 >>> next(sequence) 13 >>> next(sequence) 17 >>> next(sequence) 19 >>> next(sequence) 23 >>> next(sequence) 29 >>> next(sequence) 31 Pretty good huh. If you hard code the exceptions (as a list) you can get a long way with this. It's also a good lesson in simple logic: "IF you're a prime THEN you will pass the Fermat Test" is true, but "IF you pass the Fermat Test THEN you are prime" is false. Talk about Carmichael Numbers. The Fermat Test is based on Euler's Theorem that a base to a totient power of N, mod N, nets you unity. RSA encrypts your message m by raising it to a 3rd power (say) mod public key i.e. c = pow(m, 3, N), but then we know the inverse of 3, call it d, mod totient(N) such that pow(c, d, N) will be the base itself, i.e. m (we've gone "around the clock" just the right distance). d is kept secret to the receiver, N is published and used to encrypt by the sender (as is the source code, patent expired). Unless you know totient(N) you're unable to crack c, but that requires knowing the two prime factors of N, which got thrown away. totient(N) = (p-1)*(q-1). Example: N = 17 * 23 totN = 16 * 22 m = 111 Go c = pow(111, 3, N) get d such that 3*d % totN == 1 Brute force why not: >>> for i in range(1, totN): if (3*i) % totN == 1: print(i) 235 get m back: >>> c 304 >>> (3 * d) % totN 1 >>> pow(c, d, N) 111 Ta da! In SSL, you don't need any published N, can establish that upon handshaking. If you want your email encrypted, then publish your N. Thanks to our early group theory exercises (e.g. Vegetable Group Soup), our South Africans, North Americans or whatever, know "inverse" means something vis-a-vis a multiplicative identity, i.e. 1 or unity. These "modulo numbers" (as we call them), may be defined as a simple Python class and made to spit out their tables, including their power tables. We override __mul__ to get these, study group properties of Closure, Associativity, Inverse and Neutral element (CAIN). Even before this, we've used the concept of "relatively prime" to define totatives and totient. The whole discussion of primes versus composites goes into this, which is where we get to these generators. Miller-Rabin is a strong primality tester, stronger than Fermat's, and might be used as a generator also (it's not a sieve). We can use the extended version of Euclid's Algorithm for the gcd, to compute the inverse of a modulo number, build it right into the class definition. > > An interesting fact is that, except for 2 and 3, all primes are adjacent to > a multiple of 6. That is easy to prove: > That's true of every odd number not a multiple of 3 (it's next to an even number that is a multiple of 3), some of which are also prime. > Let n be a multiple of 6. > n+1 might be prime. > n+2 is divisible by 2. > n+3 is divisible by 3. > n+4 is divisible by 2. > n+5 might be prime > n+6 is another multiple of 6. > > Here's a generator that uses this jumping by 6 approach: > > def primes(): > p = [-1, 2, 3] > for x in p: yield x > def is_prime(n): > for factor in p[1:]: > if factor**2 > n: return True > if n%factor == 0: return False > multiple = 6 > while True: > if is_prime(multiple-1): yield multiple-1; p.append(multiple-1) > if is_prime(multiple+1): yield multiple + 1; p.append(multiple+1) > multiple += 6 > Yes, another way of doing trial by division, checking all odd-number candidates (automatically skipping those divisible by 3). Kirby > - Michel From Scott.Daniels at Acm.Org Sun Jan 18 18:35:50 2009 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Sun, 18 Jan 2009 09:35:50 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <40ea4eb00901172359w5ef10198n66f5e3f1dbafc032@mail.gmail.com> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <40ea4eb00901172359w5ef10198n66f5e3f1dbafc032@mail.gmail.com> Message-ID: michel paul wrote: > ... An interesting fact is that, except for 2 and 3, all primes are adjacent > to a multiple of 6.... Having once been interested in prime pairs, I remember having written a lot of code based on this "back in the day." Here is my version of your generator: def primes(): for x in -1, 2, 3: yield x gen = primes().next for top in iter(gen, 3): pass # skip useless tests (we skip all multiples of 2 or 3) factors = [] # get pump ready for a 5 check = -1 limit = 3 * 3 - 2 # How far will 3 work as top prime? factors = [] while True: check += 6 if check >= limit: # move if this pair needs another factor top = gen() limit = top * top - 2 # limit for both candidates factors.append(top) for element in check, check + 2: for factor in factors: if element % factor == 0: break else: yield element --Scott David Daniels Scott.Daniels at Acm.Org From gregor.lingl at aon.at Mon Jan 19 00:31:36 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Mon, 19 Jan 2009 00:31:36 +0100 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> Message-ID: <4973BBD8.4070909@aon.at> kirby urner schrieb: > I think you're correct that the sieve best works with a pre-specified > finite domain: > .... >> To continue work in this area one (or at least me) has to have >> some criteria to judge the solutions. >> Clearly it was advantageous if there was some consensus about >> these criteria in the community. >> > > Fortunately, we have hundreds of years of math pedagogy, so in terms > of avoiding quarrels, start with what's already on the books are "must > have" and just render it Pythonically. .... >> There should be some criteria concerning >> (a) the choice of problems and themes, >> e.g. to prefer small problems that expose a single idea - or rather not >> ... etc., >> as well as some >> (b) code related criteria, like clarity, conciseness, efficiency, beauty (!) >> etc., ranked according to >> their priorities. >> > > This will be up to each professional teacher in whatever walk of life > -- to judge what to include and what to exclude. Each teacher will > find her or himself in agreement with some, disagreement with others, > over what to include. Twas ever thus. > I think it's not that easy. I'd like to dive a bit into this topic, resuming the code examples given in this thread and adding a few additional ideas. What concerns efficiency, I've measured the time to compute the 9592/9593 primes in the range up to 100000 and (in order to get some idea how the algorithm scales) also those up to 500000 (on my machine). Here is your, Kirby's, code: def primes(): sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway yield sofar[0] # get these out of the way yield sofar[1] # the only even prime yield sofar[2] # and then 3 candidate = 5 # we'll increment from here on while True: # go forever for factor in sofar[1:]: # skip -1 (or don't use it in the first place) if factor ** 2 > candidate: # did we pass? yield candidate # woo hoo! sofar.append(candidate) # keep the gold break # onward! if not candidate % factor: # oops, no remainder break # this is a composite candidate += 2 # next odd number please Time: 100000: 1.71 s 500000: 42.72 s ----- Michel Paul's code: def primes(): sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway yield sofar[0] # get these out of the way yield sofar[1] # the only even prime yield sofar[2] # and then 3 candidate = 5 # we'll increment from here on while True: # go forever for factor in sofar[1:]: # skip -1 (or don't use it in the first place) if factor ** 2 > candidate: # did we pass? yield candidate # woo hoo! sofar.append(candidate) # keep the gold break # onward! if not candidate % factor: # oops, no remainder break # this is a composite candidate += 2 # next odd number please Time: 100000: 1.58 s 500000: 32.25 s ----- I've modified this one slightly, with a surprising effect (I conjecture mainly due to avoiding copying p repeatedly): def primes(): yield(-1) p = [2, 3] for x in p: yield x def is_prime(n): for factor in p: if factor**2 > n: return True if n%factor == 0: return False multiple = 6 while True: for cand in multiple-1, multiple+1: if is_prime(cand): yield cand p.append(cand) multiple += 6 Time: 100000: 0.14 s 500000: 1.05 s ----- Scott Daniels code: def primes(): for x in -1, 2, 3: yield x gen = primes().next for top in iter(gen, 3): pass # skip useless tests (we skip all multiples of 2 or 3) factors = [] # get pump ready for a 5 check = -1 limit = 3 * 3 - 2 # How far will 3 work as top prime? factors = [] while True: check += 6 if check >= limit: # move if this pair needs another factor top = gen() limit = top * top - 2 # limit for both candidates factors.append(top) for element in check, check + 2: for factor in factors: if element % factor == 0: break else: yield element Time: 100000: 0.07 s 500000: 0.50 s ----- Compare the above generators to sieve algorithms: G.L. minimal sieve def primes(n): s = set(range(3,n+1,2)) for m in range(3, int(n**.5)+1, 2): s.difference_update(range(m*m, n+1, 2*m)) return [2]*(2<=n) + sorted(s) Time: 100000: 0.014 s 500000: 0.11 s ----- G.L.: sieve def primes(n): s = set(range(3,n+1,2)) if n >= 2: s.add(2) m=3 while m * m < n: s.difference_update(range(m*m, n+1, 2*m)) m += 2 while m not in s: m += 2 return sorted(s) Time: 100000: 0.012 s 500000: 0.086 s ----- Apparently sieves are considerably faster at the cost that the whole sieve has to be calculated before the primes can be retrieved. Not a disadvantage if you only want to know the n-th prime. So this suggests to make use of the sieve-paradigm also for prime generators. Here is a rather primitive example: G.L. sieve based generator: def primes(): CHUNKSIZE = 5000 # arbitrary even primes = [] yield 2 # first chunk candidates = range(3,CHUNKSIZE,2) chunk = set(candidates) for m in candidates: if m*m > CHUNKSIZE: break chunk.difference_update(range(m*m, CHUNKSIZE, m)) chunk = sorted(list(chunk)) for p in chunk: yield p primes.extend(chunk) lower = CHUNKSIZE # more chunks while True: upper = lower + CHUNKSIZE chunk = set(range(lower+1,upper,2)) for m in primes: if m*m > upper: break chunk.difference_update(range(lower + m - lower%m, upper, m)) chunk = sorted(list(chunk)) for p in chunk: yield p primes.extend(chunk) lower = upper Time: 100000: 0.023 s 500000: 0.113 s ----- Of course there are many more possibilities to realize this, for instance to use slice-assignment instead of sets. This would require some somewhat opaque index calculations, but be - as far as I rember - even faster. Particularly I suppose that there exist faster algorithms for generating primes, but I admittedly don't know them. ====================================================== Summing up: Kirby 1.71 s 42.72 s Michel Paul 1.58 s 32.25 s Michel Paul modified:: 0.14 s 1.05 s Scott Daniels: 0.07 s 0.50 s G.L. minimal sieve: 0.014 s 0.109 s G.L. sieve: 0.012 s 0.086 s G.L. sieve-based generator: 0.023 s 0.113 s (performance depends on CHUNKSIZE) This exposes in my opinion an unsurmountable dilemma, namely that usually you cannot meet even those few criteria mentioned in the beginning in a single solution. So under the aspects you exposed at the beginning of this thread, "Pythonic Math", which title in some sense includes and/or addresses this dilemma, how would you prefer to weight those criteria? Regards Gregor From andre.roberge at gmail.com Mon Jan 19 01:39:37 2009 From: andre.roberge at gmail.com (Andre Roberge) Date: Sun, 18 Jan 2009 20:39:37 -0400 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <4973BBD8.4070909@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <4973BBD8.4070909@aon.at> Message-ID: <7528bcdd0901181639h139a3573qc63e5a1775c4dc77@mail.gmail.com> On Sun, Jan 18, 2009 at 7:31 PM, Gregor Lingl wrote: [SNIP] > ====================================================== > > Summing up: > > Kirby 1.71 s 42.72 s > Michel Paul 1.58 s 32.25 s > Michel Paul modified:: 0.14 s 1.05 s > Scott Daniels: 0.07 s 0.50 s > G.L. minimal sieve: 0.014 s 0.109 s > G.L. sieve: 0.012 s 0.086 s > G.L. sieve-based generator: 0.023 s 0.113 s > (performance depends on CHUNKSIZE) > You may also want to consider the following: ''' Sieve of erathosthenes, from the Python Cookbook, 2nd edition ''' import itertools import pprint def erathosthenes(): '''Yields the sequence of prime numbers via the Sieve of Erathosthenes.''' D = {} # map each composite integer to its first-found prime factor for q in itertools.count(2): # q gets 2, 3, 4, 5, ... ad infinitum p = D.pop(q, None) if p is None: # q not a key in D, so q is a prime, therefore, yield it yield q # mark q square as not-prime (with q as first found prime factor) D[q*q] = q if __name__ == '__main__': pprint.pprint(D) else: # q is a composite number with p as its first-found prime number # So, let's try to find the next smallest possible composite to # add and that was not already present with the same first-found # prime number x = q + p while x in D: x += p D[x] = p if __name__ == '__main__': sieve = erathosthenes() for i in range(10): print sieve.next() === Andr? From mpaul213 at gmail.com Mon Jan 19 02:04:27 2009 From: mpaul213 at gmail.com (michel paul) Date: Sun, 18 Jan 2009 17:04:27 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <4973BBD8.4070909@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <4973BBD8.4070909@aon.at> Message-ID: <40ea4eb00901181704m72ab12f3tfc912d467df1a205@mail.gmail.com> On Sun, Jan 18, 2009 at 3:31 PM, Gregor Lingl wrote: > Michel Paul's code: > > def primes(): > sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway > yield sofar[0] # get these out of the way > yield sofar[1] # the only even prime > yield sofar[2] # and then 3 > candidate = 5 # we'll increment from here on > while True: # go forever > for factor in sofar[1:]: # skip -1 (or don't use it in the first > place) > if factor ** 2 > candidate: # did we pass? > yield candidate # woo hoo! > sofar.append(candidate) # keep the gold > break # onward! > if not candidate % factor: # oops, no remainder > break # this is a composite > candidate += 2 # next odd number please > > Time: 100000: 1.58 s 500000: 32.25 s > ----- Actually, that's Kirby's code. This is what I sent: def primes(): p = [-1, 2, 3] for x in p: yield x def is_prime(n): for factor in p[1:]: if factor**2 > n: return True if n%factor == 0: return False multiple = 6 while True: if is_prime(multiple-1): yield multiple-1; p.append(multiple-1) if is_prime(multiple+1): yield multiple + 1; p.append(multiple+1) multiple += 6 Is this what was tested? Or what was listed? Just curious. > I've modified this one slightly, with a surprising effect > (I conjecture mainly due to avoiding copying p repeatedly): > > def primes(): > yield(-1) > p = [2, 3] > for x in p: yield x > def is_prime(n): > for factor in p: > if factor**2 > n: return True > if n%factor == 0: return False > multiple = 6 > while True: > for cand in multiple-1, multiple+1: > if is_prime(cand): > yield cand > p.append(cand) > multiple += 6 > > Time: 100000: 0.14 s 500000: 1.05 s > ----- > > Yeah, I like the 'for cand in multiple-1, multiple+1'. I actually did do it that way on a previous occasion. So this is very interesting. - Michel -------------- next part -------------- An HTML attachment was scrubbed... URL: From gregor.lingl at aon.at Mon Jan 19 02:24:27 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Mon, 19 Jan 2009 02:24:27 +0100 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <40ea4eb00901181704m72ab12f3tfc912d467df1a205@mail.gmail.com> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <4973BBD8.4070909@aon.at> <40ea4eb00901181704m72ab12f3tfc912d467df1a205@mail.gmail.com> Message-ID: <4973D64B.1060904@aon.at> michel paul schrieb: > On Sun, Jan 18, 2009 at 3:31 PM, Gregor Lingl > wrote: > > > Michel Paul's code: > > > def primes(): > sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway > yield sofar[0] # get these out of the way > yield sofar[1] # the only even prime > yield sofar[2] # and then 3 > candidate = 5 # we'll increment from here on > while True: # go forever > for factor in sofar[1:]: # skip -1 (or don't use it in the > first place) > if factor ** 2 > candidate: # did we pass? > yield candidate # woo hoo! > sofar.append(candidate) # keep the gold > break # onward! > if not candidate % factor: # oops, no remainder > break # this is a composite > candidate += 2 # next odd number please > > Time: 100000: 1.58 s 500000: 32.25 s > ----- > > > Actually, that's Kirby's code. > This is what I sent: > > def primes(): > p = [-1, 2, 3] > for x in p: yield x > def is_prime(n): > for factor in p[1:]: > if factor**2 > n: return True > if n%factor == 0: return False > multiple = 6 > while True: > if is_prime(multiple-1): yield multiple-1; p.append(multiple-1) > if is_prime(multiple+1): yield multiple + 1; p.append(multiple+1) > multiple += 6 > > Is this what was tested? Or what was listed? Just curious. Sorry. Of course, you are right. That was a copy and paste - error. Your code was what was tested and the result of which is listed in the table. And you can easily recognize, that it was also your code, that I had modified. (see below) Next time I'll be more careful Gregor > > > I've modified this one slightly, with a surprising effect > (I conjecture mainly due to avoiding copying p repeatedly): > > def primes(): > yield(-1) > p = [2, 3] > > for x in p: yield x > def is_prime(n): > for factor in p: > > if factor**2 > n: return True > if n%factor == 0: return False > multiple = 6 > while True: > for cand in multiple-1, multiple+1: > if is_prime(cand): > yield cand > p.append(cand) > multiple += 6 > > Time: 100000: 0.14 s 500000: 1.05 s > ----- > > > Yeah, I like the 'for cand in multiple-1, multiple+1'. I actually did > do it that way on a previous occasion. So this is very interesting. > > - Michel From gregor.lingl at aon.at Mon Jan 19 03:11:46 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Mon, 19 Jan 2009 03:11:46 +0100 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <4973BBD8.4070909@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <4973BBD8.4070909@aon.at> Message-ID: <4973E162.5030302@aon.at> This is a corrected version of my previous posting. (1) According to the complaint of Michel I have inserted *his* code instead of Kirby's, which ocurred there (for a second time). (2) According to a suggestion of Andre I've added (towards the end of the posting) the code form the cookbook, which is ingenious but not the fastest one. (3) I've updated the table of the timings. Regards, Gregor kirby urner schrieb: > I think you're correct that the sieve best works with a pre-specified > finite domain: .... >> To continue work in this area one (or at least me) has to have >> some criteria to judge the solutions. >> Clearly it was advantageous if there was some consensus about >> these criteria in the community. >> > > Fortunately, we have hundreds of years of math pedagogy, so in terms > of avoiding quarrels, start with what's already on the books are "must > have" and just render it Pythonically. .... >> There should be some criteria concerning >> (a) the choice of problems and themes, >> e.g. to prefer small problems that expose a single idea - or >> rather not >> ... etc., >> as well as some >> (b) code related criteria, like clarity, conciseness, efficiency, >> beauty (!) >> etc., ranked according to >> their priorities. >> > > This will be up to each professional teacher in whatever walk of life > -- to judge what to include and what to exclude. Each teacher will > find her or himself in agreement with some, disagreement with others, > over what to include. Twas ever thus. > I think it's not that easy. I'd like to dive a bit into this topic, resuming the code examples given in this thread and adding a few additional ideas. What concerns efficiency, I've measured the time to compute the 9592/9593 primes in the range up to 100000 and (in order to get some idea how the algorithm scales) also those up to 500000 (on my machine). Here is your, Kirby's, code: def primes(): sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway yield sofar[0] # get these out of the way yield sofar[1] # the only even prime yield sofar[2] # and then 3 candidate = 5 # we'll increment from here on while True: # go forever for factor in sofar[1:]: # skip -1 (or don't use it in the first place) if factor ** 2 > candidate: # did we pass? yield candidate # woo hoo! sofar.append(candidate) # keep the gold break # onward! if not candidate % factor: # oops, no remainder break # this is a composite candidate += 2 # next odd number please Time: 100000: 1.71 s 500000: 42.72 s ----- Michel Paul's code: def primes(): p = [-1, 2, 3] for x in p: yield x def is_prime(n): for factor in p[1:]: if factor**2 > n: return True if n%factor == 0: return False multiple = 6 while True: if is_prime(multiple-1): yield multiple-1; p.append(multiple-1) if is_prime(multiple+1): yield multiple + 1; p.append(multiple+1) multiple += 6 Time: 100000: 1.58 s 500000: 32.25 s ----- I've modified this one slightly, with a surprising effect (I conjecture mainly due to avoiding copying p repeatedly): def primes(): yield(-1) p = [2, 3] for x in p: yield x def is_prime(n): for factor in p: if factor**2 > n: return True if n%factor == 0: return False multiple = 6 while True: for cand in multiple-1, multiple+1: if is_prime(cand): yield cand p.append(cand) multiple += 6 Time: 100000: 0.14 s 500000: 1.05 s ----- Scott Daniels code: def primes(): for x in -1, 2, 3: yield x gen = primes().next for top in iter(gen, 3): pass # skip useless tests (we skip all multiples of 2 or 3) factors = [] # get pump ready for a 5 check = -1 limit = 3 * 3 - 2 # How far will 3 work as top prime? factors = [] while True: check += 6 if check >= limit: # move if this pair needs another factor top = gen() limit = top * top - 2 # limit for both candidates factors.append(top) for element in check, check + 2: for factor in factors: if element % factor == 0: break else: yield element Time: 100000: 0.07 s 500000: 0.50 s ----- Compare the above generators to sieve algorithms: G.L. minimal sieve def primes(n): s = set(range(3,n+1,2)) for m in range(3, int(n**.5)+1, 2): s.difference_update(range(m*m, n+1, 2*m)) return [2]*(2<=n) + sorted(s) Time: 100000: 0.014 s 500000: 0.11 s ----- G.L.: sieve def primes(n): s = set(range(3,n+1,2)) if n >= 2: s.add(2) m=3 while m * m < n: s.difference_update(range(m*m, n+1, 2*m)) m += 2 while m not in s: m += 2 return sorted(s) Time: 100000: 0.012 s 500000: 0.086 s ----- Apparently sieves are considerably faster at the cost that the whole sieve has to be calculated before the primes can be retrieved. Not a disadvantage if you only want to know the n-th prime. So this suggests to make use of the sieve-paradigm also for prime generators. Here is a rather primitive example: G.L. sieve based generator: def primes(): CHUNKSIZE = 5000 # arbitrary even primes = [] yield 2 # first chunk candidates = range(3,CHUNKSIZE,2) chunk = set(candidates) for m in candidates: if m*m > CHUNKSIZE: break chunk.difference_update(range(m*m, CHUNKSIZE, m)) chunk = sorted(list(chunk)) for p in chunk: yield p primes.extend(chunk) lower = CHUNKSIZE # more chunks while True: upper = lower + CHUNKSIZE chunk = set(range(lower+1,upper,2)) for m in primes: if m*m > upper: break chunk.difference_update(range(lower + m - lower%m, upper, m)) chunk = sorted(list(chunk)) for p in chunk: yield p primes.extend(chunk) lower = upper Time: 100000: 0.023 s 500000: 0.113 s ----- Of course there are many more possibilities to realize this, for instance to use slice-assignment instead of sets. This would require some somewhat opaque index calculations, but be - as far as I rember - even faster. Particularly I suppose that there exist faster algorithms for generating primes, but I admittedly don't know them. To one more we were pointed by Andre Roberge. It is form the Python cookbook (2nd ed.). Stupendous, but not easy to understand imho, especially as a disguised sieve of Eratosthenes (and not Erathosthenes!) D strangely contains just the next composite numbers, which normally are cancelled from the sieve. So this sieve doesn't first "cancel all multiples of 2" and then all those of three etc. but just the nearest still not cancelled multiples of all the primes already found. Marvelous! def eratosthenes(): '''Yields the sequence of prime numbers via the Sieve of Erathosthenes.''' D = {} # map each composite integer to its first-found prime factor for q in itertools.count(2): # q gets 2, 3, 4, 5, ... ad infinitum p = D.pop(q, None) if p is None: # q not a key in D, so q is a prime, therefore, yield it yield q # mark q square as not-prime (with q as first found prime factor) D[q*q] = q else: # q is a composite number with p as its first-found prime number # So, let's try to find the next smallest possible composite to # add and that was not already present with the same first-found # prime number x = q + p while x in D: x += p D[x] = p Time: 100000: 0.067 s 500000: 0.34 s ----- ====================================================== Summing up: Kirby 1.71 s 42.72 s Michel Paul 1.58 s 32.25 s Michel Paul modified:: 0.14 s 1.05 s Scott Daniels: 0.07 s 0.50 s G.L. minimal sieve: 0.014 s 0.109 s G.L. sieve: 0.012 s 0.086 s G.L. sieve-based generator: 0.023 s 0.113 s (performance depends on CHUNKSIZE) cookbook - sieve generator: 0.067 s 0.34 s This exposes in my opinion an unsurmountable dilemma, namely that usually you cannot meet even those few criteria mentioned in the beginning in a single solution. So under the aspects you exposed at the beginning of this thread, "Pythonic Math", which title in some sense includes and/or addresses this dilemma, how would you prefer to weight those criteria? Regards Gregor > From mpaul213 at gmail.com Mon Jan 19 04:06:35 2009 From: mpaul213 at gmail.com (michel paul) Date: Sun, 18 Jan 2009 19:06:35 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <4973E162.5030302@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <4973BBD8.4070909@aon.at> <4973E162.5030302@aon.at> Message-ID: <40ea4eb00901181906i2152ad80t1727f8244f92f248@mail.gmail.com> On Sun, Jan 18, 2009 at 6:11 PM, Gregor Lingl wrote: > This exposes in my opinion an unsurmountable dilemma, namely > that usually you cannot meet even those few criteria mentioned > in the beginning in a single solution. I think it's OK that there's not a 'single' solution. If I saw math students interested in coming up with their own ways to generate primes, even if not optimized, wow, I'd be thrilled. I gave my math students the opportunity to do end of semester projects using either Python or GeoGebra . One kid emailed me saying he had figured out a way to generate any number of rows of Pascal's triangle using Python, and he wanted to know if this would be an OK kind of project. I found that really interesting given the topics in this thread occurring simultaneously. I replied to him "Absolutely!" I haven't seen his code yet, but I'm really glad that this is what he wanted to explore. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Jan 19 06:21:40 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 18 Jan 2009 21:21:40 -0800 Subject: [Edu-sig] Pythonic Math must include... In-Reply-To: <4973BBD8.4070909@aon.at> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <496FE3F2.1050004@aon.at> <49728870.1040101@aon.at> <4973BBD8.4070909@aon.at> Message-ID: On Sun, Jan 18, 2009 at 3:31 PM, Gregor Lingl wrote: << SNIP >> > Of course there are many more possibilities to realize this, for > instance to use slice-assignment instead of sets. This would > require some somewhat opaque index calculations, but be - as far > as I rember - even faster. Particularly I suppose that there > exist faster algorithms for generating primes, but I admittedly > don't know them. > > ====================================================== > > Summing up: > > Kirby 1.71 s 42.72 s > Michel Paul 1.58 s 32.25 s > Michel Paul modified:: 0.14 s 1.05 s > Scott Daniels: 0.07 s 0.50 s > G.L. minimal sieve: 0.014 s 0.109 s > G.L. sieve: 0.012 s 0.086 s > G.L. sieve-based generator: 0.023 s 0.113 s > (performance depends on CHUNKSIZE) > > This exposes in my opinion an unsurmountable dilemma, namely > that usually you cannot meet even those few criteria mentioned > in the beginning in a single solution. > So under the aspects you exposed at the beginning of this thread, > "Pythonic Math", which title in some sense includes and/or addresses > this dilemma, how would you prefer to weight those criteria? > > Regards > > Gregor Hey Gregor, I'm really pleased you would do some careful analysis regarding efficiency, one of the several criteria you mentioned. I do think it's important to look at mathematics as an energetic, ergo economic, activity, in the sense of consuming clock cycles while burning through joules, calories (Roz Savage is one of my "action figures" in my curriculum writing, burning joules as she rows the Atlantic). First Person Physics is likewise focused in athletics, stress medicine. An inefficient algorithm may well cost you, eat into your free time, when you could be cutting yourself slack by putting a little more thought into your technique. Efficiency matters. Sometimes we say "the math is bad" because it's just too dang slow, even if correct (years too late). You want a reasoning process able to keep up with the demands of the day. So, again, agreeing with you, efficiency is a critical parameter (interesting conversations with my colleague Trevor Blake on precisely this point at FG the other day (FG of Fine Grind Productions, undertaken with Jody Francis (cns.cfo)). On the other hand, if we're really trying to be blindingly fast, why are we using Python at all? Answer: we're not really trying to be as fast as possible. We're more like this: http://www.istockphoto.com/file_thumbview_approve/422526/2/istockphoto_422526_slug_race.jpg Speed of execution must not be what matters most. We're avoiding cluttering our code with type declarations (yay). We're indulging in clean syntax, no curly braces. We're learning something cross-platform, respected by industry. Which is why we're *not* using VBA-per-Access or VB# (smile). Trial by division is just one of those generic topics the pre-computer mathematicians would dwell upon, in contrast to the sieve, not that they're unrelated. Given we're quite young, just learning about composite versus prime, starting to get our feet wet in algebra, which is more abstract this time around, thanks to operator overloading, thanks to "modulo numbers", we have more of an interest in the timeline, the chronology. How have people tackled this problem, of getting prime numbers of arbitrary size. Why do we call them "probable primes" in that Jython method? By the way, here's a class, adapted from my trial-by-division generator, that saves state in object variables, and so doesn't need to be written with yield. class Primes(): def __init__(self): self.sofar = [-1, 2,3] # a running start, -1 proposed by J.H. Conway self.counter = 0 self.maxprime = 3 def __next__(self): if self.counter < 3: self.counter = self.counter + 1 return self.sofar[self.counter - 1] candidate = self.maxprime + 2 # we'll increment from here on while True: for factor in self.sofar[1:]: # skip -1 (or don't use it in the first place) if factor ** 2 > candidate: # did we pass? self.sofar.append(candidate) # keep the gold self.maxprime = candidate self.counter += 1 return candidate # woo hoo! if not candidate % factor: # oops, no remainder break # this is a composite candidate += 2 # next odd number please In action, this looks a lot like a generator, except we're also using numeric indexing to retrieve any prime so far, a new wrinkle: >>> from trialbydivision import Primes >>> g = Primes() >>> next(g) -1 >>> next(g) 2 >>> next(g) 3 >>> next(g) 5 >>> next(g) 7 >>> next(g) 11 >>> next(g) 13 >>> next(g) 17 >>> next(g) 19 >>> next(g) 23 >>> g[3] 5 >>> g[10] Traceback (most recent call last): File "", line 1, in g[10] File "/home/kirby/trialbydivision.py", line 26, in __getitem__ return self.sofar[index] IndexError: list index out of range >>> g[8] 19 >>> g[6] 13 That we're able to work through either method in but seconds or less, up to what would have seemed pretty high numbers to be dealing with concretely, just a few decades back (ignoring scientific notation, talking about mantissas), would have seemed quasi-incredible to these Egyptian scribes or Imperial desk jobbers or whatever they were. How deeply do we want to go into the Python? Must we do both the generator *and* the class versions? It's not a matter of "must" (we hope) so much as each student following an IEP (an "individual learning plan"), freely exploring in ways that make sense. In your peer group, is it more important to develop this talent or that, this skill or that? There's a reason it's called "a gymnasium" in German I think: the different machines are marked, as to which muscle groups they exercise. If you're racing through in a crypto thread, anxious to get to the RSA part, then maybe we don't waste your time on the intricacies of metaclasses or deques. On the other hand, if you're anxious to master Python the language, because of a newspaper job where Django gets used, then don't waste your time on RSA just now, focus on regular expressions. Work back from your goals, anticipate job requirements, cram where you think it'll pay off. Encourage students to make these calculations themselves. It's not all up to the guidance counselors, or shouldn't be. Obviously, if it's a "group march" (the typical classroom, taking kids through as a group), with teacher as tour guide, then it's good to give some up front info about what's to be covered, with referrals to other options if this doesn't sound like what you're into. Corporate training same deal: (e.g) in this class, we will be looking at CREATE TABLE syntax in SQL for 30 mins, then moving to the "Django way" of specifying tables. Lunch. Then a review, a few more running examples. We're used to this from OSCON, Pycon, whatever conferences: a catalog of offerings with blurbs as to what to expect. Imagine these topic sections in a Gnu Math PDF: SQL and supermarket management SQL and library science SQL and hotel reservations systems ... (many more, all with SQL -- students filter through in different queues) My Saturday Academy course in April won't have much SQL even though this is a good age to learn some, is mostly about two ways of rendering computer graphics: either by real time animation (Sims, games, VRML, VPython, Pygame) or by high lag time ray tracing (POV-Ray). We talk about Model, View, Controller (MVC) where our Model is persistent data in an algebra, a View is a rendering (visualization), and the Controller is Python. In sum, I think the stress to put on the "time efficiency" is related to the goals of the particular class (this doesn't sound controversial to me ears, more like a truism). In many math classes, where the goal is conceptual clarity and fluency within specific namespaces (language games), we will consider the fast response times of an interpreted bytecode language such as Python to be miraculous in comparison to our old ways with paper and pencil. We're like that old Xerox commercial with that monk copyist (that's what they'd do all day: transcribe), satisfied to finally have a fast photocopier. http://www.youtube.com/watch?v=_IgH2M02xek In our intro to maths context, we will prefer short and succinct over cluttered, even at a speed cost. In another [13-16 college] course, we'll maybe learn MMIX and use that instead, covering a lot of the same algorithms. This literature is already well developed, so no need to reinvent that wheel. http://www-cs-faculty.stanford.edu/~uno/taocp.html Note: my trial-by-divison code is quirky cluttered with comments, plus some would complain the -1 is cluttering things. Others are glad to see J.H. Conway's suggestion finally percolating outward in some subculture's archive (Python Nation's in this case). Kirby From kirby.urner at gmail.com Tue Jan 20 00:24:09 2009 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 19 Jan 2009 15:24:09 -0800 Subject: [Edu-sig] another "must have" generator Message-ID: This is just to get junior experimenting with convergence / divergence on the complex plane. c is our variable. Per this Wikipedia article (fine to project in class, why not, though "teacher reading from encyclopedia" shouldn't come off as mechanical): See: http://en.wikipedia.org/wiki/Mandelbrot_set Also: http://www.4dsolutions.net/ocn/fractals.html IDLE 3.0a2 >>> def mandelbrot(c): z = 0 + c while True: yield z z = z ** 2 + c >>> c1 = mandelbrot(1) >>> next(c1) 1 >>> next(c1) 2 >>> next(c1) 5 >>> next(c1) 26 >>> next(c1) 677 >>> ci = mandelbrot(1j) >>> next(ci) 1j >>> next(ci) (-1+1j) >>> next(ci) -1j >>> next(ci) (-1+1j) >>> next(ci) -1j >>> next(ci) (-1+1j) >>> Taking inventory of what I have so far in my Python toolkit: Figurate Numbers Pascal's Triangle (triangular and tetrahedral numbers) Fibonacci Numbers (converge to phi, pentagon math) Vectors (VPython -- xyz, spherical coordinates etc.) Prime Numbers (sieves) Prime Numbers (trials by division) Polyhedra (as Python objects: scale, rotate, translate) Polyhedral Numbers (icosahedral, geodesic spheres) Modulo Numbers (override __mul__, __add__) Finite Groups (Python module) Euclid's Algorithm (Guido's gcd) Euclid's Extended Algorithm (needed for inverses) Totient and Totative (gcd based) Fermat's Little Theorem (assert...) Euler's Theorem for Totients (assert...) Mandelbrot Set (chaotic sequences) Miller-Rabin (or Jython probablePrime) RSA.encrypt(m, N) RSA.decrypt(c, N, d=secretkey) ... I've ordered these roughly in sequence of first encounter, assuming numerous loop-backs and repetitions (Saxon a good model -- called spiraling with scaffolding), thinking roughly grades 9-12, though some adults will do this sequence as a refresher or first time exposure to basic numeracy. This is in no way a complete list, just a smattering of dots, curriculum "nodes" as it were. For some of it, I'd expect to switch more into a "music appreciation" mode i.e. we spend too little time explaining why on earth we do so much around polynomials, make them an in-depth vocational exercise without promising anything specific about their job relevance. When was the last time any of you needed to factor a polynomial for work, and couldn't use Mathematica? Time was, if you lived in Pisa and could factor a 3rd or 4th degree polynomial of a specific form, you could attract a patron for a kind of cerebral cockfighting that went on. """ In 1530, Niccol? Tartaglia (1500-1557) received two problems in cubic equations from Zuanne da Coi and announced that he could solve them. He was soon challenged by Fiore, which led to a famous contest between the two. Each contestant had to put up a certain amount of money and to propose a number of problems for his rival to solve. Whoever solved more problems within 30 days would get all the money. Tartaglia received questions in the form x3 + mx = n, for which he had worked out a general method. Fiore received questions in the form x3 + mx2 = n, which proved to be too difficult for him to solve, and Tartaglia won the contest. """ [ http://en.wikipedia.org/wiki/Cubic_equation ] The lack of an historical dimension in modern math teaching is just another symptom of out-of-control overspecialization, what we're seeking to counter with these more integrative approaches. Moving to executable notations is a clear sign of the times, ample evidence that "time marches on", so it makes sense that we're more time-aware, no longer supposing that the grade school math of our grandparents is the math of our children. Since when did time stand still? I've got more ideas for offering refresher numeracy courses to adults at the Math Forum. A lot of the focus will be instructional game playing on LCDs, sometimes with real money involved, definitely working towards credentialing i.e. adding scores to transcripts, which implies access to testing centers. The coffee shop may still be the best place to study, bone up for that job interview. http://www.youtube.com/watch?v=bfgO-LXGpTM Kirby From kirby.urner at gmail.com Tue Jan 20 00:58:31 2009 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 19 Jan 2009 15:58:31 -0800 Subject: [Edu-sig] another "must have" generator In-Reply-To: References: Message-ID: > I've got more ideas for offering refresher numeracy courses to adults > at the Math Forum. A lot of the focus will be instructional game > playing on LCDs, sometimes with real money involved, definitely > working towards credentialing i.e. adding scores to transcripts, which > implies access to testing centers. The coffee shop may still be the > best place to study, bone up for that job interview. More context from the Math Forum: http://mathforum.org/kb/thread.jspa?threadID=1887801&tstart=0 -- back to my Coffee Shops Network idea, where you get bright LCDs but not so much of that isolated "study carrel" approach, unless you rent one of the private rooms, like at CubeSpace. I don't want to just focus on outreach to children, when it comes to Pythonic Math. What might we offer to busy adults, in addition to Safari, Showmedo, Python 411, Python.org itself? I wonder if PSF is aware of many "Python commercials" in the pipeline. Ruby seems more aggressive at self promotion. http://www.youtube.com/watch?v=528BCJiRkks What with Monty and scary snakes, we've certainly got a strong base to play from, if wanting to advertise. Kirby > > http://www.youtube.com/watch?v=bfgO-LXGpTM > > Kirby > From macquigg at ece.arizona.edu Tue Jan 20 10:52:13 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Tue, 20 Jan 2009 02:52:13 -0700 Subject: [Edu-sig] Topics for CS2 In-Reply-To: References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> Hi Kirby, Many thanks for the thoughtful review of my PythonOOP chapter. I especially like the suggestions to put more emphasis on the role of over-rides in *specializing* the behavior of subclasses, and to at least mention commonly-used CS terms like "polymorphism". I'll keep your suggestions for the next time I do any revisions on this chapter. If you or anyone else wants to make more extensive modifications, target a different audience, etc., I'll be glad to work with you. No reason we can't have multiple versions targeted to different groups. There may be some misunderstanding as to my purpose in writing this chapter. It is not a CS1 introduction to OOP. I would recommend Zelle or Goldwasser for that. It was written before those texts, and specifically for engineers who already know some programming, understand very well the need for modular design (no need for motivation of OOP), and who have learned Python up through chapter 18 of Lutz and Ascher (no need to explain __notation__). It could be an alternative, or a supplement, to the OOP chapters in L&A. It could also be part of the CS2 class I am now proposing, for students who already know Java or C. Some of my choices on what topics to emphasize may be different. These choices were based on my own experience, which may be different than others, and is certainly different from those who have a less pragmatic approach to languages. Thus, I have relegated operator over-riding to "advanced topics" because of my perception that it will be used less often than say, static methods, which I have included in my first large example. I use static methods frequently. They are now (as of version 2.4) more "pythonic" than when this chapter was written, so I feel I made the right choice. If my Animals class hierarchy seems artificial, it may be because I tried to illustrate everything I considered important, and do it in the smallest example that would still be clear. The comparison of classes to modules is not motivated by any affinity to Perl. What little I know of Perl, I don't like. Rather, it is part of an answer to the question "Why do we need classes?" Modules are the closest thing to classes as a unit of encapsulation. With a simple function, you could generate instances of modules as easily as instantiating objects from classes. You could even change the language slightly, and allow multiple modules per file. As for making OOP a "revelation", I think that is the wrong way to teach it, especially for non-CS students. I much prefer to treat it as just another way to encapsulate pieces of a program, a way that is very natural when you are modeling objects in the real world, and can be beneficial even when there is no parallel in the real world - the benefit flowing from the extra flexibility you have in encapsulation. That is something all engineers will understand. The "revelation" approach completely turned me off when I first read about OOP in the early 90's. As a skeptical engineer, I was left with the impression that OOP, polymorphism, etc., was a pile of hype, and there was nothing there I couldn't do in FORTRAN, BASIC, or C. It wasn't until I started using Python in 2002, that I saw the benefits. I like that Python doesn't mystify OOP, or push it the way Java does, but just makes it a natural thing to do. Again, if anyone wants to modify this document for their own purposes, I'll be glad to help. -- Dave At 08:21 PM 1/17/2009 -0800, kirby urner wrote: >Hi David -- > >I've been looking at your PythonOOP. > >Why use classes? All programming aside, I think it's a fairly strong >grammatical model of how people think, basically in terms of >noun.adjective (data attribute) and noun.verb() (callable method). >All talk of computer languages aside, we're very noun-oriented, think >in terms of "things" and these things either "are" or "have" >attributes and "do" verby stuff. > >OOP is about making the language talk about the problem domain, help >us forget that under the hood nightmare of chips and registers, >needing to allocate memory... all that stupid computer stuff that >nobody cares about (smile). > >Of course I like your nomenclature of a Cat inheriting from Animal as >I'm always tying "hierarchy" back to "zoology" and "taxonomy" as those >were original liberal arts tree structures (class hierarchies, >kingdoms, domains, namespaces). We like "astral bodies" subclassed >into stars, planets, planetoids (like Pluto), and moons. We like >"Reptiles" including "Snakes" which of course includes "Pythons" >(everything is a python in Python, i.e. an object with a __rib__ >cage). > >Having a Dog and a Monkey motivates why ancestor classes are >important: generic shared stuff, like digestion, might be handled in >a shared eat() method, each with its own self.stomach of course. With >a younger set (pre-college), those parentheses connote lips, with args >as oral intake. In the class of classes though... we give birth. > >Per a recent PPUG, I'm these days thinking to use a collections.deque >for my digestive tract maybe: > >>>> class Animal: > def __init__(self): > self.stomach = deque() > def eat(self, item): > self.stomach.append(item) > def poop(self): > if len(self.stomach)>0: > return self.stomach.popleft() > > >>>> zebra = Animal() >>>> zebra.eat('straw') >>>> zebra.stomach >deque(['straw']) >>>> zebra.poop() >'straw' >>>> zebra.stomach >deque([]) >>>> > >Some will want to say digestive_tract instead of stomach. > >Now you can develop your Dog and Cat, inheriting eat() and __init__ >from Animal, yet each subclass providing its own __repr__ methods. >"Hello world, I'm a Cat at %s" % id(self). Yes, you could make the >__repr__ invoke __class__.__name__ and share it -- show that later.... >? > >>>> class Animal: > def __init__(self): > self.stomach = deque() > def eat(self, item): > self.stomach.append(item) > def poop(self): > if len(self.stomach)>0: > return self.stomach.popleft() > def __repr__(self): > return "I'm a %s at %s" % (self.__class__.__name__, id(self)) > > >>>> class Dog(Animal): > pass > >>>> class Cat(Animal): > pass > >>>> thing1 = Dog() >>>> thing2 = Cat() >>>> thing1 >I'm a Dog at 138223820 >>>> thing2 >I'm a Cat at 138223852 > >Students see how inheritance means specializing as you go down the >tree (consistent with most introductory treatments). > >Your spin seems to tilted towards Cats with not enough other >subclasses of Animal to make inheritance seem all that necessary. >Your ancestor is mostly for "herding cats" (counting instances), isn't >so much a "blueprint" for different subclasses of the Animal idea >(aardvark versus eel). > >More generally I think using an ancestor class to do instance counting >is a little on the "too difficult" side for a core introductory >running example. It leads you to introduce an interception of __del__ >as your first example of operator over-riding. This seems rather >unpythonic, as the __del__ method is rather rarely intercepted, >compared to say __set__ and __get__ (per Alex Martelli in this lecture >@ Google: http://controlroom.blogspot.com/2009/01/oop-in-hour.html >). > >I was also struck by how often you compare classes to modules (modules >in Chapter 16 right?), suggesting a Perlish upbringing -- as did your >suggestion to use '_' in place of 'self' for "maximal uncluttering" >(paraphrase). > >When Perl decided to make the leap to OO, it was "the module" that got >blessed for this purpose yes? Are you a closet Perl Monger then? > >I notice you tend to favor your private terminology and don't resort >to the CS vocabulary as often, e.g. "polymorphic" and "polymorphism" >are not included. If you're wanting your students to gain fluency >with the surrounding literature, I think at least that one deserves >more focus, in conjunction with inheritance. > >I think the a first class could be all data (like a C struct). Like, >this example says a lot: > >>>> class Foo: > bar = 1 > > >>>> f = Foo() >>>> g = Foo() >>>> f.bar = 1 >>>> f.bar = 2 >>>> g.bar >1 >>>> f.bar >2 >>>> f.__dict__ >{'bar': 2} >>>> g.__dict__ >{} >>>> g.bar >1 > >however once you start adding methods, I don't think postponing the >appearance of __init__ for so long is a good idea. I would focus on a >Dog and a Cat (or any other two animals), both with __init__ >constructors and eat methods, then (as a next step) introduce the >Animal superclass as a case of "refactoring" by inheritance -- a good >time to mention the "is a" abstraction (a Dog "is an" Animal). Show >how you're economizing on code by having an ancestor, make OO seem >like a revelation (which it is/was). > >I don't think you're alone in finding __ribs__ somewhat intimidating, >strange-looking (a hallmark of Python), but I think these should be >tackled right away, perhaps with built-in data types first, i.e. that >2 .__add__(2) example. How about a function call ribs() that prints >the special names in any object... > >>>> import re >>>> ex = re.compile("__[a-z]+__") > >>>> def ribs(it): > return re.findall(ex, " ".join(dir(it))) > >I think of __init__ as being triggered by a "birth syntax" i.e. to >call a class directly, as in Animal(), is to call for an instance of >that class, and that invokes __init__ (__new__ first though). > >>>> class Foo: > def __init__(self): > print("I am born!") > > @staticmethod > def __call__(): > print("What?") > > >>>> f = Foo() >I am born! >>>> f() >What? >>>> Foo.__call__() >What? > >I like your point that intercepting __add__ is just like >"intercepting" an Animal's 'talk' method in a subclass, i.e. >interception is happening in both cases, it's just that some names are >special (as you say) in being triggered by *syntax* rather than their >actual names -- although that form is also usable (as you point out >using __add__) -- plus some special names *don't* have special >triggering syntax, i.e. just use the __rib__ directly, as in "if >__name__ == '__main__':" > >I like this section: > >Background on Languages >- languages poster >- progression of languages 1 2 > - domain-specific (FORTRAN, COBOL) > - general-purpose, high-level (C) > - one step above assembler > - problem was complexity, one big pile of data > - object-oriented (C++) > - data now contained within independent objects > - human oriented (Java, Python) > - garbage collection > - dynamic typing > >... and your focus on Mandelbrot / fractals. > >Lots of substance. > >Kirby > >On Thu, Jan 15, 2009 at 3:09 PM, David MacQuigg > wrote: >> I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. >> >> As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study. >> >> Additional suggestions are welcome. >> >> -- Dave >> >> >> _______________________________________________ >> Edu-sig mailing list >> Edu-sig at python.org >> http://mail.python.org/mailman/listinfo/edu-sig From kirby.urner at gmail.com Tue Jan 20 17:45:26 2009 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 20 Jan 2009 08:45:26 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> Message-ID: On Tue, Jan 20, 2009 at 1:52 AM, David MacQuigg wrote: <<>> [ watching Obama motorcade on CRT to my left, typing to LCD on my laptop ] > There may be some misunderstanding as to my purpose in writing this chapter. It is not a CS1 introduction to OOP. I would recommend Zelle or Goldwasser for that. It was written before those texts, and specifically for engineers who already know some programming, understand very well the need for modular design (no need for motivation of OOP), and who have learned Python up through chapter 18 of Lutz and Ascher (no need to explain __notation__). It could be an alternative, or a supplement, to the OOP chapters in L&A. It could also be part of the CS2 class I am now proposing, for students who already know Java or C. > Probably I was confusing your "module" and "modular" (cite Perl below) in that you relate Objects to both, which of course makes sense, in terms of encapsulated name spaces. Classes, unlike mere modules, have progeny, ancestors, spawn multiple instances of themselves without duplicated more bits than necessary. You're clear about this distinction, which I liked. Your role as the teacher most specializing (customizing) to these students is a good example of how curriculum writing itself has a modular aspect, and a subclassing (tiering) from more to less generalized. You've got a very specific mix in mind, a certain type of sophistication. I likewise have my different biases. On a scale of 1-10, overriding __del__ in the process of doing subclass instance counting in a parent class, is like 8 or 9, especially where you bring __mro__ into it. So yes, I see your desire to include arcana. You're being respectful of your students' already high level of initiation. > Some of my choices on what topics to emphasize may be different. These choices were based on my own experience, which may be different than others, and is certainly different from those who have a less pragmatic approach to languages. Thus, I have relegated operator over-riding to "advanced topics" because of my perception that it will be used less often than say, static methods, which I have included in my first large example. I use static methods frequently. They are now (as of version 2.4) more "pythonic" than when this chapter was written, so I feel I made the right choice. > I'm inclined to see + and * in a continuum with [] and (), in that the former trigger __add__ and __mul__ whereas the latter trigger __getitem__ and __call__ (or __init__). In other words "operator over-riding" tends to blend in with all manner of syntax-invoked method triggering. The fact that * + and such used to be segregated as "immutable operators" gets forgotten in the rough and tumble. We don't keep quite the same unary / binary fixation either, in that a.__add__(b) is an act of consumption (a eats b, maybe returns c of some type), just as is f(1) an act of consumption (swallowing a name). a * b is a "munch" operation, in that __mul__ (or __rmul__) is getting invoked. In the old days, I tell my students, numbers were stupid, they couldn't do anything, didn't know anything. Operators descended from heaven, like space ships, and caused numbers to be added and multiplied. But in Python, everything is a snake, a live object, including numbers like 1 and 2, and they have knowledge of addition and multiplication "in their bones" (__ribs__). When you go 1 * 2, that's not a space ship, bristling with static methods from on high, from the alien "knows operations" land, that's invoking an innate ability of the integer type. It's a change in gestalt, especially if you start with the old one. > If my Animals class hierarchy seems artificial, it may be because I tried to illustrate everything I considered important, and do it in the smallest example that would still be clear. The comparison of classes to modules is not motivated by any affinity to Perl. What little I know of Perl, I don't like. Rather, it is part of an answer to the question "Why do we need classes?" Modules are the closest thing to classes as a unit of encapsulation. With a simple function, you could generate instances of modules as easily as instantiating objects from classes. You could even change the language slightly, and allow multiple modules per file. > I'm biased against modules because I start at the shell and don't care about saving any .py files for awhile, have no interest in anything but the current namespace, like a white board. My simplest unit is the primitive object, like 1 or 'a', an integer or string. We do a dir on both of these, show they "have guts" i.e. are endowed with methods. So a number like 2 is a primitive name space, in containing (encapsulating) a lot of behaviors. Next up, data structures or collections, things like iterables, like lists, tuples. Each supports dot notation to methods, has an interior. With functions, you the user start getting more mutable stuff to play with. You can set attributes on function objects (a type of callable). So by the time we get to classes (types), we already have plenty of micro-ecologies as examples, all without every saving a module if we like. The .py format is for persistence, but it's like entering all those lines in the shell really fast, even grabbing your own command line arguments via sys.args. Modules define name spaces, for sure. Use dot notation for access. Also, remember __init__.py is a kind of intercepting at the modular level in that you're customizing the behavior of 'import'. In this sense, there's a class-like aspect to a directory of .py files (to import is to __init__). This is not a direct contradiction of any point you've made, just a hook to the package concept. > As for making OOP a "revelation", I think that is the wrong way to teach it, especially for non-CS students. I much prefer to treat it as just another way to encapsulate pieces of a program, a way that is very natural when you are modeling objects in the real world, and can be beneficial even when there is no parallel in the real world - the benefit flowing from the extra flexibility you have in encapsulation. That is something all engineers will understand. The "revelation" approach completely turned me off when I first read about OOP in the early 90's. As a skeptical engineer, I was left with the impression that OOP, polymorphism, etc., was a pile of hype, and there was nothing there I couldn't do in FORTRAN, BASIC, or C. It wasn't until I started using Python in 2002, that I saw the benefits. I like that Python doesn't mystify OOP, or push it the way Java does, but just makes it a natural thing to do. > Yes, that transition to OOP was upsetting as a paradigm change. I went through it on the xBase path, following dBase II (derived from some JPL language) through its winged migration, fork off to Clipper, FoxPro, buyout by Microsoft and Borland, FoxPro for Windows, Visual FoxPro. The full OO paradigm came across, unlike for the VB crowd, who didn't get that until later. This all happened in my little world *before* I ever wrote a line of Python (plus I got to Java first). APL was the first computer language I ever learned (loved it), then FORTRAN (yawn). However, the real benefit of OO is it hooks to natural language, where students in human languages, like Sumerian, like Greek, already know about nouns, verbs and adjectives as parts of speech. OO is all about noun.verb() and noun.adjective. Then with have these little cartoons about sharing pointers (names) to objects and we're done, they're convinced there's a real grammar here, a logic, and dive in, happy to still be in the humanities, no talk of "computer hardware" need apply (though it's handy to have). This isn't "hyping" so much as "bridging". In industry, it's about town-gown relations, where "town" is an administrative layer atop cube farmers, and "gown" is IT. With ORM, we're finally starting to get admin enrolled in seeing it from IT's point of view, whereas SQL by itself was just not friendly enough. OO makes computing more personable. To have busy administrators see 'self' as like "a little ego with a personal __dict__ clipboard" is not "dumbing it down" is rather taking advantage of well-worn patterns in grammar, leveraging what we've already got. It's efficient. Don't just say "is a", say "I am a". This isn't just cute, it's a conceptually smart way to think about a hospital, school or airport (objects all). But that's me to busy administrators, not you to enrolled electrical engineers. Different audiences = different patter, we both know that. > Again, if anyone wants to modify this document for their own purposes, I'll be glad to help. > > -- Dave > Thank you for making your work public and open source in this way. You are kind to offer it up for comments and to handle the feedback graciously, especially given my many different biases. Kirby [ Barack Obama about to get sworn in, make his speech -- new president object ] From kirby.urner at gmail.com Tue Jan 20 19:44:45 2009 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 20 Jan 2009 10:44:45 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> Message-ID: On Tue, Jan 20, 2009 at 8:45 AM, kirby urner wrote: > On Tue, Jan 20, 2009 at 1:52 AM, David MacQuigg > wrote: > > <<>> > > [ watching Obama motorcade on CRT to my left, typing to LCD on my laptop ] > >> There may be some misunderstanding as to my purpose in writing this chapter. It is not a CS1 introduction to OOP. I would recommend Zelle or Goldwasser for that. It was written before those texts, and specifically for engineers who already know some programming, understand very well the need for modular design (no need for motivation of OOP), and who have learned Python up through chapter 18 of Lutz and Ascher (no need to explain __notation__). It could be an alternative, or a supplement, to the OOP chapters in L&A. It could also be part of the CS2 class I am now proposing, for students who already know Java or C. >> > > Probably I was confusing your "module" and "modular" (cite Perl below) > in that you relate Objects to both, which of course makes sense, in > terms of encapsulated name spaces. Classes, unlike mere modules, have > progeny, ancestors, spawn multiple instances of themselves without > duplicated more bits than necessary. You're clear about this > distinction, which I liked. > > Your role as the teacher most specializing (customizing) to these > students is a good example of how curriculum writing itself has a > modular aspect, and a subclassing (tiering) from more to less > generalized. You've got a very specific mix in mind, a certain type > of sophistication. I likewise have my different biases. > > On a scale of 1-10, overriding __del__ in the process of doing > subclass instance counting in a parent class, is like 8 or 9, > especially where you bring __mro__ into it. So yes, I see your desire > to include arcana. You're being respectful of your students' already > high level of initiation. > >> Some of my choices on what topics to emphasize may be different. These choices were based on my own experience, which may be different than others, and is certainly different from those who have a less pragmatic approach to languages. Thus, I have relegated operator over-riding to "advanced topics" because of my perception that it will be used less often than say, static methods, which I have included in my first large example. I use static methods frequently. They are now (as of version 2.4) more "pythonic" than when this chapter was written, so I feel I made the right choice. >> > > I'm inclined to see + and * in a continuum with [] and (), in that the > former trigger __add__ and __mul__ whereas the latter trigger > __getitem__ and __call__ (or __init__). > > In other words "operator over-riding" tends to blend in with all > manner of syntax-invoked method triggering. The fact that * + and > such used to be segregated as "immutable operators" gets forgotten in > the rough and tumble. > > We don't keep quite the same unary / binary fixation either, in that > a.__add__(b) is an act of consumption (a eats b, maybe returns c of > some type), just as is f(1) an act of consumption (swallowing a name). > a * b is a "munch" operation, in that __mul__ (or __rmul__) is > getting invoked. > > In the old days, I tell my students, numbers were stupid, they > couldn't do anything, didn't know anything. Operators descended from > heaven, like space ships, and caused numbers to be added and > multiplied. > > But in Python, everything is a snake, a live object, including numbers > like 1 and 2, and they have knowledge of addition and multiplication > "in their bones" (__ribs__). When you go 1 * 2, that's not a space > ship, bristling with static methods from on high, from the alien > "knows operations" land, that's invoking an innate ability of the > integer type. > I made a fun cartoon out of the above: http://mybizmo.blogspot.com/2009/01/transitions-of-power.html My more technical argument, about how OO changes our view of operators, in this older paper, where my nouns are quaternions: http://www.4dsolutions.net/ocn/oopalgebra.html Kirby > It's a change in gestalt, especially if you start with the old one. From macquigg at ece.arizona.edu Thu Jan 22 22:06:19 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Thu, 22 Jan 2009 14:06:19 -0700 Subject: [Edu-sig] Topics for CS2 In-Reply-To: References: <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20090122115249.01592a70@mail.ece.arizona.edu> At 08:45 AM 1/20/2009 -0800, kirby urner wrote: >On Tue, Jan 20, 2009 at 1:52 AM, David MacQuigg wrote: >> There may be some misunderstanding as to my purpose in writing this chapter. >... > >On a scale of 1-10, overriding __del__ in the process of doing >subclass instance counting in a parent class, is like 8 or 9, >especially where you bring __mro__ into it. So yes, I see your desire >to include arcana. You're being respectful of your students' already >high level of initiation. All this is in the "Advanced Topics" section at the end. I probably should make that a separate chapter to avoid any distraction. The part I expect students at the CS2 level to understand is in the first 12 pages, and that should be free of arcana. ... >But in Python, everything is a snake, a live object, including numbers >like 1 and 2, and they have knowledge of addition and multiplication >"in their bones" (__ribs__). When you go 1 * 2, that's not a space >ship, bristling with static methods from on high, from the alien >"knows operations" land, that's invoking an innate ability of the >integer type. > >It's a change in gestalt, especially if you start with the old one. ... >> As for making OOP a "revelation", I think that is the wrong way to teach it, especially for non-CS students. I much prefer to treat it as just another way to encapsulate pieces of a program, a way that is very natural when you are modeling objects in the real world, and can be beneficial even when there is no parallel in the real world - the benefit flowing from the extra flexibility you have in encapsulation. That is something all engineers will understand. The "revelation" approach completely turned me off when I first read about OOP in the early 90's. As a skeptical engineer, I was left with the impression that OOP, polymorphism, etc., was a pile of hype, and there was nothing there I couldn't do in FORTRAN, BASIC, or C. It wasn't until I started using Python in 2002, that I saw the benefits. I like that Python doesn't mystify OOP, or push it the way Java does, but just makes it a natural thing to do. >> > >Yes, that transition to OOP was upsetting as a paradigm change. I >went through it on the xBase path, following dBase II (derived from >some JPL language) through its winged migration, fork off to Clipper, >FoxPro, buyout by Microsoft and Borland, FoxPro for Windows, Visual >FoxPro. The full OO paradigm came across, unlike for the VB crowd, >who didn't get that until later. This all happened in my little world >*before* I ever wrote a line of Python (plus I got to Java first). >APL was the first computer language I ever learned (loved it), then >FORTRAN (yawn). > >However, the real benefit of OO is it hooks to natural language, where >students in human languages, like Sumerian, like Greek, already know >about nouns, verbs and adjectives as parts of speech. OO is all about >noun.verb() and noun.adjective. Then with have these little cartoons >about sharing pointers (names) to objects and we're done, they're >convinced there's a real grammar here, a logic, and dive in, happy to >still be in the humanities, no talk of "computer hardware" need apply >(though it's handy to have). This isn't "hyping" so much as >"bridging". In industry, it's about town-gown relations, where "town" >is an administrative layer atop cube farmers, and "gown" is IT. With >ORM, we're finally starting to get admin enrolled in seeing it from >IT's point of view, whereas SQL by itself was just not friendly >enough. > >OO makes computing more personable. To have busy administrators see >'self' as like "a little ego with a personal __dict__ clipboard" is >not "dumbing it down" is rather taking advantage of well-worn patterns >in grammar, leveraging what we've already got. It's efficient. Don't >just say "is a", say "I am a". This isn't just cute, it's a >conceptually smart way to think about a hospital, school or airport >(objects all). But that's me to busy administrators, not you to >enrolled electrical engineers. Different audiences = different >patter, we both know that. I think many of us who grew up with the "old gestalt" had a hard time with the transition to OOP. Maybe the old gestalt still includes administrators, but I would be surprised if it includes high-school students. It did include engineering students a few years ago, when we had a junior-level course in OOP taught in Smalltalk, so the students would be forced to break out of their old habits and do everything in the style of OOP. We still have that course, but now the pre-requisite is a course in Java, and it has morphed to more software-engineering and less pounding on the necessity of OOP. It seems that the "new gestalt" should not require breaking old habits. Objects should be introduced early, the noun.verb syntax is simple, and there is little need for motivation, revelation, or elaborate analogies by the time the students get to crafting their own objects. That seems to be the approach taken by newer texts, and it would have been beneficial for me also. It really wasn't the difficulty of the OOP paradigm that held us back, but the awkwardness of the languages, which perhaps created a need to force-feed and over-sell the idea of OOP, which turned off pragmatic folks like myself. We still have that awkwardness in our intro Java courses, but it seems to have been accepted as a minor inconvenience ("Just memorize this stuff, we'll explain it later."). I put together a sequence of Python examples for the transition to OOP, and added them to my collection for CS2 ( http://ece.arizona.edu/~edatools/index_classes.htm ). The emphasis is practical benefits, not any attempt to sell OOP. The principle is that you chose the level of structure that is right for your problem, bearing in mind that real-world problems tend to grow, so a little extra structure at the beginning often saves time in the end. The final example shows how Python can do everything that Java does, including private parts, and interface definitions. >Thank you for making your work public and open source in this way. >You are kind to offer it up for comments and to handle the feedback >graciously, especially given my many different biases. And thank you for your constructive criticism, which is always appreciated. -- Dave From Scott.Daniels at Acm.Org Fri Jan 23 01:01:37 2009 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Thu, 22 Jan 2009 16:01:37 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090117111156.0343da00@plus.pop.mail.yahoo.com> References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090117111156.0343da00@plus.pop.mail.yahoo.com> Message-ID: David MacQuigg wrote: > I've added a few more topics to http://ece.arizona.edu/~edatools/CS2/P4SE.txt, including Black Hole, and Wave-Particle Paradox. Any physicists on the list? I'll do the programming if you can advise me on the physics. > > H Bomb - start with a bowling ball of LiDT. Squeeze til it goes boom. How much compression is needed? Try smaller balls. > > Black Hole - start with a bowling ball of neutrons. Squeeze til it collapses. How big is the black hole (the radius at which photons get sucked in)? > > Wave-Particle Paradox - two detectors with equal probability of detecting any particle from a specific source. Prior to detection, the particle exists only as a wave function with equal intensity at both detectors. When the particle appears at detector A, how does detector B know instantly not to detect the same particle? > Model the problem with two slits generating an interference pattern on a screen. Slow the simulation down until you can observe individual particles. Make sure you delete the wave, once its particle has been detected. That avoids the wave-particle problem, at least in the virtual reality of your simulation. > Could the universe be a computer, and all we see of it is a virtual reality? The gods who wrote the program had everything worked out except the problem of what happens to the wave after it turns into a particle. So they just added an instruction to delete the wave. That seems to me more plausible than an infinite number of parallel universes, or the crazy story about Schrodinger's cat being nothing but a wave function that decides if it is dead or alive only when the box is opened. What about the guy opening the box? Is he also a wave function, waiting for someone to open the door to the lab? > > -- Dave > > > At 04:09 PM 1/15/2009 -0700, David MacQuigg wrote: >> I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. >> >> As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study. >> >> Additional suggestions are welcome. >> >> -- Dave In PythonOOP.doc (page 4) you say: > There are two pieces of "magic" that make line 3 work. First, the > interpreter has to find the method set_vars. It's not in cat2. Then, > the instance cat2 has to be inserted as the first argument to et_vars. > The method is found by a search starting at cat2 ( the instance on > which the method is called ). The search then proceeds to the parent > class, then to the grandparent, and so on up to object, the ancestor > of all Animal classes. In this case, we find set_vars in Cat. For instances of subclasses of object (such as Cat), method lookups start in Cat, not cat2. If you try to set cat2.set_vars, you cannot (because a method is a property stored in he class), and you will try the set method of that property which will fail. Simple class variables are over-ridden by assignments to the instance values, but properties are not. --Scott David Daniels Scott.Daniels at Acm.Org the property, From Scott.Daniels at Acm.Org Fri Jan 23 01:14:29 2009 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Thu, 22 Jan 2009 16:14:29 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: References: <40ea4eb00901150635i741ebc8fqba49fa2a894ea8a7@mail.gmail.com> <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090117111156.0343da00@plus.pop.mail.yahoo.com> Message-ID: Scott David Daniels wrote: I wrote: > In PythonOOP.doc (page 4) you say: > > There are two pieces of "magic" that make line 3 work. First, the > > interpreter has to find the method set_vars. It's not in cat2. Then, > > the instance cat2 has to be inserted as the first argument to et_vars. > > The method is found by a search starting at cat2 ( the instance on > > which the method is called ). The search then proceeds to the parent > > class, then to the grandparent, and so on up to object, the ancestor > > of all Animal classes. In this case, we find set_vars in Cat. > > For instances of subclasses of object (such as Cat), method lookups > start in Cat, not cat2. If you try to set cat2.set_vars, you cannot > (because a method is a property stored in he class), and you will try > the set method of that property which will fail. Simple class variables > are over-ridden by assignments to the instance values, but properties > are not. And then immediately went to make a test case, which failed. Which I should, of course, done before hitting send. I retract my comment and will get back to you when I get my understanding straightened out. --Scott David Daniels Scott.Daniels at Acm.Org From kirby.urner at gmail.com Fri Jan 23 01:24:05 2009 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 22 Jan 2009 16:24:05 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090122115249.01592a70@mail.ece.arizona.edu> References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090118075616.03419f20@mail.ece.arizona.edu> <5.2.1.1.0.20090122115249.01592a70@mail.ece.arizona.edu> Message-ID: > I think many of us who grew up with the "old gestalt" had a hard time with the transition to OOP. Maybe the old gestalt still includes administrators, but I would be surprised if it includes high-school students. It did include engineering students a few years ago, when we had a junior-level course in OOP taught in Smalltalk, so the students would be forced to break out of their old habits and do everything in the style of OOP. We still have that course, but now the pre-requisite is a course in Java, and it has morphed to more software-engineering and less pounding on the necessity of OOP. > Yes, reminds me of the New Math of the 1960s and the subsequent backlash, teachers bitter about having their authority undermined by all this newfangled set notation, unions and intersections of this and that, a lotta b.s. some of 'em thought, made 'em hate Sputnik, all that bleeping noise. But then a lot from that era did stick around, a lot of reforms in early math curriculum writing (e.g. Dolciani). Newer text books helped glue together our current algebra thru calculus pipeline, which colleges still treat as a superhighway through admissions, aka ye old "Calculus Mountain" of Pycon 2008. Besides just OO, lambda calculus made the leap to machine executable, with its functional concepts ("big lambda"). Then we've got Haskell and like that, so it's not like OO is all alone in this brave new world of executable logics, anticipated by Leibniz, Ada, and Dr. Vannevar Bush, the latter writing about hypertext and search engines in the 1940s if not in those terms. Left behind on the far side of the digital divide were the calculator crowd with their "white board" logics -- stuff that only "works" on paper. Mathematica rescued a lot of that stuff, forcing long overdue house-cleaning. In the old typography, f(x) is quite ambiguous as it might as well mean f * x or f eats x. In Python, those aren't so different, in that __mul__ eats a name as its argument. a * b and a(b) are really quite similar, in that () triggers __call__, just another __rib__, like __mul__. We think different now, thanks not just to Smalltalk, but to Apple and NeXT, all helping to make OO real in the workplace. High schools languish because there's this "you can't make me attitude" on the part of professionals, who perceive evolutionary pressures as "other people telling me what to do". Pride gets in the way. Not saying this is a unique case. We all tend to get stuck in the mud of our own generation. That's why we've each got this TTL I suppose, like in tcp/ip -- a sensible design. As a result of this languishing, many future engineers must do their serious studying after hours, in cyberspace, where we yak about SQL, RSA, Unicode, Ruby... -- all "the good stuff" they're likely not getting from Portland Public (yet). > It seems that the "new gestalt" should not require breaking old habits. Objects should be introduced early, the noun.verb syntax is simple, and there is little need for motivation, revelation, or elaborate analogies by the time the students get to crafting their own objects. That seems to be the approach taken by newer texts, and it would have been beneficial for me also. It really wasn't the difficulty of the OOP paradigm that held us back, but the awkwardness of the languages, which perhaps created a need to force-feed and over-sell the idea of OOP, which turned off pragmatic folks like myself. We still have that awkwardness in our intro Java courses, but it seems to have been accepted as a minor inconvenience ("Just memorize this stuff, we'll explain it later."). > An early algebra class, lesson plan: Ms. Jones shows her students how to use their totatives function to populate a list with Modulo Numbers. Their "closure checker", written as a Python generator, inspires discussion about groups. Use a prime modulus next time, talk about fields. Source code: from random import choice def gcd(a,b): while b: a, b = b, a % b return a def totatives(n): return [ x for x in range(1, n) if gcd(x, n) == 1] class Modulo: m = 12 def __init__(self, n): self.n = n % Modulo.m def __mul__(self, other): return Modulo(self.n * other.n) def __eq__(self, other): return self.n == other.n def __repr__(self): return str(self.n) def closure_checker(pool): while True: a = choice(pool) b = choice(pool) result = a * b assert result in pool yield "%s * %s == %s" % (a, b, result) >>> from algebra import * >>> p = totatives(12) >>> thegroup = [Modulo(x) for x in p] >>> thegroup [1, 5, 7, 11] >>> g = closure_checker(thegroup) >>> next(g) '5 * 7 == 11' >>> next(g) '5 * 7 == 11' >>> next(g) '11 * 11 == 1' >>> next(g) '5 * 5 == 1' >>> next(g) '7 * 7 == 1' >>> next(g) '11 * 7 == 5' The Modulo class is somewhat subtle in that the self.__dict__ n values are simply integer type, so whereas the __mul__ intercepts, it doesn't do so recursively i.e. it's Modulo(self.n * other.n) or int * int for an arg, not Modulo(self * other) -- which goes into a recursive tailspin. We'll use these same Modulo Numbers to talk about their powers (** operator, or __pow__), assert Euler's theorem. >>Thank you for making your work public and open source in this way. >>You are kind to offer it up for comments and to handle the feedback >>graciously, especially given my many different biases. > > And thank you for your constructive criticism, which is always appreciated. > > -- Dave Let's hope you continue getting a lot of useful feedback from a variety of viewpoints. Kirby From echerlin at gmail.com Fri Jan 23 06:33:14 2009 From: echerlin at gmail.com (Edward Cherlin) Date: Thu, 22 Jan 2009 21:33:14 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> Message-ID: On Thu, Jan 15, 2009 at 3:09 PM, David MacQuigg wrote: > I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. Earth Treasury might be interested in working with you on this, if you are willing to have it distributed under a Free license in multiple languages. We are working on teaching Computer Science ideas in an age-appropriate manner on the OLPC XO starting in third grade, or if possible earlier, using Smalltalk, Turtle Art, Logo, Python, and other powerful tools, and continuing through 12th grade at least. We will also be using the XO's digital oscilloscope capability (Measure Activity) to teach science and engineering. The outline of our project, with the names of our confirmed partners and a few prospective partners we are talking with, is at http://wiki.sugarlabs.org/go/Creating_textbooks. We will have more announcements of partners, resources, projects, and so forth fairly soon. > As you can see from the very few links to completed examples, this is just a start. Many of the links are only to discussions on this list, and I really appreciate the suggestions I have received so far. Also, it is far from a representative survey or optimum sample, rather just a random sample of topics that I found interesting. Some of the topics may be out of reach for students at this level, but that is the challenge. Figure out a way to present a complex or theoretically difficult topic in a way that is simple and intuitive and will whet the students appetite for further study. > > Additional suggestions are welcome. > > -- Dave > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -- Silent Thunder (??/???????????????/????????????? ?) is my name And Children are my nation. The Cosmos is my dwelling place, The Truth my destination. http://wiki.sugarlabs.org/go/User:Mokurai From macquigg at ece.arizona.edu Fri Jan 23 17:44:15 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Fri, 23 Jan 2009 09:44:15 -0700 Subject: [Edu-sig] Topics for CS2 In-Reply-To: References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20090123093559.033a00c8@mail.ece.arizona.edu> At 09:33 PM 1/22/2009 -0800, Edward Cherlin wrote: >On Thu, Jan 15, 2009 at 3:09 PM, David MacQuigg wrote: >> I'm putting together a list of topics for a proposed course entitled "Programming for Scientists and Engineers". See the link to CS2 under http://ece.arizona.edu/~edatools/index_classes.htm. This is intended as a follow-on to an introductory course in either Java or C, so the students will have some exposure to programming, but the Java students won't know machine-level programming, and the C students won't have any OOP. For the proposed course, we will use the example programs as a way to introduce these topics. > >Earth Treasury might be interested in working with you on this, if you >are willing to have it distributed under a Free license in multiple >languages. No problem. >We are working on teaching Computer Science ideas in an >age-appropriate manner on the OLPC XO starting in third grade, or if >possible earlier, using Smalltalk, Turtle Art, Logo, Python, and other >powerful tools, and continuing through 12th grade at least. We will >also be using the XO's digital oscilloscope capability (Measure >Activity) to teach science and engineering. I could see some of these CS2 programs being useful for high-school students, especially if they have already learned a computer language. No reason they can't be at the same level in programming as college students in the USA. >The outline of our project, with the names of our confirmed partners >and a few prospective partners we are talking with, is at >http://wiki.sugarlabs.org/go/Creating_textbooks. I had no idea these little laptops could run Linux. Cool. -- Dave From kirby.urner at gmail.com Fri Jan 23 19:07:50 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 23 Jan 2009 10:07:50 -0800 Subject: [Edu-sig] Topics for CS2 In-Reply-To: <5.2.1.1.0.20090123093559.033a00c8@mail.ece.arizona.edu> References: <5.2.1.1.0.20090115125322.0343da00@mail.ece.arizona.edu> <5.2.1.1.0.20090123093559.033a00c8@mail.ece.arizona.edu> Message-ID: On Fri, Jan 23, 2009 at 8:44 AM, David MacQuigg wrote: << SNIP >> > I had no idea these little laptops could run Linux. Cool. > > -- Dave Future tell all journalism needed but there's a lot of RedHat under the hood, Python too slow for an operating system, an agile, needs an aquarium to play safe in, with other VHLL friends (high level life forms... like Squeak, yum). So yeah, those G1G1 toy-looking toyz are quite the thing to have if you're a North American, proves you're thinking ahead, some kind of genius maybe, or at least a blogger of high repute. You'll notice I milk mine for all its worth ("mooo" says the little xo), plus now I have two, thanks to Hong Kong connections. I nominated OLPC's Negroponte for Math Czar in DC, spoofing this tendency to have a "czar" for everything, starting with that general for drugs. Either him or Richard Stallman, truly innovative spirits, very remote from the corrupted text book industries and their fly-by-night traffic in dead trees (shudder), both pure as the driven snow. But then I'm really against stupid top-down curriculum regimes, like in old Europe. 50 states = 50 laboratories, designed to compete, vie for leadership, not all toe some party line set in some faraway swamplands (a wonderful city, spent many years there) -- better to anchor in Anchorage why not? More fun. Or Hawaii maybe? Here's da link: http://mathforum.org/kb/thread.jspa?threadID=1889066&tstart=0 My Chicago slides contain pro XO PR, point out that OLPC.xo.pippy contains Fibonacci's and Pascal's both in its namespace, even if not in Py3K generator format (OK, so Portland's ahead, what we'd expect from an open source capital). A core focus of my talk is the purpose of "lore", not just as idle banter, but as glue for the technical stuff, an orthogonal axis. Here's that graph, consider fixed arrow length as representing an upper limit on bandwidth (in our human subject): http://www.flickr.com/photos/17157315 at N00/3214428790/ (note: "Saxon" refers to this military guy who thought US math textbooks sucked, created his own, caught on with the home schoolers, gave 'em an edge on tests, entre to top schools, quite a story, remind me to say more). Kirby > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From roberto03 at gmail.com Fri Jan 23 22:11:40 2009 From: roberto03 at gmail.com (roberto) Date: Fri, 23 Jan 2009 22:11:40 +0100 Subject: [Edu-sig] another "must have" generator In-Reply-To: References: Message-ID: <4bcde3e10901231311l7e2e0aen1831962850fd3e5f@mail.gmail.com> On Tue, Jan 20, 2009 at 12:24 AM, kirby urner wrote: > For some of it, I'd expect to switch more into a "music appreciation" > mode i.e. we spend too little time explaining why on earth we do so > much around polynomials, make them an in-depth vocational exercise > without promising anything specific about their job relevance. When > was the last time any of you needed to factor a polynomial for work, > and couldn't use Mathematica? > i definitely agree with you and since i am a young teacher in italy i am struggling to change the wave which suffocate the desire for math in students ... i plan to cook some resource where math is taught in reverse order, i.e. starting from real-young world and only after you show the theory behind since i know many are on the same point of view, please let me know how to get in contact with other teachers working in this direction thank you anyway -- roberto OS: GNU/Linux Debian Kubuntu, Edubuntu From kirby.urner at gmail.com Fri Jan 23 22:55:17 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 23 Jan 2009 13:55:17 -0800 Subject: [Edu-sig] Another lesson plan (Euler's Theorem) from OCN / CSN Message-ID: So here's more computer algebra, ready for phase-in, base camps in the Columbia Gorge (like computer camps for girl scouts, astronomy encouraged). You can project computer languages around the campfire if you have the right equipment, bed sheet between trees, but that's really a lot of work probably, thinking ahead to Montana (NPYM). Might just all download the same Podcasts and watch separately, when the time comes (still a group storytelling experience). OK, so here's the shell session, nothing spectacular, just another one of our "theorem checkers" using try/except around an assert, something we expect to always be true, provided stipulations get met. Here's what's interesting: the last example craps out, not because of the newly added __pow__ method, which is optimized internally for modulo powering (special algorithm per Knuth, Tim Peters confirming it's in Python) but because my totatives function is completely inefficient. The preferred pipeline for totient, memorialized in my ray-tracing of that formula for phi (Euler's preferred right?), in that paper with K. Iverson, was to show the prime factors approach, much more affordable (once you get those prime factors, let's not bleep over): http://www.4dsolutions.net/ocn/graphics/phistone.jpg http://www.4dsolutions.net/ocn/Jlang.html Ah, but getting prime factors is a hard problem, or can be, whereas my little engine starts up the Himalayas at a snail's speed, breaks before getting to the summit. But that's really OK. We're exploring the meme pool, and time/energy *is* a factor, as Gregor so eloquently riffed about. We accept that a conceptually clear algorithm may be impracticable in some real world situations, want students hip and alert to that fact. Let's be clear: sometimes we just *don't have* any algorithm for job x, that'll work in your life time. Because of proofs in mathematics we're able to be up front about that, tell the brat emperor when there's just no way (in theory anyway, gets dicey sometimes). The flip side of that shortcoming is we have pretty good privacy when we need it. So, without further ado: >>> from algebra import * >>> euler_checker(217, base=5) True!: pow(5, 180, 217) == 1 >>> euler_checker(17) True!: pow(2, 16, 17) == 1 >>> euler_checker(13452199029039023920, base=2) Pick a different base please >>> euler_checker(13452199029039023921, base=2) Traceback (most recent call last): File "", line 1, in euler_checker(13452199029039023921, base=2) File "/home/kirby/algebra.py", line 37, in euler_checker totient = len(totatives(N)) File "/home/kirby/algebra.py", line 9, in totatives return [ x for x in range(1, n) if gcd(x, n) == 1] File "/home/kirby/algebra.py", line 9, in return [ x for x in range(1, n) if gcd(x, n) == 1] File "/home/kirby/algebra.py", line 5, in gcd a, b = b, a % b KeyboardInterrupt ============= from random import choice def gcd(a,b): while b: a, b = b, a % b return a def totatives(n): return [ x for x in range(1, n) if gcd(x, n) == 1] class Modulo: m = 12 def __init__(self, n): self.n = n % Modulo.m def __mul__(self, other): return Modulo(self * other) def __pow__(self, n): return Modulo(pow(self.n, n, Modulo.m)) def __eq__(self, other): return self.n == other.n def __repr__(self): return str(self.n) def closure_checker(pool): while True: a, b = choice(pool), choice(pool) result = a * b assert result in pool yield "%s * %s == %s" % (a, b, result) def euler_checker(N, base=2): """ a check (not a proof) of Euler's Theorem """ if gcd(base, N) == 1: # coprime? totient = len(totatives(N)) try: assert pow(base, totient, N) == 1 print("True!: pow(%s, %s, %s) == 1" % (base, totient, N)) except: print("False!: pow(%s, %s, %s) != 1" % (base, totient, N)) else: # (base, N) not coprime print("Pick a different base please.") Kirby Urner Abbreviations decoded: OCN: Oregon Curriculum Network (4dsolutions.net/ocn) CSN: Coffee Shops Network (YouTube commercial: http://www.youtube.com/watch?v=0Oad0libltM special thx to jimmlott.com, and csn.cto nirel) Here's another geeky YouTube commercial I like, for Ruby on Rails: http://www.youtube.com/watch?v=91C7ax0UAAc&feature=rec-HM-fresh+div (more from Python Nation? -- still needing judges for 'The Writhe' contest: http://mybizmo.blogspot.com/2008/10/ppug-20081014.html ) From kirby.urner at gmail.com Fri Jan 23 22:56:16 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 23 Jan 2009 13:56:16 -0800 Subject: [Edu-sig] another "must have" generator In-Reply-To: <4bcde3e10901231311l7e2e0aen1831962850fd3e5f@mail.gmail.com> References: <4bcde3e10901231311l7e2e0aen1831962850fd3e5f@mail.gmail.com> Message-ID: You sound like a brave man roberto. You've come to the right place. :) Kirby On Fri, Jan 23, 2009 at 1:11 PM, roberto wrote: > On Tue, Jan 20, 2009 at 12:24 AM, kirby urner wrote: >> For some of it, I'd expect to switch more into a "music appreciation" >> mode i.e. we spend too little time explaining why on earth we do so >> much around polynomials, make them an in-depth vocational exercise >> without promising anything specific about their job relevance. When >> was the last time any of you needed to factor a polynomial for work, >> and couldn't use Mathematica? >> > > i definitely agree with you and since i am a young teacher in italy i > am struggling to change the wave which suffocate the desire for math > in students ... > > i plan to cook some resource where math is taught in reverse order, > i.e. starting from real-young world and only after you show the theory > behind > > since i know many are on the same point of view, please let me know > how to get in contact with other teachers working in this direction > > thank you anyway > > -- > roberto > OS: GNU/Linux > Debian > Kubuntu, Edubuntu > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From kirby.urner at gmail.com Sat Jan 24 01:14:09 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 23 Jan 2009 16:14:09 -0800 Subject: [Edu-sig] New Python book by J. Zelle and D. Reed (woo hoo!) Message-ID: On Fri, Jan 23, 2009 at 3:45 PM, jim leisy wrote: > Hi there, Kirby--Happy 2009. Obama says it all. > > FYI--we have published a book that transitions from a first course using > Python to a data structures course using C++. > The title is Data Structures and Algorithms using Python and C++. David Reed > and John Zelle are the authors. Here is the > book's web page: www.fbeedle.com/2335.html > > Jim > > Jim Leisy > Publisher > Franklin, Beedle & Associates Incorporated > William, James & Company > www.fbeedle.com www.wmjasco.com > 503-682-7668 voice > 503-682-7638 fax > 800-322-2665 Toll Free in USA > > 8536 SW St Helens Drive, Suite D > Wilsonville, Oregon 97070 USA > Hi Jim -- Excellent, a promising approach to a language we'll be using for a long time to come (fast system languages won't be re-invented on a whim). I know John Zelle as one of the best Python teachers in the business, right up there with Bruce Eckel and Alex Martelli, but with a lot more Tk, an under-valued library -- so yes, a good 2 part sequence, core Python with Tk, then a CS2 dive into C++, the basis of wx and much other Pythonic collateral. Java and C# will seem easy in comparison, but won't always be the right tool for the job. I like the cover, reminds us that nature out-processes us all, data-wise -- glad we get a niche. We'll maybe see you at OS Bridge? I've been in on some of the meetings, don't know the publisher exhibiting angle yet, hoping to give Portlanders something to chew on, in the absence of a PDX OSCON. http://bridgepdx.org/ Also looking forward to the flying circus at Pycon again (no plane ticket yet): http://mybizmo.blogspot.com/2008/10/pythonic-math.html "Obama" sounds a lot like "Ubuntu" in translation (community spirit, hope). Kirby Urner 4dsolutions.net cc: edu-sig From gregor.lingl at aon.at Tue Jan 27 03:12:39 2009 From: gregor.lingl at aon.at (Gregor Lingl) Date: Tue, 27 Jan 2009 03:12:39 +0100 Subject: [Edu-sig] another "must have" generator In-Reply-To: References: Message-ID: <497E6D97.5030604@aon.at> kirby urner schrieb: > This is just to get junior experimenting with convergence / divergence > on the complex plane. c is our variable. > > Per this Wikipedia article (fine to project in class, why not, though > "teacher reading from encyclopedia" shouldn't come off as mechanical): > > See: http://en.wikipedia.org/wiki/Mandelbrot_set > Also: http://www.4dsolutions.net/ocn/fractals.html > > IDLE 3.0a2 > >>>> def mandelbrot(c): >>>> > z = 0 + c > while True: > yield z > z = z ** 2 + c > > > May I again add an interesting thing, this time another indispensable generator, more exactly: three of them: def feigenbaum1(c,x): while True: yield x x = c*x*(1-x) def feigenbaum2(c,x): while True: yield x x = c*x-c*x*x def feigenbaum3(c,x): while True: yield x x = c*(x-x**2) along with this testing/experimenting function: def feigenbaumtest(feigenbaum, iterations=80): f = feigenbaum(3.93, 0.5) for i in range(iterations): res = next(f) return res >>> feigenbaumtest(feigenbaum1, 4) 0.24761176565334103 >>> feigenbaumtest(feigenbaum2, 4) 0.24761176565334098 >>> feigenbaumtest(feigenbaum3, 4) 0.24761176565334167 >>> feigenbaumtest(feigenbaum1, 40) 0.43518828176766455 >>> feigenbaumtest(feigenbaum2, 40) 0.43518808407096854 >>> feigenbaumtest(feigenbaum3, 40) 0.43518950764209768 >>> feigenbaumtest(feigenbaum1) 0.70329204370098442 >>> feigenbaumtest(feigenbaum2) 0.8147039925205275 >>> feigenbaumtest(feigenbaum3) 0.66573747868397481 >>> Certainly something which demonstrates a (by many) unexpected relation between maths and computer science. Regards, Gregor From kirby.urner at gmail.com Tue Jan 27 21:26:49 2009 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 27 Jan 2009 12:26:49 -0800 Subject: [Edu-sig] another "must have" generator In-Reply-To: <497E6D97.5030604@aon.at> References: <497E6D97.5030604@aon.at> Message-ID: Yep, no doubt about it, we have some worthy generators, have only scratched the surface with Ramanujan's so far (fun to have extended precision decimal type for more context, cross-checking pi to a couple hundred digits maybe -- we've got that here too). You can't create vacancies for positions you've not thought of, and this "gnu math teacher" idea, of someone equipped to do both algebra and computer languages at the same time, pre-college, is a vast empty field the way I see it, precious few practitioners. You might say that's because there's no demand, but I see plenty of kids very hungry for this material, going out of their way to find it on-line. I'm just thankful we have the Internet, as those getting hooked up, including the lucky XO set, don't have to slave through a lot of pre-computerite nonsense before getting to the good stuff. Or rather, they maybe get to slave away by day (with traditional black or white boards) and learn by night (when free to use Youtube). I'm not sure how loyal this generation will be though, to those factory-style schools, given their own growing up experience. Maybe it's time to put those behind us? Do they serve a real purpose, other than day care? Some came to that position long ago, but I'm less radical, think we could pipe services like Safari into Winterhaven, our local Hogwarts, and keep those math labs humming. I know many geeks who "do the right thing" and support public schooling, work to update the curriculum, get involved in the democratic process. The temptation is to circle the wagons and do "company schools" like before Oregon became a state. Parents in high tech just don't see the point of making junior a "prisoner of malpractice" for so many years. Town-gown relations break down over such issue, employers flee elsewhere, like to Bangalore. In Portland, we keep working on bridging the gap, via OS Bridge for example (planned for June) i.e. we'd like to keep attracting high tech sector employers and their families, on the basis of our having strong schools (one of our competitive edges, besides skiing and snow boarding, great wine and cheese, beer, coffee...). Kirby On Mon, Jan 26, 2009 at 6:12 PM, Gregor Lingl wrote: > > > kirby urner schrieb: >> >> This is just to get junior experimenting with convergence / divergence >> on the complex plane. c is our variable. >> >> Per this Wikipedia article (fine to project in class, why not, though >> "teacher reading from encyclopedia" shouldn't come off as mechanical): >> >> See: http://en.wikipedia.org/wiki/Mandelbrot_set >> Also: http://www.4dsolutions.net/ocn/fractals.html >> >> IDLE 3.0a2 >> >>>>> >>>>> def mandelbrot(c): >>>>> >> >> z = 0 + c >> while True: >> yield z >> z = z ** 2 + c >> >> >> > > May I again add an interesting thing, > this time another indispensable generator, > more exactly: three of them: > > def feigenbaum1(c,x): > while True: > yield x > x = c*x*(1-x) > > > def feigenbaum2(c,x): > while True: > yield x > x = c*x-c*x*x > > > def feigenbaum3(c,x): > while True: > yield x > x = c*(x-x**2) > > along with this testing/experimenting function: > > def feigenbaumtest(feigenbaum, iterations=80): > f = feigenbaum(3.93, 0.5) > for i in range(iterations): > res = next(f) > return res > >>>> feigenbaumtest(feigenbaum1, 4) > 0.24761176565334103 >>>> feigenbaumtest(feigenbaum2, 4) > 0.24761176565334098 >>>> feigenbaumtest(feigenbaum3, 4) > 0.24761176565334167 >>>> feigenbaumtest(feigenbaum1, 40) > 0.43518828176766455 >>>> feigenbaumtest(feigenbaum2, 40) > 0.43518808407096854 >>>> feigenbaumtest(feigenbaum3, 40) > 0.43518950764209768 >>>> feigenbaumtest(feigenbaum1) > 0.70329204370098442 >>>> feigenbaumtest(feigenbaum2) > 0.8147039925205275 >>>> feigenbaumtest(feigenbaum3) > 0.66573747868397481 >>>> > > Certainly something which demonstrates a (by many) > unexpected relation between maths and computer science. > > Regards, > Gregor > > > From kirby.urner at gmail.com Tue Jan 27 22:20:16 2009 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 27 Jan 2009 13:20:16 -0800 Subject: [Edu-sig] "engineer" image (updating) Message-ID: The more I look at it, the more I'm thinking peoples' stereotype of "engineers" is what's keeping 'em from wanting to tackle any of this "programming" stuff. They think of "an engineer" as someone "cold" who lives in a florescently lit windowless basement, a stereotype, but still pretty vivid (I've been there many times). We look at this at Wanderers (Linus Pauling House group), a lot of us engineers by training, got some good insights from Dr. William Wulf, who spoke directly to bridging the "digital divide" between the "two cultures": http://mybizmo.blogspot.com/2005/04/last-isepp-lecture-2005.html Bouncing off David MacQuigg's spiel (which I liked) about OO being over-hyped within the industry, there's that whole problem of "objectifying" which we're told is callous (part of the problem), as when we "see people as objects". And that's exactly what we do, let's be honest, when writing OO code atop SQL tables, bringing all those pieces together to give us a "sim" (a model human) with a person.creditcard and a person.bankaccount who lives at person.address. What I continue to stress is that we ("we engineers") see *ourselves* that way too i.e. this isn't about being aloof and above it all, looking down on miserable animals that aren't us, as if we had gods' eye views. No, we're those patients in those beds, those people on the roller coaster, those people with shopping carts, on airplanes. We're not misanthropists. We're philanthropists (like Bill Gates, Mark Shuttleworth...). This is a lot the same ethic in open source too: no, it's not "cheap" what we're making, we're not "cutting corners", because we're designing this *for us* (not snookering some customer, not trying to pull a fast one). Of course some people *do* get away with shoddy work, but the point I'm making is engineers have plenty of incentive to do a great job, because hey, we're gonna live with the consequences, with the tools we create (or fail to create). If no one builds bridges, there won't be any, pretty simple. When I go into all this stuff about stressing "self" in Python (see archive), maybe replacing "self" with "me" just for fun, or with some Chinese character, if only as an exercise, I'm not trying to insinuate some esoteric belief system or cult religion about selfhood. I'm just wanting it to be OK to have empathy for the things we're programming about, just as any writer gets to feel for those characters, even the fictional ones. It's not "stupidly anthropomorphic" to imagine oneself as an airport or dam, any more than to imagine oneself working inside same. Bringing your kinesthetic sensibilities into play is a basis for sound civil engineering, doesn't get you off the hook from learning those formulas, but hey, don't forget what a bridge "feels like" in high winds, get it that into your bones some, like a sailor (a survival skill, we don't have all those neurons just fer nuthin' ya know). This is admittedly a lot about marketing and PR, where my head's at these days, what with OS Bridge coming up, Pycon in Chicago. I signed on to Chipy by the way, sent 'em a heads up, per this blog post: http://controlroom.blogspot.com/2009/01/more-school-business.html Kirby From macquigg at ece.arizona.edu Tue Jan 27 22:57:03 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Tue, 27 Jan 2009 14:57:03 -0700 Subject: [Edu-sig] PyBat ??? Message-ID: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> The CS Dept is considering putting a bunch of courses online, using PHP as both the development language, and as a new language to teach students. I've suggested using Python instead. I need to put together a quick demo. I'm thinking of something like javabat.com. I've used Mod_python (the Apache/Python integration), but I'm not yet proficient. Now is the time to change course, if there is a better path. Students will be entering Python code snippets into a window, and we need to run the code on a bunch of test cases, giving immediate feedback on errors, and accumulating the students' scores and work-in-progress. Running user code is a bit more of a challenge than running our code on user data, but javabat has inspired me. Any recommendations? -- Dave ************************************************************ * * David MacQuigg, PhD email: macquigg at ece.arizona.edu * * * Research Associate phone: USA 520-721-4583 * * * * ECE Department, University of Arizona * * * * 9320 East Mikelyn Lane * * * * http://purl.net/macquigg Tucson, Arizona 85710 * ************************************************************ * From kirby.urner at gmail.com Tue Jan 27 23:13:54 2009 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 27 Jan 2009 14:13:54 -0800 Subject: [Edu-sig] PyBat ??? In-Reply-To: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> References: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> Message-ID: Does it have to be either/or? I'm somewhat weak in the PHP department but only by choice, know I could learn it pronto from Safari, as the concepts are pretty much the same. You need: a place to stuff data (SQL), and ORM layer (to assemble objects), a template language (to make it all pretty), plus infrastructure like session monitoring, keeping track of users, who does what (whether RESTful or not RESTful, you still need to do it). I'm sure PHP works for this, as does Ruby, any web framework worth beans. But is your department smallish, no room in the inn for more than one language? Our Reed College in Portland has an ad in the paper for web framework developer, asking for PHP, Python and Ruby savvy. That seems like a good mix. Why not push that? Kirby On Tue, Jan 27, 2009 at 1:57 PM, David MacQuigg wrote: > The CS Dept is considering putting a bunch of courses online, using PHP as both the development language, and as a new language to teach students. I've suggested using Python instead. I need to put together a quick demo. I'm thinking of something like javabat.com. > > I've used Mod_python (the Apache/Python integration), but I'm not yet proficient. Now is the time to change course, if there is a better path. > > Students will be entering Python code snippets into a window, and we need to run the code on a bunch of test cases, giving immediate feedback on errors, and accumulating the students' scores and work-in-progress. Running user code is a bit more of a challenge than running our code on user data, but javabat has inspired me. > > Any recommendations? > > -- Dave > ************************************************************ * > * David MacQuigg, PhD email: macquigg at ece.arizona.edu * * > * Research Associate phone: USA 520-721-4583 * * * > * ECE Department, University of Arizona * * * > * 9320 East Mikelyn Lane * * * > * http://purl.net/macquigg Tucson, Arizona 85710 * > ************************************************************ * > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From andre.roberge at gmail.com Tue Jan 27 23:27:56 2009 From: andre.roberge at gmail.com (Andre Roberge) Date: Tue, 27 Jan 2009 18:27:56 -0400 Subject: [Edu-sig] PyBat ??? In-Reply-To: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> References: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> Message-ID: <7528bcdd0901271427i4b8007f0ncc5be1ec5c2b4a7@mail.gmail.com> On Tue, Jan 27, 2009 at 5:57 PM, David MacQuigg wrote: > The CS Dept is considering putting a bunch of courses online, using PHP as both the development language, and as a new language to teach students. I've suggested using Python instead. I need to put together a quick demo. I'm thinking of something like javabat.com. > > I've used Mod_python (the Apache/Python integration), but I'm not yet proficient. Now is the time to change course, if there is a better path. > > Students will be entering Python code snippets into a window, and we need to run the code on a bunch of test cases, giving immediate feedback on errors, and accumulating the students' scores and work-in-progress. Running user code is a bit more of a challenge than running our code on user data, but javabat has inspired me. > Have a look at Crunchy (http://code.google.com/p/crunchy) and in particular the doctest capability. It does not (yet) have the ability to add student scores but that could be added; otherwise, I believe it would have what you need. Crunchy's included tutorial may be useful "as is" as a demo for you; there are also a few screencasts on showmedo.com. Feel free to email me off-list with any questions about Crunchy. Andr? > Any recommendations? > > -- Dave > ************************************************************ * > * David MacQuigg, PhD email: macquigg at ece.arizona.edu * * > * Research Associate phone: USA 520-721-4583 * * * > * ECE Department, University of Arizona * * * > * 9320 East Mikelyn Lane * * * > * http://purl.net/macquigg Tucson, Arizona 85710 * > ************************************************************ * > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From da.ajoy at gmail.com Wed Jan 28 08:55:52 2009 From: da.ajoy at gmail.com (Daniel Ajoy) Date: Wed, 28 Jan 2009 02:55:52 -0500 Subject: [Edu-sig] Conway's Game Of Life in APL Message-ID: http://www.youtube.com/watch?v=a9xAKttWgP4&feature=channel_page Daniel From kirby.urner at gmail.com Thu Jan 29 06:14:57 2009 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 28 Jan 2009 21:14:57 -0800 Subject: [Edu-sig] promoting Python for Teachers Message-ID: I'm reminded by Pycon admin to promote our 'Python for Teachers' (somewhat of a community effort given I'm promoting the archive as a sleeper goldmine of great resources). So far zero booked, but we're just out of the gate here. Remember to invite your friends. :) Kirby Hands-on Python I: 3 Hands-on Python II: 4 Faster Python Programs through Optimization: 6 Application Development with IronPython: 2 Using Twisted Deferreds: 0 Beginning TurboGears: 1 Introduction to the Google App Engine: 4 Easy Concurrency with Kamaelia: 0 Working with Excel Files in Python: 3 Django in the Real World: 6 Eggs and Buildout Development: 2 Geographic Information Systems in Python: 1 Intermediate TurboGears: 1 A Curious Course on Coroutines and Concurrency: 6 Building Real-Time Network Apps with Twisted and Orbiter: 0 Introduction to Functional Web Testing With Twill and Selenium: 2 Python 401: Some Advanced Topics: 8 py.Test I: rapid testing with minimal effort: 2 py.Test II: cross-platform: 1 ToscaWidgets: Test Driven Modular Ajax: 0 Introduction to SQLAlchemy: 7 Advanced SQLAlchemy: 7 Hands on with Trac Plugins: 0 Data Storage in Python: 3 Python 101: 3 Python 102: 3 Scrape the Web: 1 Introduction to OOP: 1 Python for Teachers: 0 <--------------------- if you use Python, you're one of its teachers, ready or not! Using repoze.bfg Web Framework: 1 A Tour of the Python Standard Library: 3 Internet Programming with Python: 7 From macquigg at ece.arizona.edu Fri Jan 30 02:54:05 2009 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Thu, 29 Jan 2009 18:54:05 -0700 Subject: [Edu-sig] PyBat ??? In-Reply-To: References: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> Message-ID: <5.2.1.1.0.20090127153335.03394060@mail.ece.arizona.edu> Thanks to all for the suggestions. At 02:13 PM 1/27/2009 -0800, kirby urner wrote: >Does it have to be either/or? > >I'm somewhat weak in the PHP department but only by choice, know I >could learn it pronto from Safari, as the concepts are pretty much the >same. >... > >But is your department smallish, no room in the inn for more than one language? > >Our Reed College in Portland has an ad in the paper for web framework >developer, asking for PHP, Python and Ruby savvy. That seems like a >good mix. Why not push that? The goal is to teach fundamentals, not specific languages or applications. Our community college has a course in PHP (also Word, Excel, etc.) Also, as you point out, students can learn these pronto from Safari, once they understand the concepts. U of A freshmen currently have two choices - Java or C. Python is pretty close to Java, and I'm assuming much easier to use for website development (not familiar with what's available in Java, just an extrapolation from other projects comparing Java and Python). I know PHP is very popular in website development, but I've heard it is insecure, so I would worry about using it to run student code on a webserver. On a personal level, I probably won't be involved if the decision is PHP. I just can't see learning a whole new language for one project. Now if someone were to convince me that PHP, Ruby, or whatever, had some fundamental advantage over Python, I might change my mind. At 06:27 PM 1/27/2009 -0400, Andre Roberge wrote: >Have a look at Crunchy (http://code.google.com/p/crunchy) and in >particular the doctest capability. It does not (yet) have the ability >to add student scores but that could be added; otherwise, I believe it >would have what you need. Nice Python tutorial! What I need, however is something like a framework that can be used for other topics, not just Python. I see from page one of your tutorial that you have the same security concern as I do about running student code, and possibly crashing the University webserver. Maybe what we need is a private server, or at least a VPS, so a crash wouldn't affect anyone but this group of students. I guess I'll look into some of the "full-stack" frameworks at http://wiki.python.org/moin/WebFrameworks. -- Dave >On Tue, Jan 27, 2009 at 1:57 PM, David MacQuigg > wrote: >> The CS Dept is considering putting a bunch of courses online, using PHP as both the development language, and as a new language to teach students. I've suggested using Python instead. I need to put together a quick demo. I'm thinking of something like javabat.com. >> >> I've used Mod_python (the Apache/Python integration), but I'm not yet proficient. Now is the time to change course, if there is a better path. >> >> Students will be entering Python code snippets into a window, and we need to run the code on a bunch of test cases, giving immediate feedback on errors, and accumulating the students' scores and work-in-progress. Running user code is a bit more of a challenge than running our code on user data, but javabat has inspired me. >> >> Any recommendations? >> >> -- Dave From kirby.urner at gmail.com Fri Jan 30 04:41:28 2009 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 29 Jan 2009 19:41:28 -0800 Subject: [Edu-sig] PyBat ??? In-Reply-To: <5.2.1.1.0.20090127153335.03394060@mail.ece.arizona.edu> References: <5.2.1.1.0.20090127144002.03ed3fb0@plus.pop.mail.yahoo.com> <5.2.1.1.0.20090127153335.03394060@mail.ece.arizona.edu> Message-ID: On Thu, Jan 29, 2009 at 5:54 PM, David MacQuigg wrote: << SNIP >> > The goal is to teach fundamentals, not specific languages or applications. Our community college has a course in PHP (also Word, Excel, etc.) Also, as you point out, students can learn these pronto from Safari, once they understand the concepts. > Thank you for clarifying sir. Yes, Safari or any online collection of relevant documentation, is a requirement for getting the job done. Even if you're highly expert in one area, you're bound to stray into another where you must hit the books. An important goal is to role model "life long learner" -- not just giving lip service to that around here. > U of A freshmen currently have two choices - Java or C. Python is pretty close to Java, and I'm assuming much easier to use for website development (not familiar with what's available in Java, just an extrapolation from other projects comparing Java and Python). I know PHP is very popular in website development, but I've heard it is insecure, so I would worry about using it to run student code on a webserver. > If the idea is to use PHP as a general purpose agile, in contrast to a system language, then I think that's a bad idea. Few people write standalone applications in PHP, as PHP books will be the first to admit e.g. MySQL and PHP from Scratch, (c) 2000, QUE PHP is very web-centric. Please tell your administration that basing core studies on PHP is frowned upon, or find me one high prestige institution that does it, maybe I'm all wet. Even as a web development language, I think it's being eclipsed. > On a personal level, I probably won't be involved if the decision is PHP. I just can't see learning a whole new language for one project. Now if someone were to convince me that PHP, Ruby, or whatever, had some fundamental advantage over Python, I might change my mind. > Ruby and PHP are not in the same category in my mind. I'd say Python has better libraries and is in no way inferior to Ruby. You'll hear Ruby people saying things like "it just feels better" but that's just Coke versus Pepsi, not computer science. Kirby From kirby.urner at gmail.com Fri Jan 30 06:57:38 2009 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 29 Jan 2009 21:57:38 -0800 Subject: [Edu-sig] Python compared... Message-ID: Kinda funny I thought, from the Chipy list. ( my apologies for cross-posting instead of just giving a link -- have my reasons... ) === from Clyde Forrester to The Chicago Python Users Group date Thu, Jan 29, 2009 at 9:38 PM As promised here is a list of the languages which were or were not compared with Python at the last meeting: Languages covered: C Logo Smalltalk Groovy Java Ruby JavaScript Boo C/C++ Lua Clojure C# In addition, while not scheduled originally, Scheme was covered tcl/tk was scheduled, but not covered The following languages were not covered, and many of them were mentioned: Perl Fortran Cobol Pascal Lisp Forth PHP Whitespace Brainfuck Lolcats Visual Basic Modula Erlang SQL Snobol Awk Business Basic Focal IITran Spantran APL Assembler _______________________________________________ Chicago mailing list Chicago at python.org http://mail.python.org/mailman/listinfo/chicago From kirby.urner at gmail.com Sat Jan 31 00:07:25 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 30 Jan 2009 15:07:25 -0800 Subject: [Edu-sig] Welcome news from UK (more Pycon promo) Message-ID: I'm glad our UK math guy in residence, Sociality's Ian Benson, is planning to attend Pycon, just got his booking. We've been looking at interconnected computer science concepts and their applications in early mathematics education, namely: disambiguation (per Wikipedia, but a general concept), name collisions, namespaces. The first two are quasi-synonymous while the latter is our solution, a honkin' great feature of Python, while also the purpose of addressing more generally, URIs in particular. The Java world took the URI for the code's residence or source and turned that around ala net.4dsolutions.ocn.mathobjects, a kind of package name. That's actually harder to parse than simple "dot notation" though, where we just go: Apple.Safari Jungle.Safari OReilly.Safari Here students understand, from their own experience, how we disambiguate three meanings of Safari using "dot notation", with the prefix, like in Java, like in Python, having to do with "the source" (we hope open) or, more philosophically, "context" or "namespace"). I think a barrier to using dot notation in philosophical literature is authors have worried about all those periods interrupting the flow, i.e. how will our prose be uglified if we start going like Coxeter.4D to disambiguate from Fuller.4D, a name collision it's important to resolve, if you're going to anywhere with your Princeton philosophy courses. However, philosophy has the precedent of embedding lots of logic, going back to Bertrand Russell, Whitehead and before, continuing forward, attempting, some might surmise, to realize the Leibniz dream of machine executable codes. But no, those have already occurred, in computer science, but apparently workaday operational logic like Python, in charge of baggage carousels, air traffic control (small Siberian airport, nothing major), isn't "good enough" to merit much Ivory Tower attention. Leibniz can go blow, seems to be the prevailing attitude. However, the Wittgensteinians, with their blah blah about "language games", had the namespace idea already going. And a namespace is not just a dictionary, even though it's possible to treat one that way, as in O.__dict__. On the contrary, a namespace is more an ecology, something intricate. You may wonder how all this figures in to 'Python for Teachers', and you're right to wonder. There's a specific slide where I go: Fuller.4D Coxeter.4D Einstein.4D and then explain how the last two are disambiguated on page 119 of 'Regular Polytopes' (by Coxeter), whereas the first is presaged in the writings of Karl Menger, dimension theorist, and carries forward into our own time through a small bevy or writers. We have disambiguation problems galore, given popular ignorance of the whole idea of namespace. They give lip service to "context" but don't get its nuts and bolts importance in the Leibniz logics of our day. For example, the Wikipedia entry for Synergetics is mostly about some Springer-Verlag thing, not our American Transcendentalist writings. That's not really a problem, given how Wikipedia deals with this problem, is more just another good example, something to use in the classroom, when explaining the basics to philosophy students. Anyway, Ian keeps a lot of mathematicians in the loop besides just himself, isn't called Mr. Sociality for nothing. Kirby PS: I jumped in on Chipy on some Pyro vs. XML-RPC thread, mentioning my friend Patrick, a possible TA at our workshop (works for Synovate, Chicago-based). From kirby.urner at gmail.com Sat Jan 31 06:12:05 2009 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 30 Jan 2009 21:12:05 -0800 Subject: [Edu-sig] Welcome news from UK (more Pycon promo) In-Reply-To: References: Message-ID: On Fri, Jan 30, 2009 at 3:07 PM, kirby urner wrote: > I'm glad our UK math guy in residence, Sociality's Ian Benson, is > planning to attend Pycon, just got his booking. > > We've been looking at interconnected computer science concepts and > their applications in early mathematics education, namely: > disambiguation (per Wikipedia, but a general concept), name > collisions, namespaces. The first two are quasi-synonymous while the > latter is our solution, a honkin' great feature of Python, while also > the purpose of addressing more generally, URIs in particular. > Actually, that was a bit sloppy of me. Disambiguation is what we need to do in *response* to name collisions, i.e. when people use the same word with different meanings, they're setting themselves up for confusion, unless and until we disambiguate. Namespaces to the rescue. import this... In Wittgenstein's writing, a "language game" was sometimes given the context of "a tribe" i.e. let's just imagine this ethnicity like in 'Lost' (in fact 'Lost' is a great example), all talking this certain way, doing these practices -- important to focus on language as an "embedded" activity, i.e. more than just tongue-wagging. His 'Philosophical Investigations' begins with some guy saying 'brick' and an assistant fetching a brick. Something like that, some program in action, objects at work. This somewhat anthropological approach has applications in our business, as our "tribal languages" have the feature of operating machinery (both light and heavy) i.e. they get the tribe's work done (as do all languages in some sense -- but the electronics bit is new, something Leibniz was dreaming about, Ada too -- and so now we have tribal data centers). Wittgenstein would invent language games to "tease out" or "isolate" what we might today call "design patterns" i.e. typical superpositions of behaviors and sayings, re-encountered in varying circumstances (deja vu!) but all with a "family resemblance" e.g. "board games" or "sports involving sliding downhill in on snow" or "commanders giving orders in battle". In terms of practicing our profession, what it comes down to is geeks want to understand their own work, and so pick memorable key terms, likely to help them understand their code latter. They'll name their objects Bridge, Queue, Topic, Apache, Dwelling -- all in the public commons, available to anyone, but then if you go around relying on others' work, bringing it into your own, you don't want to confuse every Bridge with every other Bridge and so on, or the code with break down. Hence name collisions as a possibility (a danger, risk), hence namespaces (a solution), signified in dot notation. I realize this all sounds rather trivial and obvious to Pythonistas, as natural as snake's milk on breakfast cereal. However, philosophers have been slogging along with paper and pencil notations, not forced to think like computer scientists the way those Mathematica people had to, when disambiguating a few of those pre-computer math notations, rationalizing 'em to make 'em more machine-worthy. To many philosophers, our "namespaces" concept will seem a revelation, a honkin' great idea, the harbinger of liberal arts still to come. Many philosophers, confronted with Bucky Fuller's divergent meaning for "precession" for example, would suggest he use a completely different word. Or they'd say (more generally): if you don't mean by "gravity" what I mean by "gravity" then how about you say "shmavity" instead? This is a very awkward approach to disambiguation, not a good solution to the name collision problem. They're not thinking like programmers. Python's solution, and dot notation more generally, is far more logical and apropos. We're lucky we have it. As Python teachers, we're already ahead of 90% of the practicing philosophers out there. Kirby From kirby.urner at gmail.com Sat Jan 31 20:54:42 2009 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 31 Jan 2009 11:54:42 -0800 Subject: [Edu-sig] and they're off!... (race track) Message-ID: Yikes, in last place now. This horse hasn't left the gate yet. Shoulda rented that blimp maybe. Holden's other one, same day, is filling fast, not surprising (might be where I go). Kirby Thursday Classes Python 401: Some Advanced Topics (Holden): 10 py.test - rapid testing with minimal effort (Dorsey/Krekel): 4 ToscaWidgets: Test Driven Modular Ajax (Perkins): 1 Introduction to SQLAlchemy (Ellis): 10 Hands on with Trac Plugins (Kantrowitz): 1 Data Storage in Python - An Overview of Options (Muller): 5 Python 101 (Williams): 4 Scrape the Web: Strategies for programming websites that don't expect it (Laroia): 2 Introduction to Object-Oriented Programming (Goldwater) 4 py.Test cross-platform and distributed Testing (Krekel/Dorsey) 2 Python for Teachers (Urner/Holden) 0 Advanced SQLAlchemy (Kirtland/Bayer) 12 Using the repoze.bfg Web Framework (McDonough/Perkins) 1 A Tour of the Python Standard Library (Kumaran) 4 Python 102 (Williams) 4 Internet Programming with Python (Chun) 9