Re: [Edu-sig] AP Computer Science

2010-11-06 Thread kirby urner
Here in my district, both AP and IB tracks are offered.  The latter
definitely has more prestige, as in snob appeal, and is frankly
a more robust curriculum.  They're reading Howard Zinn for history
already, the Euros require it.

Then we have other step ladders into promising trajectories,
such as apprenticeships through Saturday Academy (where I'm
sometimes discovered), OHSU (teaching medical facility),
and variously tagged programs with the Urban League, AFSC,
lots of stuff I don't know about.  Some of these involve community
service, which is important to many academic institutions
(some more than others).

Python fits in through Saturday Academy, where I've led
numerous classes, including for the Hillsboro Police Dept
(where Intel is), also at Oregon Graduate Institute,
Portland State, and Reed College this summer.  These
students have ranged from roughly 12 to 18 years of age,
otherwise quite a mixed demographic, not always English
as a first language.

However, I don't bill my Python classes as Computer Science
so much, given political pressure to make this be Math,
and therefore not an elective.  You may stick to the traditional
math track, or you may switch to something more computer
science like, but your required three years for a high school
diploma will by fulfilled either way -- which isn't to say you
can't take more math than the minimum.

My expectation is that even more step ladders, with over-the-
Internet testing (at certified testing centers in many cases)
will assess candidate students for many interesting work / study
programs.  These programs will give USAers more opportunities
to venture overseas, which is always a plus when it comes to
developing geographic awareness.  Seeing more of the world
is well nigh a mandatory prerequisite for many responsible
positions.  Probably that's why IB has such currency (even
over AP):  it's a ticket to some better placements.

However, let me show my ignorance and say I don't really
know what IB has by way of computer programming.  I didn't
do IB in high school, dove into CS as a minor at Princeton,
with philosophy more front and center.  I just uploaded some
pictures of my bookshelves to give the flavor, if anyone cares
to take a peak.  On the other hand, I did score well on my AP
exams and placed directly into honors calculus, coulda done
college in 3 years if I'd floored the gas pedal, but why race
through a good time in the 'hood?  Where else was I gonna
learn more, before diving into high school math teaching in
the inner city (a few train stops from World Trade Center?

I later worked in publishing (McGraw-Hill) and learned a lot
about what makes the education industry tick.  The Internet
is a disruptive technology, which is both the good news and
the bad news.

>From my standpoint, Python is better positioned than Java
because it has more street cred in OSS circles (also OERs)
whereas the Java community stayed more proprietary for
longer.  The developing world is fascinated by Cyberia (as
in cyberspace) and its promise of free educational materials.

Having legally free operating systems makes a big difference
when hard currency is scarce.  Both Python and Java work
well in that ecosystem, whereas Visual Studio does not.
Part of what Hillsboro Police wanted us to teach was how
to use power tools while keeping it legal.  No worries about
facing accusations of piracy when you've got IBM on the
same wavelength.

Yes, that's an oversimplification about Visual Studio not
being as academically viable (given Mono etc. -- pronounced
Moe Know, not Mah No), but having something as powerful
as Python running legally for free is nothing to sneeze at.
Java too.  I work the chat line with students in Indonesia as
well as Portland, finding eager learners across the board.
Not waiting for school teachers to "make you" is one of
the secrets to success, I think we'd all agree.

Kirby

PS:  I also work with adults, such as doing that recent
gig at Johns Hopkins in Baltimore with the space telescope
people.  Here in Portland, I'm networked with a bevy of
"rad math" teachers.  Here's another one:
http://punkmathematics.com/
(you may be aware of the edupunk movement, which
seeks to bypass a lot of the established channels by
means of OERs etc. -- lots of bloggers focus on it, so
I'll avoid being overly redundant here).
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] python tutoring

2010-11-06 Thread kirby urner
I experimented with doing another one-on-one tutoring in Python,
of a 12 year old boy, right here at the Blue House (what we call
it).  The mom came along too (she knows me already).

Noah is clearly a fast learner.  At 12, he's acing 10th grade
algebra.  He told me he's already studied Java some and was
eager to dive into recursion immediately.

Speaking of recursion, search on that in Google.  It'll ask you:
did you mean recursion?  Hah hah.  Also search on "anagram"
and "ascii art" (actually, that latter only seems to work using
the search box in the top right on my browser, hmmm.

The main innovation here was how I set up the class room.
My laptop was projected to the wall, duplicating what I had
on my screen.  His laptop (property of Holden Web) powered
a VGA flatscreen on the table, duplicating what was on his
laptop screen.

This way I could see what he was seeing and he could see
what I was seeing, even though we sat facing each other
(mom did some knitting on the couch).  I also had speakers
hooked up to the projecting laptop, which turned out to]
be important.

The mom, a knitter, wanted to start things off right with a
funny cartoon she'd found.[1]  I followed up with one of my
own cartoons made with the same framework.[2]

I think it's a good idea to take breaks now and then and
look at short video clips.  On the topic of recursion he
wanted to talk about the Tower of Hanoi.  We watched
a stack of 10 being moved, with a move counter.  Noah
predicted exactly how many moves it would take.  It
took a few more than the 1023 he predicted, but then
a blurb came up saying a few extra moves had been
made.[3]  He felt very vindicated.

We also talked about that fable about the king wanting
a favor, which some guy said he'd do if only he could
get paid in rice, 1 grain on the 1st square of a chess
board, 2 grains on the next, then 4, 8, 16... doubling
each time up to all 64 squares.  The king thought that
sounded quite reasonable, but it was something of a
trick wasn't it?  Anyway, you've probably heard this
all before.

What Noah somehow already knew, is that
2**0 + 2**1 + 2**2 + ... + 2**63 == 2**64 - 1.
i.e. SIGMA (i == 0..j) 2**i == 2**(j+1) - 1.

Here's some Python to check that:

>>> 2**64 - 1 == sum([2**n for n in range(64)])
True

I'm guessing his answer for the Tower of Hanoi
(10 disks) was right too.  Yep.[4]

Kirby

[1]  actually, hers was pretty tame, involved knitting.
http://www.youtube.com/watch?v=edIlyY5_6EU
Now I see this is a whole genre, some of them
rather off color.

[2] http://www.youtube.com/watch?v=p698mXuHmTs
Yeah, a little creepy.  I offer some analysis here:
http://worldgame.blogspot.com/2009/02/regarding-objectifying.html

[3]  http://www.youtube.com/watch?v=D-bE-wmZy0w
(we skipped to near the end after awhile -- somewhat repetitive)

[4] http://mathforum.org/dr.math/faq/faq.tower.hanoi.html
>>> 2**10 - 1
1023

See also:
http://en.wikipedia.org/wiki/Power_of_two
http://www.sosmath.com/CBB/viewtopic.php?t=48174&sid=2ad1972ed1e8fc4efbf8aa30c269b076
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] recap (GOSCON week in Portland)

2010-11-01 Thread kirby urner
GOSCON

I just got Steve Holden (Holden Web, PSF Chairman) to the airport (PDX).

Steve was here for GOSCON (government + open source) which is
organized by Open Source Labs (OSL), Deb Bryant in particular.

Themes around open government (there's an O'Reilly book by that title)
include:  open source / open data.

Government (at all levels) is naturally a source of open data.  The
developer community (private sector, non-governmental orgs etc.) are
avid consumers of (some of) this data.

The ideal "smart school" would host a number of civic-minded
applications that provided students with access to interesting data
sets, many of them having to do with the local environment.

GIS IN ACTION

Clearly we're talking about GIS (geographic information systems).

In the forefront of using GIS to inform the public policy making
process is Ecotrust, also with headquarters here in Portland.

I don't know if Ecotrust had a footprint at this year's GOSCON, where
I was myself a peripheral player, in support of Holden Web.

When leading a pilot on computer science and related skills for
Portland Public Schools (Winterhaven PPS), I was asked to give it a
GIS flavor.

This involved using Google Earth and looking at KML files, the flavor
of XML written as a result of sticking "push pins" into the map.

Where does XML fit into a K-12 curriculum?  Currently almost nowhere.

EDUPYCON

Holden Web is hoping to produce a number of events that will boost the
open source / open data aspect of public / private collaborations.

I continue to suggest eduPycon (edu.pycon) as a promising genre,
recalling conversations at Pycon with Jeff Rush and others.

Another puzzle piece here is simulations both with and without avatars.

COFFEE SHOPS NETWORK

Yet another puzzle piece is the science-minded reverie on LCDs,
something to look at when sipping a coffee and studying, perhaps with
others.

These may be public LCDs in student unions, branded "smart bars" (e.g.
Portland's Backspace), or these could be streaming to your dorm room.

Instead of sports / news / weather, picture studying organic chemistry
and having a steady stream of relevant animations coming your way,
reminding you of key content.

StudyStreams [tm] might be your source point.  With the occasional
advertising, this could be a free service, with pay versions more
specifically customized.

The open source business plans for all this have been filed under
Coffee Shops Network for those interested.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Last call for K12 Python education panel

2010-10-27 Thread kirby urner
Doing some serious wheel spinning about it Vern.

Lots of Venn Diagram considerations about where education and the
business world intersect.

I'm working with Holden Web again this week, as GOSCON is in town.

Only like 130 registrants, which seems crazy-small.

Some days it feels like Portland, Oregon is on life support and I
shouldn't be off galavanting around Georgia.

Other times, I think Georgia is the genesis of some geniuses, like
this corporate refugee I know, from Savannah.

Georgia-Pacific has taken over a lot of the wood business.  Are we
sister states then?

Barcamp 4 just recently completed (this Saturday) and I met the
punkmathematics.com guy.

http://mybizmo.blogspot.com/2010/10/barcamp-4.html

Must write to him next.

Ignite dot gov is this evening.  I'm toting the totem (PSF snake).

Kirby



On Tue, Oct 26, 2010 at 10:03 AM, Vern Ceder
 wrote:
>
> Jeff? Kirby? Either of you going to make it to Atlanta? Anyone else? If not,
> I have one non-EduSig option I might try, so please speak up soon.
> Vern
>
> On Tue, Oct 26, 2010 at 12:58 PM, Zac Miller  wrote:
>>
>> I'm still looking for a 3rd person if anyone is interested in doing a
>> panel at PyCon about teaching Python in K12.  Anyone interested?  The
>> deadline is coming up on the 1st for proposals.
>>
>> -J. Zachary Miller
>>
>>
>> ___
>> Edu-sig mailing list
>> Edu-sig@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
> vce...@canterburyschool.org; 260-436-0746; FAX: 260-436-5137
>
> The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW
>
>
>
> --
> This time for sure!
>    -Bullwinkle J. Moose
> -
> Vern Ceder, Director of Technology
> Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
> vce...@canterburyschool.org; 260-436-0746; FAX: 260-436-5137
>
> The Quick Python Book, 2nd Ed - http://bit.ly/bRsWDW
>
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Joining my first SIG

2010-10-24 Thread kirby urner
Hi Zak --

Glad you've joined us.

I used to be a full time high school math teacher in the 1980s (Jersey
City), then worked at McGraw-Hill.

We all though Logo and BASIC might be getting a mind-slice in
pre-college math, but Texas Instruments won with math wars.

These days, I sometimes get to field test through Saturday Academy.

Martian Math was the latest such prototype (ongoing in other formats).

http://mathforum.org/kb/thread.jspa?threadID=2102469&tstart=0

Portland Public has also used my services (GIS / GPS a focus -- big on
geography around here).

I tend to think Python + Polyhedra could be a real sweet spot in the
curriculum because Polyhedra are "objects" in literal sense yet also
in a mathematical sense.

Learning about "math objects" starting with Polyhedra, other geometric
concepts, seems an ideal application of an OO language.

I tend to use VPython quite a bit.

I was sorry to miss Ruth Chabay's demo of Vpython at the recent
American Association of Physics Teachers conference at the downtown
Hilton.

http://www.physics.ncsu.edu/people/faculty_chabay.html

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] a draft module (funky.py) -- digital math track

2010-10-13 Thread kirby urner
"""
non-axial:  10 FF + 2 is the classic CCP number
sequence (OEIS A005901).

Here we bring out the +2 associated with polar
vertexes by means of function composition, applied
using decorator syntax (@)

[12, 42, 92, 162, 252, 362, 492, 642, 812, 1002]

Note how a "double decorator" makes sense
as well (the output function is fed back in
to compose and output once again ala g(g(f(x)).

[4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

brainstorming posters for Pycon / Havana; Pycon / Ukraine
by 4dsolutions.net

Bibliography:

The King of Infinite Space (bio of HSM Coxeter)
Proof of 10FF + 2 (NCLB project)

Xtals 101 (4dsolutions.net/ocn/xtals101.html)
"""

def compose( f ):
global g
return lambda x:  g( f (x) )

def g(x):  return x + 2

@compose
def nonaxial(n):  return 10 * n * n

@compose
@compose
def identity(x):  return x


def test():
print ( [ nonaxial(x) for x in range(1, 11) ] )
print ( [ identity(x) for x in range(10) ] )

if __name__ == "__main__":
test()
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] 'discovery learning' with Python...

2010-10-10 Thread kirby urner
Related links:

http://www.acm.org/press-room/news-releases/2010/education-paradox
http://www.acm.org/news/featured/acm-pcast-statement

The idea of a new "digital math" track alongside the current "analog math"
track (leading through calculus) is different language than CinC's rhetoric
(Computing in the Core), but the goal is the same:  raising topics in
computing (not just keyboard/mouse and Internet skills) to the same
level as the rest of mathematics in terms of counting as "core".

That this acronym STEM (Science Technology Engineering Mathematics)
is now explicitly including computer science is what the 2nd link is about.
Some math teachers were ridiculing the acronym as more edu-speak **,
but hey, everyone uses acronyms and abbreviations.

Kirby

** http://www.mathforum.org/kb/thread.jspa?threadID=2154964&tstart=0

My thanks to Bill Marsh for the above links (Math Forum debater)

On Sat, Oct 9, 2010 at 7:50 PM, Litvin  wrote:
> Thanks to both!
> Gary Litvin
>
> At 10:08 PM 10/9/2010, kirby urner wrote:
>>
>> That's cool.
>>
>> I was hoping my bold assertion of being almost alone on the front
>> lines would inspire protests from my comrades.
>>
>> Kirby
>>
>> On Sat, Oct 9, 2010 at 6:35 PM, Calcpage  wrote:
>> > I've been selling python, SAGE and the Litvin text to High School math
>> > and
>> > compsci teachers for some time too!
>> >
>> > I've been talking up python on the AP Calculus, AP Physics and AP
>> > CompSci
>> > listservs quite a lot actually.  I also promote python on my blog!
>> >
>> > Regards,
>> > A. Jorge Garcia
>> > Applied Math & CS
>> > Baldwin SHS & Nassau CC
>> > http://shadowfaxrant.blogspot.com
>> > http://www.youtube.com/calcpage2009
>
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] 'discovery learning' with Python...

2010-10-09 Thread kirby urner
That's cool.

I was hoping my bold assertion of being almost alone on the front
lines would inspire protests from my comrades.

Kirby


On Sat, Oct 9, 2010 at 6:35 PM, Calcpage  wrote:
> I've been selling python, SAGE and the Litvin text to High School math and
> compsci teachers for some time too!
>
> I've been talking up python on the AP Calculus, AP Physics and AP CompSci
> listservs quite a lot actually.  I also promote python on my blog!
>
> Regards,
> A. Jorge Garcia
> Applied Math & CS
> Baldwin SHS & Nassau CC
> http://shadowfaxrant.blogspot.com
> http://www.youtube.com/calcpage2009
> Sent from my iPod
>
> On Oct 9, 2010, at 8:33 PM, kirby urner  wrote:
>
>> Greetings edu-siggers --
>>
>> The appended thread is from the Math Forum and my role is somewhat
>> tangential i.e. I'm always the only one present quoting any Python.
>>
>> Complete thread in case anyone wants more context:
>> http://www.mathforum.org/kb/thread.jspa?threadID=2154964&tstart=0
>>
>> No one else in the world has the job of promoting Python to K-12 math
>> teachers so directly and publicly, except for the Litvins with their
>> ground-breaking MFTDA (Math for the Digital Age and Programming
>> in Python, Skylit publishing).
>>
>> Per my Grossology slides included in the presentation in Vilnius,
>> there's a recognized way to gain some bandwidth among multi-tasking
>> youth by including stuff that's "gross" or "demented" (see exhibit
>> below).
>>
>> Cartoons often exploit this technique, with adults as well.  There's
>> a whole genre of cartoons considered "sick and twisted" (Bill Plympton
>> an example contributor).  Portland, Oregon has many festivals
>> centering around such content.
>>
>> Such comedic material is apropos per the Monty Python genesis of
>> the name Python.  I've often though of Python's subculture as TV-14
>> and above, meaning we're not trying to compete with the Alan Kays
>> of this world, or with Scratch (which is also fun for grownups, if given
>> permission by their peers).
>>
>> Python takes typing, is not a visual language, takes some lexical
>> sophistication.  There's no reason to feature the same language at
>> all levels or in all circumstances, obviously.
>>
>> Anyway, nothing below is especially "sick and twisted" besides the
>> term "snake barf", which refers to the interpreter's coming back with
>> traceback error messages (raising exceptions) when uninterpretable
>> (inedible) expressions get offered.
>>
>> Thinking of the Python interpreter as this "creature" that responds
>> in a kind of "chat window" is not a bad way to go, given the name.
>>
>> You'll also see more of my "everything is a python in Python", a variant
>> on "everything is an object".  The paradigm object, in having special
>> names (if only __init__ and __repr__), i.e. a "rack of __ribs__" is
>> somewhat snakelike in appearance.
>>
>> Relevant slides:
>>
>> http://www.4dsolutions.net/presentations/connectingthedots.pdf
>> (slides 11, 12 re "everything is a snake", 23, 24 re Grossology).
>>
>> Exhibit: "demented cartoon" (Ren and Stimpy, Aqua Teenage
>> Hunger Force, and Spongebob would be other examples).
>>
>> http://www.youtube.com/watch?v=Li5nMsXg1Lk
>>
>> Having such toons communicating more mathematical concepts,
>> including Python (as one of many machine executable math
>> languages, as Leibniz envisioned), would be a feature of Python.tv
>> (which Holden Web is keeping safe for when the time comes).
>>
>> Kirby
>>
>>
>> 
>>
>> Date: Oct 8, 2010 4:27 PM
>> Author: kirby urner
>> Subject: Re: Mathematician
>>
>> On Fri, Oct 8, 2010 at 11:36 AM, Jonathan Groves 
>> wrote:
>>>
>>> Mike and Wayne and others,
>>>
>>> I did look up what Johnson and Rising's book "Guidelines for Teaching
>>> Mathematics" (2nd edition) says about discovery learning, and the
>>> book says more about discovery learning than what I remembered.
>>> Here are some things the book does say about discovery learning.
>>> I will not list everything, but here are some of the big ideas I find
>>> that are worth mentioning.
>>
>> Like here's what I might call "discovery learning"...
>>
>> The teacher is projecting in front of the 

[Edu-sig] 'discovery learning' with Python...

2010-10-09 Thread kirby urner
Greetings edu-siggers --

The appended thread is from the Math Forum and my role is somewhat
tangential i.e. I'm always the only one present quoting any Python.

Complete thread in case anyone wants more context:
http://www.mathforum.org/kb/thread.jspa?threadID=2154964&tstart=0

No one else in the world has the job of promoting Python to K-12 math
teachers so directly and publicly, except for the Litvins with their
ground-breaking MFTDA (Math for the Digital Age and Programming
in Python, Skylit publishing).

Per my Grossology slides included in the presentation in Vilnius,
there's a recognized way to gain some bandwidth among multi-tasking
youth by including stuff that's "gross" or "demented" (see exhibit
below).

Cartoons often exploit this technique, with adults as well.  There's
a whole genre of cartoons considered "sick and twisted" (Bill Plympton
an example contributor).  Portland, Oregon has many festivals
centering around such content.

Such comedic material is apropos per the Monty Python genesis of
the name Python.  I've often though of Python's subculture as TV-14
and above, meaning we're not trying to compete with the Alan Kays
of this world, or with Scratch (which is also fun for grownups, if given
permission by their peers).

Python takes typing, is not a visual language, takes some lexical
sophistication.  There's no reason to feature the same language at
all levels or in all circumstances, obviously.

Anyway, nothing below is especially "sick and twisted" besides the
term "snake barf", which refers to the interpreter's coming back with
traceback error messages (raising exceptions) when uninterpretable
(inedible) expressions get offered.

Thinking of the Python interpreter as this "creature" that responds
in a kind of "chat window" is not a bad way to go, given the name.

You'll also see more of my "everything is a python in Python", a variant
on "everything is an object".  The paradigm object, in having special
names (if only __init__ and __repr__), i.e. a "rack of __ribs__" is
somewhat snakelike in appearance.

Relevant slides:

http://www.4dsolutions.net/presentations/connectingthedots.pdf
(slides 11, 12 re "everything is a snake", 23, 24 re Grossology).

Exhibit: "demented cartoon" (Ren and Stimpy, Aqua Teenage
Hunger Force, and Spongebob would be other examples).

http://www.youtube.com/watch?v=Li5nMsXg1Lk

Having such toons communicating more mathematical concepts,
including Python (as one of many machine executable math
languages, as Leibniz envisioned), would be a feature of Python.tv
(which Holden Web is keeping safe for when the time comes).

Kirby




Date: Oct 8, 2010 4:27 PM
Author: kirby urner
Subject: Re: Mathematician

On Fri, Oct 8, 2010 at 11:36 AM, Jonathan Groves  wrote:
> Mike and Wayne and others,
>
> I did look up what Johnson and Rising's book "Guidelines for Teaching
> Mathematics" (2nd edition) says about discovery learning, and the
> book says more about discovery learning than what I remembered.
> Here are some things the book does say about discovery learning.
> I will not list everything, but here are some of the big ideas I find
> that are worth mentioning.

Like here's what I might call "discovery learning"...

The teacher is projecting in front of the whole class, and enters the
sequence below.  She doesn't necessarily talk a lot during the
demo, other than saying things like "lets see what this does",
"how about this?" i.e. noises associated with doing some inquiry.

Students have the ability to follow along and then branch off
doing their own experiments.  A time allotment is provided, say
15 minutes, at the end of which students volunteer to come in
front of the room, take charge of the projector, and give up to
5 minutes elucidation of what they've learned and/or think is
going on, for the benefit of the rest of the class.

Here's the scroll (reading program), a real time demo in this
case (frozen here):

Python 3.1rc1 (r31rc1:73069, May 31 2009, 08:57:10) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

>>> int


>>> int('3')
3

>>> int('3', 2)
Traceback (most recent call last):
  File "", line 1, in 
int('3', 2)
ValueError: invalid literal for int() with base 2: '3'

>>> int(3, 2)
Traceback (most recent call last):
  File "", line 1, in 
int(3, 2)
TypeError: int() can't convert non-string with explicit base

>>> int('3', '2')
Traceback (most recent call last):
  File "", line 1, in 
int('3', '2')
TypeError: an integer i

Re: [Edu-sig] revisiting old themes (OOP meets abstract algebra)...

2010-09-29 Thread kirby urner
On Tue, Sep 28, 2010 at 4:39 PM, kirby urner  wrote:
>
> Quite a bit of Python in this essay (link below), relating to math teaching.
>

<< snip >>
>
> http://www.mathforum.org/kb/message.jspa?messageID=7223356&tstart=0
>

Continuing along in the same thread, linking directly to plaintext to
preserve indentation, with the unfortunate side effect that the other
guy's input has no line breaks.  Sigh:

http://www.mathforum.org/kb/plaintext.jspa?messageID=7226167

Nothing too original.  Always appreciating Guido's slick
implementation of GCD (shorter than what's in MFTDA).

I'm also daring to use 'me' instead of 'self' for the name of the
instance handle.  I see good pedagogical reasons for doing this,
including to provoke a first person point of view in object modeling
(i.e. "I am a..." versus "It is a..." -- as in "I'm a little teapot,
short and stout...", a good beginning for OO-style thinking).

I'm also showing off a Compose type the sole purpose of which is to
allow functions to be composed using the multiplication operator.  I
have my reasons...

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] revisiting old themes (OOP meets abstract algebra)...

2010-09-28 Thread kirby urner
Quite a bit of Python in this essay (link below), relating to math teaching.

This is a philosophy of education I used to post about here in fire hose
quantities, in dialog with Arthur and the OLPC folks, among others.

No reason to top-off an already-full tank, right?

But maybe some are nostalgic, want to revisit old themes, even start
up new debates (if bored by all the quiet -- getting like math-thinking-l
around here).

http://www.mathforum.org/kb/message.jspa?messageID=7223356&tstart=0

If you're cross-subscribed with Diversity, you know I'm working to
recruit more truckers to Python (why should Java have all the fun
-- and Visual FoxPro seems to be fading).

No, this doesn't make me a "fossil fuels nut".**

Maybe some of those trucks are electric, like in the early 1900s (I've
been reading Edwin Black's 'Internal Combustion' so consider me
under the influence).

I thought this most recent NCTM geometry book:

Focus in High School Mathematics: Reasoning and Sense Making in Geometry

...was somewhat snarky to truckers, as the text protests the sign is
correct, in giving the right clearance.  But that's not what the situation
calls for (what's the sign for, if not to prevent just such accidents?).

Here's what I'm talking about:

"""
Mathematician Henry Pollak (2004) wondered why tractor trailers
often got stuck under a certain underpass when the maximum
clearance—the height from the roadway to the bridge—was
clearly labeled on a sign.
"""
http://www.nctm.org/catalog/product.aspx?id=13525  (Read an Excerpt)

My review:
http://www.mathforum.org/kb/message.jspa?messageID=7223427&tstart=0


Kirby

** when all the oil companies become one (click for larger view):
http://mybizmo.blogspot.com/2006/03/big-oil.html

Relevant:
http://www.4dsolutions.net/ocn/oopalgebra.html  (yeah, Java, but same ideas)
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] thoughts after djangocon

2010-09-12 Thread kirby urner
The opening plenary was interesting.  We had some
university representation, including a guy working on
the electronic medical records problem.  I wish I'd
gotten his name.  Bruce or Brian.  He worked with
Steve Holden on the data visualization challenge,
one of the conference puzzles (rewards awarded).

Lots of chatter about NoSQL, which I've been blogging
about as a possible "scrap booky" solution to some
medical record services, i.e. the outermost storage
is non-schematic, even if there's schematic data
embedded (like on Facebook -- picture a long sheet
of butcher paper, unscrolling your whole life).

The private sector is obviously far out ahead of
academia but, because of intellectual property
concerns, tends to burrow, play its cards close
to the vest.  There's something oxymoronic about
an open source conference where people a keeping
so many secrets, but that's life in the corporate
fast lane.

Governments, on the other hand, have more of an
incentive to justify their existence by making whatever
software development they pay for stay out there
and in the open (if immunized against "national
security" memes), a catalyst for further innovation
among hose without the budgets to privately fund
innovation.  SE Linux is one (older) example.  This
makes governments more naturally partners of
academia, although there's sometimes an awkward
triangle here, with the private sector trying to get
universities to generate more patents and trade
secrets, even with public funding (especially with
public funding).

Congressman Wu (1st district, OR), gave one of
the keynotes.  He noted the importance of STEM
subjects in today's education (science, technology,
engineering and math).  After leaving the podium,
he made a bee line to Steve (of Holden Web,
producer of this conference) to ask what happened
to all the women.  Where do they leak out of the
STEM pipeline he wanted to know, realizing this
might be a topic for another day.

http://controlroom.blogspot.com/2010/09/serendipitous-opportunity.html

GOSCON is coming up in October and we'll likely
continue discussing these issues.  Oregon is hoping
to channel funding into OSU's ODL around this electronic
medical records challenge, but I don't know that the
caliber of the journalism is sufficient to focus public
debate.  Without public discussion, the right people
fail to learn of one another.  Willamette Week did a
cover story on precisely this, which was a good sign,
but failed to get at all technical, which is not a good
sign.   Here's my journal entry on the WW article:

http://worldgame.blogspot.com/2010/08/open-source-health-care.html

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Edu-sig Digest, Vol 86, Issue 3

2010-09-05 Thread kirby urner
On Sat, Sep 4, 2010 at 7:09 AM, Fahreddın Basegmez 
 wrote:

> Could it be Mekanimo?  It let's you create circles and polygons and
> join them together with connectors while automatically generating
> Python code.  Created objects behave like agents.  Here are some
> videos.
>


Hey this Mekanimo thing is fantastic.  Amazingly cool use of the wx API for
GUI.  Really, Python?

Thanks Fahri!

I relayed my pleasure to mathfuture, a Google group.

http://groups.google.com/group/mathfuture/browse_thread/thread/d006e2daf0e5110d#

Maria D. also expressed appreciation, replying on naturalmath:

http://groups.google.com/group/naturalmath/browse_thread/thread/17585b0643e3aabc#

mathfuture is where I do some of my Martian Math writing, a curriculum that
uses Python quite a bit (including VPython [1]), but is far enough afield to
sometimes make more sense in another namespace.

Speaking of Martian Math, I feel obliged to cluck about the Buckyball on
Google yesterday.

I yakked with Josh Cronmeyer about it by email.  He and I met up at an OS
Bridge before he took off for Australia (that's the Josh mentioned in this
blog post -- he's Python programmer of note, works with Thoughtworks.com):

http://worldgame.blogspot.com/2010/09/buckyball-day.html

In a couple hours I'm off the PDX (our airport) to fetch Steve Holden, PSF
chairman.  Holden Web is this the organizer of this year's DjangoCon in
Portland.

http://djangocon.us/

Kirby



[1]

if you dig back in edu-sig you will find Arthur Siegel and I doing a lot of
the talking.  He was some high powered guy in the financial district, NYC,
who wisely devoted much of his remaining time to raising his son and doing
some esoteric Python programming to explore projective geometry.  Pygeo is
the name of his free / open source project, which makes heavy use of
VPython.  Can't think of anything quite like it either before or since.
 Check it out.

http://pygeo.sourceforge.net/

Arthur was a passionate and colorful character and our debates on this list
were free ranging (much to the dismay of some).  We met twice in New York,
also talked on the phone.  This old blog post chronicles our 2nd and last
meeting:

http://mybizmo.blogspot.com/2005/05/tree-house.html
(paragraphs 2,3)


[2]

http://djangocon.us/

Holden Web provided me with an exceptional opportunity in April, to lead a
3-day workshop for the Space Telescope Science Institute (Johns Hopkins
campus, Baltimore).  I'd expressed admiration for Hubble and the astronomer
groups using Python, but never dreamed I'd be able to do a Python training
with them.

I also got to look over Steve's shoulder as he did some curriculum writing
for O'Reilly School of Technology.  This school offers for-credit distance
education courses using a customized student version of Eclipse called
Ellipse.



Physcial proof of the pythagorean theorem
> http://www.youtube.com/user/fbasegmez#p/a/u/0/rQUW5BvdIkc
>
> Ragdolls
> http://www.youtube.com/user/fbasegmez#p/a/u/1/CWhg_u4K4ow
>
> James Watt's linkage
> http://www.youtube.com/user/fbasegmez#p/a/u/2/K1pdoLi6UPc
>
> This shows how to make a platform game with it
> http://vimeo.com/14469657
>
> Fahri
>
>
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] python application

2010-09-03 Thread kirby urner
You're not talking about MIT Scratch are you?

It fits your description to some extent.

http://scratch.mit.edu/

Kirby


On Fri, Sep 3, 2010 at 11:58 AM, roberto  wrote:
> hello, this is a somehow strange request:
> a long time ago, a python developer wrote me saying he wrote a nice
> application in python which was also able to let the user snap
> together graphical blocks and at the same time it lets the user see
> the corresponding code, without even writing it;
>
> maybe something similar to turtle art but i am sure it was not that one !
>
> if anyone (or the developer itself) knows something about it, please
> let me know ?
>
> thank you
> ps: if you're thinking why i am not searching in my inbox, the answer
> is you're right but i didn't find the mail again :) among tens of
> thousands of other messages, sorry !
>
> --
> roberto
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] some notes and links

2010-09-01 Thread kirby urner
On Wed, Sep 1, 2010 at 11:28 AM, Gregor Lingl  wrote:

<< snip >>

>> http://www.thewildernessdowntown.com/
>
> This is really a great demo
>>
>> ...
>> Given my Geometry + Geography paradigm, I see trucking mixing with
>> Google Street View as a way to learn more about a given topography
>>
>
> We have a big discussion in Europe at the moment (especially Germany and
> Austria) concerning the question if google streetview is legal in our
> countries or should be restricted/forbidden.

Good hearing from you.

People leery (suspicious) in the UK as well.

There's a "public roads" argument, i.e. public roads should be accessible
to Google's spy vehicles, just as space is to satellites.

Gated communities, private property owners, might deny access.

However, not every society has a well-defined notion of "public roads".

Here's the Blue House where I hang out quite a bit:

http://tinyurl.com/238y58r

It's an old picture though, the car in the driveway long ago recycled.

We also have more vegetables growing in front, thinks to the
live-in Global U student  (getting a degree in community organizing).

>
> Concerning html5 and given your Geometry + Geography paradigm you might want
> to have a look at what can be done with the htlm-canvas element alone:
>
> http://www.phpguru.org/html5-examples

Way cool, forwarded to Facebook (where some math teachers track
me), with attribution to one Gregor on edu-sig (one of the greats).

Kirby

>
> Regards,
> Gregor
>
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] some notes and links

2010-08-31 Thread kirby urner
Hey good news about numpy now supporting Python 3.  Some of you will
have seen that announcement.

I'm getting ready for DjangoCon here in Portland, am likely to be
'snake handler' again this year, carry the PSF totem around, a token
of friendship when she meets up with Djangopony.

I've been looking at some of the swoopy effects in HTML5, thinking
about the future of trucking software, such as transportation system
managers.

http://controlroom.blogspot.com/2010/08/tomorrows-guis.html
http://controlroom.blogspot.com/2010/08/notes-on-trucking.html

http://www.thewildernessdowntown.com/  (not all browsers will handle,
I'm using Chrome, worth doing the demo).

>From last Djangocon:

"""
Erich Ocean: HTML5 is a technical spec, but culturally its more a
Flash killer. The beefy JavaScript engines are making a big
difference. Dynamic languages win again (sorry Java). SproutCore is
the HTML5 application framework adopted by and now developed at Apple.
It's open source, like WebKit and LLVM. Erich thinks WebKit is the
future for the browser, thinks Django is well positioned on the server
side. Webkit will run on Windows. HTML5 is moving faster than many
think. You'll be able to sneak WebKit in the back door into IE6 even.
This talk relates to the anticipated future of low latency push apps
that keep updating the browser without waiting for client-side
requests i.e. like Comet (see above). HTML5 web sockets...
"""

http://controlroom.blogspot.com/2009/09/djangocon-day-3.html

As always, when I look at industry software, I think about how this
could translate to the pre-college curriculum.

Given my Geometry + Geography paradigm, I see trucking mixing with
Google Street View as a way to learn more about a given topography
(anywhere trucks travel, doesn't have to be North America or anything
so parochial -- how about Phuntsholing to Samdrup Jonkar by inland
mountain road (via Tongsa, Mongar and Tashigang) -- sounds like Lord
of the Rings.  I've done it the whole way (though not as a truck
driver) at one time or another.

http://www.4dsolutions.net/satacad/martianmath/mm12.html  (Geometry + Geography)

Or instead of a truck, a bizmo (business mobile):

http://mybizmo.blogspot.com/2007/10/designing-engineers.html  (funny lookin').

I'm off to a meeting on open source in Afghanistan, per recent posting
to Diversity.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] recent classroom hits...

2010-08-19 Thread kirby urner
>From my Martian Math curriculum:


http://www.4dsolutions.net/ocn/python/movingballs.py
http://www.4dsolutions.net/ocn/python/movingballs2.py
http://www.4dsolutions.net/ocn/python/movingarrows.py

This one is especially likely to crash your VPython, if
your video card isn't running the latest something-or-other,
read all about it under Visual 5 (vpython.org).

I had to upgrade my desktop driver, laptop no problemo,
high end Apples in the classroom no problemo either.

http://www.4dsolutions.net/ocn/python/movingletters.py

Kirby

re Martian Math:
http://bfi.org/news-events/community-content/martian-math-and-synergetics
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] class notes (martian math)

2010-08-03 Thread kirby urner
I recently completed the 2nd day of this summer camp blitz
for TAG (talented and gifted) students, a category invented
by the district, and I'm not sure how it applies, i.e. this private
NGO has no obligation to check a district database for a
tag flag or anything, praise Allah.

Anyway, all the students are bright, astute, engaged and
interested.  Programming is hard fun and takes concentration.
One is lucky if able to muster it.  Takes a safe environment
and calories to burn.  We're in a campus of the highly privilege
where no expense is spared, and every kid has access to
a state of the art Apple.  I've got a projector and screen.
We all have Internet.

This is my first time to teach an all-Apple class and I have
to confirm Chairman Steve's impressing the IDLE is
languishing here.  Guido gave Python a tremendous boost,
propelled it into high visibility with an interactive Tk shell
and editor, but that infrastructure has not kept pace.  The
scroll bar tends to not work.  Resizing windows as they'll
get to large to fit the screen, so grabbing the lower right
resize control requires changing screen resolution through
the Finder control panel.

That being said, it's pretty amazing to have such a smooth
language co-functioning with VPython, such that we're
immediately able to get colorfun.py going, which the
students then tweak.  I'm using the 'heads first' or 'dive
into' approach of supplying plenty of scaffolding, getting
the results first, then going back over the syntax and
structure of the language with an eye towards making
small modifications.  We've spent a large percentage of
the last few hours tweaking color, learning about what's
canned (pre-named) and how to define your own RGB
values.

Today, using the projector, I introduced the random module,
which I think is one of the first to be useful after visual itself.
random's randint and choice are two of the most practical.
Our code looks like this:

from visual import *
from random import randint

def galaxy( n ):
for i in range(n):
x = randint(-100, 100)
y = randint(-100, 100)
z = randint(-100, 100)
r = randint(10)
sphere( pos = (x, y, z), radius = r, color = color.red )
return

Then a next modification, after playing with choice and randint
in the shell a little more, and talking about lists, would be:

from visual import *
from random import randint, choice

colors = [ color.red, color.green, color.blue, color.yellow, color.orange ]

def galaxy( n ):
for i in range(n):
x = randint(-100, 100)
y = randint(-100, 100)
z = randint(-100, 100)
r = randint(10)
c = choice( colors )
sphere( pos = (x, y, z), radius = r, color = c )
return

Once this code is working on each workstation (I go around to help catch
syntax errors, usually a missing comma or paren), then students might
vary the parameters, add more colors for example.

Earlier, when introducing functions more generally, I told the story
of the guy who impressed the king for a modest favor, were he
successful in a mission (the King put out an RFP and this looked
like the lowest bide):  put a grain of rice on the first square of the
chess board, double it for the next, and the next, and so forth.
"Can't be that much rice" thought the King.

def reward( ):
therice = 0
for x in range(64):
therice = therice + 2**x
return therice

Wow, all the rice in the world and then some, right?  Note that 2**0 == 1
and that's what goes on the first square, so we only get up to 2**63 on the
last square (with the rice being cumulative).

I continue to introduce ( ): in the function def as almost like an emoticon,
like two eyes with an open mouth.  Turn that mouth sideways to make it
look more like a mouth, and remember that's where to put your arguments.
This is easy to remember, as people use their mouths for arguing all
the time.

My students range in age from roughly 14-17.  My Photostream has a
few pictures from the current venue, mixed in with other topical photos
(a Flickr set):

http://www.flickr.com/photos/17157...@n00/sets/72157622961425831/

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] busy with Martian Math...

2010-07-31 Thread kirby urner
I'm packaging up some Python for a next course that I'm teaching
(a relatively busy summer for me).  I've also got the J language in
the docket. The computer lab is all state of the art Macs, so
we'll see how we fair with IDLE.

I've appended some source code I just wrote in the last hour, while
watching a geometry show on public TV (math-dimensions.org --
on Portland, Oregon's cable network these days).

The source won't run without an additional dependency though,
which I call stickworks.py -- features in some of the Showmedo
episodes and other places.  This module provides simple Vector
and Edge classes for working with VPython (another dependency).

The course materials I'm developing may be previewed at this URL:

http://www.4dsolutions.net/satacad/martianmath/mm0.html (and following)

(cover page index.html not yet crafted)

(comments welcome).

I will conclude with a repost of something I just posted to my little
engineering list, headquartered at the so-called Pauling House
(Linus Pauling's boyhood home), FYI.

Keith was a presenter at OSCON this year, regarding his Server Sky
idea (orbiting server farm) while Allen Taylor is the esteemed author
of 'SQL for Dummies'.




Re: [wwwanderers] Mars aressync orbits

OK, thanks to both Keith and yourself for all the discussion.  I'd not
seen that "fourth power" argument before, but then this literature is
fairly alien to me.

Back on planet Earth (and Keith's gardening concerns), I was just
seeing on public TV about how Salem has yet to permit urban farmers to
keep chickens.  I'd just assumed that chicken coops were legal
throughout the Willamette Valley, silly me.

I caught this show while waiting for another public TV show about
hyper-dimensional geometry.  We were informed that higher dimensional
spaces "really exist" base on the analogy that if two dimensional
beings can think about three dimensions, then so should we, be able to
think about four.

As a database guy, my bias is to think of n-tuple addressing as just a
fancy way to store/retrieve records, like URLs for storing/retrieving
web pages (there's a reason it's called hypertext).  Sure, you can
come up with fancy analogies to polyhedra, but I'm not sure this
"really exists" argument is important to the mathematics.  Seems more
like mysticism (or even organized religion).

In any case, the Martian Math I'm busy concocting has a different
meaning of "4D".  I thought it was poetic that I was working on my
uploads at the same time I was catching this Earthian Math show on
public television.

Kirby


On Sat, Jul 31, 2010 at 2:07 PM, Allen Taylor  wrote:

Kirby,

The magnetic launcher you are thinking of works because of hyper-fast
acceleration. This causes two problems:

1. Any organic matter, such as us would be turned into jelly.
2. High velocity at ground level would cause tremendous heating due to
atmospheric friction, even with Mars thin atmosphere.

The magnetic launcher makes sense on the Moon, which has a negligible
atmosphere, but only for cargo that can stand thousands of g's.

The pendulum from Phobos as well as the Lofstrom Loop are viable for
Earth to orbit or Mars to orbit because velocity is low at ground
level where the atmosphere is densest and because g-forces are
relatively moderate.

Allen




"""

by K. Urner for Saturday Academy, Martian Math

Summer camp 2010 @ Reed College

http://www.4dsolutions.net/ocn/satacad/martianmath/

"""

from stickworks import Qray, Edge, getedges
from visual import *

def setscene ( ):
"""set the stage for our little drama"""
scene2 = display(title='Drawing a Duo-Tet Cube',
 fullscreen= True, autoscale = False,
 background=color.white, scale = vector(0.1, 0.1, 0.1))
return scene2

def ccp(  ):

"""
draw 12 spheres around 1
"""

scene = setscene( )
scene.select( )

# 26 points in space (as sums of Qrays)
a, b, c, d = Qray((1,0,0,0)), Qray((0,1,0,0)), Qray((0,0,1,0)),
Qray((0,0,0,1))
e, f, g, h = -a, -b, -c, d
i,j,k,l,m,n = a+b, a+c, a+d, b+c, b+d, c+d
o,p,q,r,s,t = i+j, i+k, i+l, i+m, n+j, n+k
u,v,w,x,y,z = n+l, n+m, j+l, l+m, m+k, k+j

# 12 around...
for locus in [o,p,q,r,s,t,u,v,w,x,y,z]:
ball = sphere(pos = locus.xyz, color = color.orange, radius = 0.5)

# 1 at the center (nuclear ball)
center = sphere(pos = (0,0,0), color = color.red, radius = 0.5)

print "OK, done..."
return

if __name__ == "__main__":
ccp( )
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] open source admin in academia? (editorial)

2010-07-24 Thread kirby urner
On Mon, Jul 19, 2010 at 3:30 PM, kirby urner  wrote:
> I'm becoming more aware of the fact that one
> reason universities need to charge those
> tuitions is to pay licensing fees to private
> vendors who provide them with such basic
> services as the ability to store and schedule
> classes, record student enrollment and grades,
> record instructors etc.  The catalog needs to
> be published on-line.  There might be a lot
> of extended education options, e.g. non-credit
> courses open to anyone willing to sign up.
>

Of course it takes time/energy to develop such software
no matter who is doing it.

If a university can afford a system architect and to pay
developers, fine.

I know Reed College had an ad in the paper for
Open Source Developer (PHP centric).  But that doesn't
mean the fruits of this labor are shared with a wider
community (might not be relevant).

"Open source" may just mean that the tools themselves
are open (e.g. a LAMP stack), not that anything developed
is going to escape the silo.

> Some of these proprietary programs are pretty
> old, lack features departments need, and so
> various intermediating applications grow up
> around the edges to fill in the gaps.

I interviewed this system architect from a large community
college and he talked about how their in-house people
used to run everything to do with admin (courses,
enrollment, scholarships, instructor compensation...)
using FORTRAN on a mainframe.

Over time, components were modernized, moved to
other technologies.

Just before he left, the school signed on with a major
vendor.  He said this was a result of some political
wheeling and dealing and that the in-house people
were still using their own systems, but stuffing data
into the vendor product to keep the politicians happy
in some way.  The vendor product was quite lame in
the opinion of most staffers.

> Maybe the big dino system doesn't record
> student evaluations for example, or keep track
> of which courses are in the pipeline, but still
> haven't found a place in the sun.
>

This is a real life situation I'm facing.  To make up for
what's missing in the vendor product, they have a
one-of-a-kind custom application written in FoxPro.

FoxPro has been a rather popular language in the
Microsoft world, though Microsoft has tended to be
ambivalent about it (competes with Access, is in
so many ways better than Access).  The decision
was to not commit to any VFP 10 (no more releases),
while putting most developer tools into Codeplex
(the "shared source" repository).

Some FoxPro developers decided to code a development
environment that was rather similar, in Python.  That's
Ed Leaf and Dabo.  I've been to a couple of his talks,
shared Vietnamese food in Washington DC that time.
In any case, the concepts are all familiar if you do
RDBMS.  Xbase, originally developed in connection
with some JPL satellite project (interesting lore) had
it's own non-SQL way of talking to tables though --
with SQL grafted on later.

> One would think that universities in particular,
> which pride themselves on having advanced
> knowledge of state of the art skills, would band
> together in various consortia to pool resources
> and "eat their own dog food" as it were.  A
> school that teaches medicine actually practices
> medicine (the "teaching hospital").  Shouldn't
> schools that teach computer science and
> business administration actually walk the talk
> in some way?  Maybe many of them do, I don't
> actually know.
>

That seems a boldly correct statement on the
face of it maybe, but I've been listening to the
counter-arguments.

One smart exec I know put it this way:

"a university's main mission is to prepare a large
number of students for entry level positions
in various professional walks of life,

NOT to write sophisticated software that tries to
compete with Microsoft Word -- it takes a
veritable army to write industrial grade code,

and who's got that kind of time or resources
within academia?"

> To outsource something so core to one's business,
> to pay licensing fees while not having the power
> to make design modifications, just seems more
> than a tad on the ironic side.  It's like a bank
> outsourcing everything it does around money.
>

As another co-worker put it, universities won't lean
on something so nebulous as an "open source
community" if that means there's no one on the
hook to hold accountable if something goes wrong.

This is the chief advantage of having a vendor:  if
the system breaks, there's someone specific to call.
In the eyes of your supervisors, you've done all you
need to do:  report the problem and keep the pressure
on.  People on some other payroll are responsible.

One alternative is to get int

[Edu-sig] more ruminations... (Python and physics etc.)

2010-07-21 Thread kirby urner
More ruminations regarding Python and math teaching, at the
Math Forum, with stuff about Smalltalk, OLPC etc.

Excerpt:

"""
I'm thinking Arthur Siegel (on edu-sig / Python Nation) was on the
right track in always insisting that VPython become a part of the
standard distro. Having something relatively easy, user friendly
that's OpenGL, is gonna do wonders for your geometry classes,
and after geometry + geography, what else is there? Me 'n
Sir William thought the same way. [William Colby -- KU]
"""

http://mathforum.org/kb/message.jspa?messageID=7133134&tstart=0

Also, after two days with the physics teachers, I'm again impressed
with how far ahead the community seems to be, vis-a-vis most of
the math teaching community, in terms of embracing social networking,
other tools.

http://worldgame.blogspot.com/2010/07/physics-conference.html

I was sorry to miss Ruth Chabay's VPython presentations.  She was
among the presenters.  http://www4.ncsu.edu/~rwchabay/

I did see stuff happening with Python though.  Even my own work
was mentioned (Studies in Human Motion, using Python + POV-Ray,
with input from a spreadsheet getting from sensors attached to
a dancer's body).

The movies:
http://physics.doane.edu/hpp/Resources/UHMCD/UHMCDMedia.htm

http://physics.doane.edu/hpp/Resources/UHMCD/UHMCDPeople.htm
(includes me in the credits)

Then there's this software called Logger Pro by Vernier that a
lot of physics teachers are using.  Venier is to physics teaching
sort of what TI is to math teaching?

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] women in computer (was: source code from SA:10648)

2010-07-21 Thread kirby urner
On Wed, Jul 21, 2010 at 3:00 PM, Calcpage  wrote:

> There's a lot of content on YouTube regarding Ada Lovelace Day as well.
>  There was some discussion on the AP-CompSci listserv about making a Grace
> Murray Hopper Day as well.  The problem IIRC was that Hopper's and
> Lovelace's (or is it Byron) birthdays were very close if not, in fact, the
> same day (not year of course).
>
> Regards,
> A. Jorge Garcia
> Applied Math & CS
> Baldwin SHS & Nassau CC
> http://shadowfaxrant.blogspot.com
> http://www.youtube.com/calcpage2009
> Sent from my iPod

We have other ways to honor people besides having days in their
honor.

Given Ada and Hopper, I'm happy to circle "computer science" as
"belonging to women", which of course just gets me in hot water
with some of the guy-centric storytellers.

I posted some essays to math-thinking-l about this, some here,
some on Python's diversity list (private archive -- you have to
join it to read it, unlike edu-sig).  Lots about "FOSS witches",
which came up around here awhile back as well:

http://www.mail-archive.com/edu-sig@python.org/msg05726.html

The New Yorker magazine once published a cover story slamming
Ada, trying to withdraw her title as "first computer programmer".

I rallied to her defense:

http://www.grunch.net/synergetics/adaessay.html

Of course one might argue "it doesn't mean anything" to say
women control computer science.  Likewise men don't control
anything I suppose one could say (least of all themselves).
However, in terms of seeking balance, I'm happy to develop
this narrative line.

Our next truly creative bursts (if we have any) will all have
to do with using computing technology to take better care
of "women and children" (the signature civilians) and less
to do with world domination through brute force (a male
specialty). OLPC etc.  Caring about community.  Mesh
networking etc.

Yes, sounds like a "party line" ("pirate party"?).[0]

I am heartened to see open source moving into health care,
even if that's just MUMPS leading the charge.  At the hospital
I worked at, I tried to envision a more contemporary SQL
based approach [1], but then I think the future of medical
records will be more like Facebook (except more private
and with medical devices and imaging systems for
"friends" -- along with physicians and their case notes).[2]

Kirby

[0] re Pirate Party
http://controlroom.blogspot.com/2007/08/which-hollywood-star-for-president.html

[1] Django / Python instead of MUMPS?
http://www.4dsolutions.net/presentations/charting_a_future_sysadmin.pdf

[2] Medical records in Cassandra or one of those "schema-less" databases
http://controlroom.blogspot.com/2009/06/medical-privacy.html
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-21 Thread kirby urner
Really excellent 60 Minutes excerpt, thank you.

I should show that in my next math class.

Kirby


On Tue, Jul 20, 2010 at 5:48 AM, Calcpage  wrote:
> Regarding your discussion of Grace Hopper, you may find the videos I posted
> on YouTube of interest:
>
> http://www.youtube.com/cistheta2007
>
> HTH,
> A. Jorge Garcia
> Applied Math & CS
> Baldwin SHS & Nassau CC
> http://shadowfaxrant.blogspot.com
> http://www.youtube.com/calcpage2009
> Sent from my iPod
>
> On Jul 19, 2010, at 6:15 PM, kirby urner  wrote:
>
>> On Fri, Jul 16, 2010 at 1:41 PM, kirby urner 
>> wrote:
>>
>>
>>>
>>> I'll return to post a link to my followup post.
>>>
>>
>> So here are my two write-ups of the just completed
>> Programming in Python (SA:10648):
>>
>> http://worldgame.blogspot.com/2010/07/teaching-again.html
>> http://worldgame.blogspot.com/2010/07/finish-line.html
>>
>> Also, the math teachers on math-teach @ Math Forum
>> are starting to ramp up again, on the whole idea of
>> pre-college computer science or digital / discrete math
>> or whatever we call it:
>>
>> Here's a link to the thread (public archive).
>>
>> http://mathforum.org/kb/thread.jspa?threadID=2095707&tstart=0
>>
>> You'll see me weighing in with my familiar (to some here)
>> views, but also expressing this new angst about IDLE.
>>
>> Excerpts:
>>
>> """
>> Steve Holden, chairman of the Python Software Foundation,
>> has been suggesting the it may be time to retire IDLE,
>> removing it from the standard distro. Indeed, on Ubuntu
>> I'm pretty sure one needs to install it separately...
>> """
>>
>> """
>> When learning programming for the first time, you can
>> dive into object oriented thinking right away, because
>> this style of thinking was modeled on ordinary human
>> grammar.
>>
>> noun.verb( ) and noun.adjective correspond to things
>> (nouns) having behaviors and attributes (what could
>> be more natural)?
>> """
>>
>> I talk about some of my history lobbying for a new
>> discrete math course here -- how I first become aware
>> of the Litvins text (at a planning workshop with
>> Chris Brooks just about one year ago):
>>
>> """
>> For those new to this list, I've been putting myself out
>> there as a kind of lobbyist trying to get something called
>> computational, digital, discrete and/or fill-in-the-blank math
>> that is for-credit in equal measure with any of the pre-calc
>> or calc track classes. I've done a lot of writing about this,
>> describing my network and our political tactics. I won't
>> go into all that again here.
>> """
>>
>> http://mathforum.org/kb/thread.jspa?threadID=2095937
>>
>> Kirby
>>
>>>
>>> Kirby Urner
>>> 4dsolutions.net/ocn/cp4e.html
>>
>> ___
>> Edu-sig mailing list
>> Edu-sig@python.org
>> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] open source admin in academia? (editorial)

2010-07-20 Thread kirby urner
Ah yes, MUMPS.  I have some history around that one.  It haunts me.

Poor Haiti.

Kirby


On Tue, Jul 20, 2010 at 7:54 PM, Edward Cherlin  wrote:
> On Tue, Jul 20, 2010 at 04:34, kirby urner  wrote:
>> I like to see universities taking the lead in some way...
>> (they call it "non-commercial"), eating their own dog food.
>>
>> Same thing with hospitals.  They seem to not want to
>> develop much inhouse, even for research -- or maybe
>> I've not been inside the right hospitals?   You'd think
>> the open source ethic and health care would be more
>> hand in glove.
>
> MUMPS (Massachusetts General Hospital Utility Multi-Programming
> System), now sometimes just M, is the basis for the VA and DoD
> hospital systems. it was taken to Free Software via the Freedom of
> Information Act, and is now available as openVistA. This is a full
> medical system suite, with more than 200 modules for imaging, medical
> records, billing, pharmacy, and so on. M is unusual among programming
> languages for including its own database engine. Its more recent
> competitor is OpenMRS (Open Medical Records System) being developed
> for Partners in Health in Haiti and other such organizations. Harvard
> has a hand in its development.
>
>> Kirby
>>
>> PS:  I came across this useful discussion on Dr. Chuck's blog
>> (he posts here sometimes -- we met at Pycon2009 in
>> Chicago).
>>
>> Reading:
>> http://scholarworks.umass.edu/cgi/viewcontent.cgi?article=1000&context=opensource
>> ___
>> Edu-sig mailing list
>> Edu-sig@python.org
>> http://mail.python.org/mailman/listinfo/edu-sig
>>
>
>
>
> --
> Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
> Silent Thunder is my name, and Children are my nation.
> The Cosmos is my dwelling place, the Truth my destination.
> http://www.earthtreasury.org/
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] open source admin in academia? (editorial)

2010-07-20 Thread kirby urner
On Mon, Jul 19, 2010 at 10:31 PM, Jarrod Millman  wrote:
> Hello,
>
> There are several open source, community developed projects
> widely-used in higher ed.  For example, moodle is a widely-used course
> management system:
>  http://moodle.com/
> Sakai is another course management system for use in higher ed:
>  http://sakaiproject.org/
> The Jasig consortium provides several applications used in higher ed:
>  http://www.jasig.org/
>
> The following, while not specifically focused on higher ed, are also
> widely deployed in higher ed environments:
>  http://roundcube.net/
>  http://squirrelmail.org/
>  http://www.list.org/
>  http://www.isc.org/software/bind
>
> Best,
> Jarrod

Thank you Jarrod, exactly the kind of doorway into this topic
I was looking for.  You've saved me some time.

Here's a random example of a commercial vendor and all
with a list of features I'm wondering if some universities
supply themselves (in-house), and/or what's out there
that's open source (perhaps with support services).

http://www.verdexsoft.net/university-software.htm

I'm seeing dribs and drabs.

I notice Yale invented Centralized Authentication Service (CAS)
and that Princeton is involved somehow.  Berkeley DB is from
Berkeley, used in OpenLDAP (originally from Umich).

These kinds of things.  Maybe there's a whole literature
I've yet to unearth.

I like to see universities taking the lead in some way...
(they call it "non-commercial"), eating their own dog food.

Same thing with hospitals.  They seem to not want to
develop much inhouse, even for research -- or maybe
I've not been inside the right hospitals?   You'd think
the open source ethic and health care would be more
hand in glove.

Then you get a bevy of commercial companies offering
expertise with these open source tools, e.g.:

http://www.unicon.net/company/about#Domain_Expertise

Note: Oracle now owns Berkeley DB and has put the Sqlite3 API
in front of it (as an option).  Costs big bucks looks like.

Kirby

PS:  I came across this useful discussion on Dr. Chuck's blog
(he posts here sometimes -- we met at Pycon2009 in
Chicago).

Reading:
http://scholarworks.umass.edu/cgi/viewcontent.cgi?article=1000&context=opensource
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-19 Thread kirby urner
On Mon, Jul 19, 2010 at 6:55 PM, Tim Peters  wrote:
> [kirby urner]
>> ... here's another basic
>> question.  Is there a way, after importing from __future__,
>> to revert to the "old ways" later on in the same script?
>> ...
>> I'm not saying this would ever be a good idea, just
>> wondering about possibilities...
>
> In general it's not possible.  At least CPython compiles an entire
> file into bytecode before anything is executed.  That's why __future__
> imports have to be the first non-trivial statements in a file:  they
> can change just about anything, including the bytecode that gets
> generated.
>
> For example, here's a little program:
>
> def f():
>    print x / y
>
> import dis
> dis.dis(f)
>
> That defines a tiny function, then displays the bytecode generated:
>
>  2           0 LOAD_GLOBAL              0 (x)
>              3 LOAD_GLOBAL              1 (y)
>              6 BINARY_DIVIDE
>              7 PRINT_ITEM
>              8 PRINT_NEWLINE
>              9 LOAD_CONST               0 (None)
>             12 RETURN_VALUE
>
> It's not necessary to know what any of those mean, although they
> should be pretty obvious ;-)  If you change the program by putting:
>
> from __future__ import division
>
> at the top, the output changes:
>
>  4           0 LOAD_GLOBAL              0 (x)
>              3 LOAD_GLOBAL              1 (y)
>              6 BINARY_TRUE_DIVIDE
>              7 PRINT_ITEM
>              8 PRINT_NEWLINE
>              9 LOAD_CONST               0 (None)
>             12 RETURN_VALUE
>
> Note that the third operation changed, from BINARY_DIVIDE to 
> BINARY_TRUE_DIVIDE.
>


Thank you Tim, that's uber-clear and enlightening.

I notice that in IDLE, even a shell restart (menu option) does not
reset division back to the old way.

IDLE 2.6.5
>>> 1/4
0
>>> from __future__ import division
>>> 1/4
0.25
>>>  RESTART 
>>> 1/4
0.25

I also recall how special name __div__ will be triggered by default
in Python 2.6 until division is imported from __future__, then
__truediv__ gets triggered instead:

>>> class Foo (object):
def __truediv__(self, other):
print "__truediv__ triggered"
def __div__(self, other):
print "__div__ triggered"

>>> o = Foo()
>>> b = Foo()
>>> o/b
__div__ triggered

>>> from __future__ import division
>>> o/b
__truediv__ triggered

If all you've done is define __div__ for your object, that'll work
by default, until you import division, then unless you have
__truediv__ defined, you'll be getting those error messages:

>>> class Foo (object):
def __div__(self, other):
print "__div__ triggered"


>>> a = Foo()
>>> a/3
__div__ triggered

>>> from __future__ import division
>>> a/3

Traceback (most recent call last):
  File "", line 1, in 
a/3
TypeError: unsupported operand type(s) for /: 'Foo' and 'int'
>>> a/a

Traceback (most recent call last):
  File "", line 1, in 
a/a
TypeError: unsupported operand type(s) for /: 'Foo' and 'Foo'

> This is all done before anything in the file is executed, so after
> execution begins it's too late to change any of it:  the opcode will
> remain whatever was generated at the start (BINARY_DIVIDE or
> BINARY_TRUE_DIVIDE) no matter what you do while the program is
> running.  After all, the instant after you import the future, it
> becomes the past, and nobody can change the past ;-)
>

I'm a little surprised that resetting the IDLE shell doesn't reset
division "back to factory".  It does disappear from the namespace:

>>> dir()
['Foo', '__builtins__', '__doc__', '__name__', '__package__', 'a', 'division']

>>>  RESTART ===

>>> dir()
['__builtins__', '__doc__', '__name__', '__package__']

>>> division

Traceback (most recent call last):
  File "", line 1, in 
division
NameError: name 'division' is not defined

>>> 1/4
0.25

Maybe it shouldn't be allowed to disappear from the namespace (del division
raises an exception) as long as its effects are enforced.  That way a program
could test for it.  But then I supposed there's another way.

Reading from PEP 238:

The true and floor division APIs will look for the corresponding
slots and call that; when that slot is NULL, they will raise an
exception.  

Re: [Edu-sig] open source admin in academia? (editorial)

2010-07-19 Thread kirby urner
On Mon, Jul 19, 2010 at 5:29 PM, Edward Cherlin  wrote:
>
> It frequently happens that the Computer Science Dept. uses Free
> Software for almost everything, and everybody else uses proprietary
> software. CS can't talk to the others effectively, because they are
> "just geeks". I have more hope for elementary schools.
>

Yes, I understand.

Actually I suppose my query has two components, one having to do
with the self sufficiency of educational institutions when it comes to
the core software needed to run their operations...

and the other having to do with free and open source software,
which is one way communities band together collaboratively,
in order to co-develop said core software.

Like maybe MIT has some big programs for scheduling courses,
registering students, keeping info on financial aid / scholarships,
and publishing the catalog, all of which was developed in-house
over many iterations -- but none of these applications have been
released under GNU or other open source license.

In that case, MIT would be self sufficient by criterion (a), but is
not in the business of helping other schools ramp up using
customized versions of said FOSS software (b).  Maybe it's
too site specific?

MIT's in-house solutions might use open source (e.g. Python)
but the solutions themselves are the closely guarded secrets
of MIT (likewise a private company or government agency, like
Industrial Light and Magic, or NASA, might use Python but
not see any reason to share code).

This is all familiar ground by now -- we're all aware of these
distinctions.

I'm just thinking back to all those OSCON talks by R0ml
Lefkowitz and others, connecting FOSS practices and ethics
to the culture of the liberal arts.

If FOSS is about empowering and enabling local control,
then why would any self-respecting academy want to outsource
its core functions?  What kind of message does that send?

One could imagine that big strong universities would be
somewhat self-sufficient, semi-autonomous, when it came to
managing their own admin internals.  Do we have some well
known examples?

Having the system completely open for tweaking to those
on the premises potentially means faster evolution, more
expression of the human imagination, a tighter coupling
between theory and practice, drawing board and realized
features.  Schools could develop a reputation for the
ingenuity of their internal applications, which might also
help students coordinate their own schedules, promote
events, submit work etc.  Teachers would have access to
multiple resources as well, including tools no one has
thought of yet...

Beyond that, it means a culture that knows first hand
about collaborating on large projects, complete with
version control, division of responsibilities and all the rest
of it.  Shouldn't universities be centers of innovation,
starting with the bread and butter applications that
define their institutional relationships?

I remember a panel discussion I attended at a previous
OSCON, about open source in Africa.  The institutions in
that picture were quite keen to do as much of their own
programming as possible, as the whole point was to develop
the skills and understanding needed for self sufficiency.
Licensing fees can be a huge drain, and are in principal
avoidable in this day and age, given sufficient commitment
to local control.

I also remember CERN having some conference scheduling
software the EuroPython tried to repurpose for some
context outside CERN, and how frustrating that was.
Not every inhouse tool is equally adaptable.  Similar question
on Slashdot, re FLOSS conference management software:
http://ask.slashdot.org/article.pl?sid=05/07/02/1954247

>
> There are exceptions, such as Moodle.
>

I suppose the argument could be made that universities
charged with teaching just don't have the time and
resources to compete with private industry, when it
comes to developing software for production use,
bug free enough to entrust with student records and
finances.

However, given how Linux, FreeBSD and GNU got off
the ground, you'd think there'd be a ready-made culture
of developers here, at least in some schools.

Add the open source ethic and model for sharing, and one
wonders why there's not already a lot of free and open
solutions out there -- like frameworks.

Here's something obscure that's at least in the ballpark:

http://tinyurl.com/2dpr6eb

"""
This paper describes a WAP-based course registration
system designed and implemented to facilitating the
process of students' registration at Bahrain University.
The framework will support many opportunities for
applying WAP based technology to many services
such as wireless commerce, cashless payment…
and location-based services.

...so is Bahrain University somewhat self sufficient when
it comes to admin software?

Kirby

>
> On Mon, Jul 19, 2010 at 18:30, kirby urner  

[Edu-sig] open source admin in academia? (editorial)

2010-07-19 Thread kirby urner
I'm becoming more aware of the fact that one
reason universities need to charge those
tuitions is to pay licensing fees to private
vendors who provide them with such basic
services as the ability to store and schedule
classes, record student enrollment and grades,
record instructors etc.  The catalog needs to
be published on-line.  There might be a lot
of extended education options, e.g. non-credit
courses open to anyone willing to sign up.

Some of these proprietary programs are pretty
old, lack features departments need, and so
various intermediating applications grow up
around the edges to fill in the gaps.

Maybe the big dino system doesn't record
student evaluations for example, or keep track
of which courses are in the pipeline, but still
haven't found a place in the sun.

One would think that universities in particular,
which pride themselves on having advanced
knowledge of state of the art skills, would band
together in various consortia to pool resources
and "eat their own dog food" as it were.  A
school that teaches medicine actually practices
medicine (the "teaching hospital").  Shouldn't
schools that teach computer science and
business administration actually walk the talk
in some way?  Maybe many of them do, I don't
actually know.

To outsource something so core to one's business,
to pay licensing fees while not having the power
to make design modifications, just seems more
than a tad on the ironic side.  It's like a bank
outsourcing everything it does around money.

I realize not every college or university wants to
reinvent the wheel around something so basic,
but I do wonder to what extent there's some
open source sharing going on, around these core
utilities.  Are universities so competitive they
won't share?  So does that mean they all pay
the same licensing fees to use the same
private vendor offerings?

I remember Zope / Plone and SchoolTool.
http://en.wikipedia.org/wiki/SchoolTool

Is there something even more comprehensive
that's out there, suitable for college and university
use?  Does it come in modularized components?
Is it an over-the-web database?

Or do few if any universities really eat their own
dog food?

Like I say, I'm new to this business, just trying
to get oriented.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-19 Thread kirby urner
On Fri, Jul 16, 2010 at 1:41 PM, kirby urner  wrote:


>
> I'll return to post a link to my followup post.
>

So here are my two write-ups of the just completed
Programming in Python (SA:10648):

http://worldgame.blogspot.com/2010/07/teaching-again.html
http://worldgame.blogspot.com/2010/07/finish-line.html

Also, the math teachers on math-teach @ Math Forum
are starting to ramp up again, on the whole idea of
pre-college computer science or digital / discrete math
or whatever we call it:

Here's a link to the thread (public archive).

http://mathforum.org/kb/thread.jspa?threadID=2095707&tstart=0

You'll see me weighing in with my familiar (to some here)
views, but also expressing this new angst about IDLE.

Excerpts:

"""
Steve Holden, chairman of the Python Software Foundation,
has been suggesting the it may be time to retire IDLE,
removing it from the standard distro. Indeed, on Ubuntu
I'm pretty sure one needs to install it separately...
"""

"""
When learning programming for the first time, you can
dive into object oriented thinking right away, because
this style of thinking was modeled on ordinary human
grammar.

noun.verb( ) and noun.adjective correspond to things
(nouns) having behaviors and attributes (what could
be more natural)?
"""

I talk about some of my history lobbying for a new
discrete math course here -- how I first become aware
of the Litvins text (at a planning workshop with
Chris Brooks just about one year ago):

"""
For those new to this list, I've been putting myself out
there as a kind of lobbyist trying to get something called
computational, digital, discrete and/or fill-in-the-blank math
that is for-credit in equal measure with any of the pre-calc
or calc track classes. I've done a lot of writing about this,
describing my network and our political tactics. I won't
go into all that again here.
"""

http://mathforum.org/kb/thread.jspa?threadID=2095937

Kirby

>
> Kirby Urner
> 4dsolutions.net/ocn/cp4e.html
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-16 Thread kirby urner
On Fri, Jul 16, 2010 at 9:31 AM, John Posner  wrote:
> On 7/16/2010 9:59 AM, kirby urner wrote:
>>
>> ...  Using print as a function is optional in 2.6 without
>> importing anything special.
>>
>
> Kirby, I believe you're confusing these two invocations:
>

Yes, you're correct, that's precisely what I was doing.

> * Using the print *statement* with a single argument (or expression)
> enclosed in parentheses.
>
> * Using the print *function* with a single argument
>
> Using multiple arguments clears things up:

I'm glad we're touching on this at length, as people
flooding into our pool find themselves waste deep
with backward / forward compatibility issues, and
may fall for the same self-deception I did for a moment.
For another response, see:

http://mail.python.org/pipermail/edu-sig/2010-July/010040.html

Our class concluded today, although I still have some
paperwork to send in, will do that in a few minutes.
I've got an initial blog write-up here, planning another
follow-up post likely later today, also uploading to
Photostream.

Today we talked about RSA a lot, played my silly Google
video, a rambling blather through group theory etc.
(8+ mins).  We also wrote generators for cuboctahedral
numbers and Fibonacci's, both times going of Encyclo-
pedia for Integer Sequences.  If that sounds like a total
geek out, it was.  Also screened two cartoons.

One student got file sharing to work between his hosting
and guest operating systems on VirtualBox.  Another
got his random forest of cylinder/cone VPython objects
to work.  I lectured at quite some length on the history
of the Internet as a succession of protocols, though I was
somewhat vague on the sequence:  smtp, nntp, ftp, http...
whatever (this was before screening 'Warriors of the Net',
one of the two cartoons).

I'll return to post a link to my followup post.

Kirby Urner
4dsolutions.net/ocn/cp4e.html
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-16 Thread kirby urner
On Fri, Jul 16, 2010 at 7:27 AM, Tim Peters  wrote:
> [kirby]
>> ...
>>  Using print as a function is optional in 2.6 without
>> importing anything special.
>
> Nope!  `print` is a statement in all 1.x and 2.x versions of Python.
> When you do, say,
>
>    print(1)
>

Ouch, thank you for clearing up a basic confusion Tim!

I knew this only a month ago when I *did* use

from __future__ import print_function

in another Python 2.6 class, but in the fog of battle
was lapsing into a more punch drunk state.  I could
feel when I was writing that last post that I was
saying something wrong.  But what?

I'm glad to be performing in the role of "dunce clown" here
-- somebody's gotta do it (?), might as well be me.

While I'm being in this mode, here's another basic
question.  Is there a way, after importing from __future__,
to revert to the "old ways" later on in the same script?
Here was my (failed) experiment along those lines:

>>> 1/2
0

>>> from __future__ import division
>>> 1/2
0.5
>>> del division
>>> 1/2
0.5
>>> division

Traceback (most recent call last):
  File "", line 1, in 
division
NameError: name 'division' is not defined
>>> from __future__ import division
>>> division
_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)

I'm not saying this would ever be a good idea, just
wondering about possibilities...

Kirby

> before Python 3.x, you're not calling a print function with an
> argument of 1, you're giving the expression (1) to the print
> statement.  (1) is the same thing as 1, so it just prints "1".
>
> Maybe the difference is clearer here:
>
>    print(1,2,3)
>
> Before 3.x, tjat's the same as
>
>    _x = (1, 2, 3)
>    print _x
>
> That is, it's not passing arguments 1, 2 and 3 to a print function,
> it's giving a single expression - the 3-tuple (1, 2, 3) - to the print
> statement - and is very different from
>
>    print 1, 2, 3
>
> (which gives 3 expressions - not just 1 - to the print statement).
>
> It's really the same as doing, e.g.,
>
>    return(1)
>
> `return` and `print` are statements, and tacking "(1)" on does not
> magically turn either into a function call, it's just adding redundant
> parentheses to the expression "1".
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-16 Thread kirby urner
Good question John.

My lengthy post was confusing because I want on the riff about
how range() doesn't return a list in 3.x (but a range object,
iterable but not an iterator).

In point of fact, I'm using Python 2.6 from start to finish in
this class, with only allusions and honorable mentions of 3.x
features.  Using print as a function is optional in 2.6 without
importing anything special.

Here we are:

>>> import sys
>>> sys.version
'2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]'
>>> "{0}".format(1)
'1'
>>> print(1)
1

I'm actually forgetting what we might need to import anymore, to
make 2.6 behave like 3.x, when it comes to print and string formatting.


Kirby


On Fri, Jul 16, 2010 at 6:17 AM, John Posner  wrote:
> Kirby wrote:
>
>>     for question, answer in quiz:
>>         print(question)
>>         user_answer = raw_input("Your answer? ")
>>
>
> Kirby, will the class be using Py2 or Py3? It looks like you're
> mix-and-matching, using the *print* function (Py3) along with the
> *raw_input* function (Py2). Do you really want to inflict "from __future__
> import print_function" on your students?
>
> Best,
> John
>
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-15 Thread kirby urner
On Thu, Jul 15, 2010 at 7:37 PM, Tim Peters  wrote:

<< snip >>

> In fact, if you don't mind permuting the quiz each time, there's no
> need to make a copy of the quiz then either (because nothing is ever
> removed from it):
>
> def askq(quiz = quiz1):
>     shuffle(quiz)
>     for q, a in quiz:    # marches over the questions in a random order
>         # `q` is the question, `a` is the answer

Yep, Tim's way is so much more Pythonic.

Here's a new version for tomorrow's class:

def askq2(quiz = quiz1):
score = 0
possible = len(quiz)
shuffle(quiz)
for question, answer in quiz:
print(question)
user_answer = raw_input("Your answer? ")

if user_answer.upper() == answer.upper():
# yes and Yes would both count (but not Y)
print("Correct!")
score = score + 1
else:
print("Correct answer was %s" % answer)

print("Your score was %s out of a possible %s" % (score, possible))

Onward!

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] source code from SA:10648

2010-07-15 Thread kirby urner
On Thu, Jul 15, 2010 at 9:24 AM, kirby urner  wrote:

> Here is some of the code we will be using in class today.  After that,
> a source code file from yesterday's class:
>
>
> Some Games
> """
>
> from random import randint, choice
>
> # a list of (question, answer) tuples
> quiz1 = [("What is the capital of Oregon?", "Salem"),
>   ("Is Portland north of Salem?", "Yes"),
>   ("Does I-5 go to Seattle?", "Yes"),
>   ("Does I-5 go to Pendleton?",  "No")]
>
> quiz2 = [("What is the capital of Washington State","Olympia"),
> ("Are kangaroos native to China?","No"),
> ("Who is the president of the USA?", "Obama"),
> ("What computer language is named for Monty Python?", "Python")]
>
> quizzes = [quiz1, quiz2]  # list of possible quizzes
>
> def askq(quiz = quiz1):
>score = 0
>possible = len(quiz)
>while len(quiz) > 0:
>pickone = randint(0, len(quiz)-1)
>print(quiz[pickone][0])
>answer = raw_input("Your answer? ")
>
>if answer.upper() == quiz[pickone][1].upper():
># yes and Yes would both count (but not Y)
>print("Correct!")
>score = score + 1
>else:
>print("Correct answer was %s" % quiz[pickone][1])
>
>quiz.pop(pickone)
>
>print("Your score was %s out of a possible %s" % (score, possible))
>
>
So there's a not-so-subtle bug in the above loop, in that the quiz.pop
method exhausts the target list -- forever and for good, so that next
time you run the quiz, either quiz1 or quiz2 (both global variables) will
have been commended to the ether.

As a class exercise, I was encouraging students to use this scaffolding
to think of other quizzes and add them as quiz3, quiz4 etc.  Note that
the menu loop picks one at random:

elif sel == "1":
  # randomly choose a quiz
  askq(choice(quizzes))

So the chances are good that one will get an empty quiz
(list of (Q,A) tuples).  The program doesn't crash, but you get
a score of 0 out of a possible 0.

The remedy, one of them, is just to use a copy of the list internally.

At this point, a student discussed his travails wanting to copy
a dictionary, after getting bit in the butt by the "multiple references
to same object" feature.

He'd discovered the copy module on his own.

However in this case, with a list, I went with thelist[:] way of doing it.
Here's the remedied function:

def askq(quiz = quiz1):
score = 0
possible = len(quiz)
thequiz = quiz[:]  # from hence forth, use thequiz, leave quiz alone

while len(quiz) > 0:
pickone = randint(0, len(quiz)-1)
print(thequiz[pickone][0])
answer = raw_input("Your answer? ")

if answer.upper() == quiz[pickone][1].upper():
# yes and Yes would both count (but not Y)
print("Correct!")
score = score + 1
else:
print("Correct answer was %s" % quiz[pickone][1])

thequiz.pop(pickone)

print("Your score was %s out of a possible %s" % (score, possible))

Now of course it's problematic to be popping off a list just because
you wanna not hit the same question twice, and are picking
questions randomly.  Sure, this is one way to prevent duplicates.
Even the while loop is pegged to the list length.  Didn't have to
be this way.

Just as good if not way better, is to shuffle the indexes ahead
of time e.g. indexes = range(len(thelist)); indexes.shuffle().

That'll give you a random sequence on a "primary key" with no
need to mess with popping data off a list copy.

Remember that in Python 3.x, range no longer returns a list
but a range object, a kind of iterable, but not an iterator (you
can't run next on it):

>>> indexes = range(20)
>>> indexes
range(0, 20)

Some older Python...?

>>> indexes.next()
Traceback (most recent call last):
  File "", line 1, in 
indexes.next()
AttributeError: 'range' object has no attribute 'next'

However, next(indexes) is still no good, because an
iterator needn't be nextable:

>>> next(indexes)
Traceback (most recent call last):
  File "", line 1, in 
next(indexes)
TypeError: range object is not an iterator

OK, make us an iterator then:

>>> theiter = iter(indexes)
>>> next(theiter)
0
>>> next(theiter)
1

Now we're in business.  Start over if we like:

>>> theiter = iter(indexes)
>>> next(theiter)
0

You can have lots of iterators off 

[Edu-sig] source code from SA:10648

2010-07-15 Thread kirby urner
Here is some of the code we will be using in class today.  After that,
a source code file from yesterday's class:


Some Games
"""

from random import randint, choice

# a list of (question, answer) tuples
quiz1 = [("What is the capital of Oregon?", "Salem"),
   ("Is Portland north of Salem?", "Yes"),
   ("Does I-5 go to Seattle?", "Yes"),
   ("Does I-5 go to Pendleton?",  "No")]

quiz2 = [("What is the capital of Washington State","Olympia"),
 ("Are kangaroos native to China?","No"),
 ("Who is the president of the USA?", "Obama"),
 ("What computer language is named for Monty Python?", "Python")]

quizzes = [quiz1, quiz2]  # list of possible quizzes

def askq(quiz = quiz1):
score = 0
possible = len(quiz)
while len(quiz) > 0:
pickone = randint(0, len(quiz)-1)
print(quiz[pickone][0])
answer = raw_input("Your answer? ")

if answer.upper() == quiz[pickone][1].upper():
# yes and Yes would both count (but not Y)
print("Correct!")
score = score + 1
else:
print("Correct answer was %s" % quiz[pickone][1])

quiz.pop(pickone)

print("Your score was %s out of a possible %s" % (score, possible))

def guessing(a=0,b=10):
thenumber = randint(a,b)
while True:
print("I'm thinking of a number between %s and %s, what is it?" % (a,b))

answer = raw_input("Guess (q to quit): ")

if answer == "q":
print("Thanks for trying, the number was %s" % thenumber)
break # escape loop

if not answer.isdigit():
# trap non-integer answers
print("That's not a number!")
continue # loop again

answer = int(answer)  # convert to integer
if answer == thenumber:
print("That's it!")
break  # escape loop
elif answer < thenumber:
print("Try larger!")
elif answer > thenumber:
print("Try smaller!")

def mainmenu():
while True:
print("""
What game would you like to play?
1  Take a Quiz
2  Guess a Number
0  Exit""")
sel = raw_input("Your selection? ")
if sel == "0":
  print("OK, Good Bye")
  break
elif sel == "1":
  # randomly choose a quize
  askq(choice(quizzes))
elif sel == "2":
  guessing()
else:
print("Huh?  Please try again")


if __name__ == "__main__":
# askq(quiz1)
# guessing()
mainmenu()


===


from random import randint, random, choice

allcolors = [color.orange, color.red, color.magenta, color.yellow, color.blue,
 color.white, color.green]


def randcolor():
return (random.random(), random.random(), random.random())

def junk(n=100):
for i in range(n):
draw = choice(["ball", "box"])
if draw == "ball":
manyspheres(1)
else:
manyboxes(1)

def manyboxes(n=100):
"""
make random boxes

mybox = box(pos=(x0,y0,z0), length=L, height=H, width=W)
"""
for i in range(n):
thebox = box(
pos=(randint(-100,100), randint(-100,100), randint(-100,100)),
size = (randint(1, 10),randint(1,10),randint(1,10)) ,
color = randcolor())

def manyspheres(n=100):
for i in range(n):
theball = sphere(
pos=(randint(-100,100),randint(-100,100),randint(-100,100)),
radius = randint(1, 10),
color = randcolor())

def xyz(n=10):
posx = cylinder(radius = 0.1, pos=(0,0,0), axis = (n,0,0), color =
color.white)
negx = cylinder(radius = 0.2, pos=(0,0,0), axis = (-n,0,0), color
= color.white)
posy = cylinder(radius = 0.3, pos=(0,0,0), axis = (0,n,0), color =
color.white)
negy = cylinder(radius = 0.4, pos=(0,0,0), axis = (0,-n,0), color
= color.white)
posz = cylinder(radius = 0.5, pos=(0,0,0), axis = (0,0,n), color =
color.white)
negz = cylinder(radius = 0.6, pos=(0,0,0), axis = (0,0,-n), color
= color.white)

def circle():
print "Making a circle"
theball = sphere(pos=(2,0,0), radius = 1, color = color.red)
for i in range(1):
newx = 2 * math.cos(math.radians(i))
newy = 2 * math.sin(math.radians(i))
theball.pos = (newx, newy, 0)
rate(30)

def clock():
bighand = cylinder(radius = 0.1, pos=(0,0,0), axis = (0,10,0),
color = color.green)
littlehand = cylinder(radius = 0.1, pos=(0,0,0), axis = (0,5,0),
color = color.white)
clock = ring(pos=(0,0,0), axis = (0,0,1), radius = 10, color =
color.red, thickness = 0.1)
for i in range(0, -1, -1):
newx = 10 * math.cos(math.radians(90 + i ))
newy = 10 * math.sin(math.radians(90 + i ))
bighand.axis = (newx, newy, 0)
newx = 5 * math.cos(math.radians(90 + i/12.))
newy = 5 * math.sin(math.radians(90 + i/12.))
littlehand.axis = (newx, newy, 0)
rate(30)


# student code sent

[Edu-sig] class notes (post facto)

2010-07-12 Thread kirby urner
The login process was pretty smooth at PSU.  On first login,
they're asked to change passwords.

I kept harping on their needing to not forget the new passwords,
but of course it's the user names, not the passwords, they're
likely to lose.

It's all coming back to me now (I've taught this class, or one
like it, before).

I got to park blocks way early, visiting Libyan coffee shop
to get a some "joe" and the time of day (of all days to leave
my cell phone at home...).  Took the bus 14, then hopped
a light rail to get closer.  PSU is right in downtown Portland.

I decided to spend really quite a bit of time on the 1/2 == 0
business, still using Python 2.6.

Why?

In part because showing them how to get an answer of 0.5,
without doing the "from __future__" trick, is a great segue
into talking about types, i.e. to have an answer of 0.5, enter
something like:  1.0/2 1./2 1/2. or 1/2.0 or even 1.0/2.0

This leads directly to querying some named object as to
its type.

First go over assignment of names, using the assignment
operator, e.g. a = 2, then ask for the type of a -- type(a) --
to get .

I consider "type awareness" sort of the alpha and omega
of this kind of computer programming (yes, being vague
about "this kind").

After yakking about both ints and floats, it's time to
introduce strings, which makes the learning curve go
steep like a rocket.  So much to do with strings.

I got into palindromes, and string reversal.  Had to ask
if anyone knew about Napoleon.  One student did, gave
us some history.  It's that old "able was I ere I saw elba"
back story, purely fictional.  I want to talk about
Napoleon again soon, in connection with The Turk,
the first chess playing automaton (or so Napoleon
supposedly thought he was playing, when he lost to
it -- if true, that coulda been traumatizing on some
level eh?).

Before getting to all that stuff about strings though,
I was into telling other stories.  Guido naming the
language after Monty Python (whom most had
heard of -- also looked at xkcd) and then getting
DARPA funding to write IDLE: a good way to
introduce IDLE itself, which we're using.

These are Windows XP boxes and IDLE tends to
work OK on those.  It's a disaster on some versions
of Mac though, found that out at STScI.

Steve Holden, PSF chairman, is raising this question
in the community:  is it time to retire IDLE, remove
it from the standard library?  Does it hurt Python
more than help it at this point?

Anyway, I like to tell stories.  If you ever wanna track
down the 52 minutes of me on Blip TV, from the
International Room of a Hyatt Regency near O'Hare
in Chicago, you'll find me plotting "lore" and "technical"
as orthogonal axes, with a kind of "opportunity cost"
curve representing finite bandwidth and a freedom to
keep varying the mix.

Get really technical for awhile, then go back to
sharing lore, then gradually add in more skills
building...

We went on to function defs,  which gets into indentation
heavy duty -- and the story of how Python is *not* a
curly-brace language.

I talked about the XO and OLPC, about Sugar, showed
a favorite picture.  I talked about the downward pressure
the XO had exerted in the calculator market, to where
now people had these 2- and 3 hundred dollar netbooks,
though without the swivel screen the XOs had usually.

I'll keep returning to these themes over the next few
days I'm pretty sure.

We did quite a bit with the arithmetic operators, but
so far not an excessive amount.  "Using Python as a
calculator" (interactively in a shell) seems to be the
"out of the box" experience many of us expect to
start with.  Good segue to Sage I would suppose.

One kid went 2**2**2**2**2.. **2 a few times, which
quickly maxed out computer memory.

Another kid hacked into his laptop at home, ran
Python there or some such.  This is a school that
attracts some of the freakishly gifted and otherwise
weird.  My job is to keep it all moving right along.

Lots of chatter about the C language, which several
of these students have tackled already.

I brought up APL and J as in some ways "other end
of the spectrum" (way alien) so they could appreciate
how different computer languages can be.  On the
other hand, Python and APL have quite a bit in
common too (especially when you add in numpy).

I talked about Scheme and LISP and how these
would have been your languages at MIT if just
starting into computer science.  Python has joined
that list of elite languages (presuming one looks up
to MIT, which by this time I've linked to OLPC, so
at least there's some credibility there).

The function I most wanted to have them define
would eat any string and return the same string in
reverse.  This is fun for playing with palindromes.

They'll probably dream about it tonight (I know I will).

One kid, who also asked about SSL (secure sockets
layer), a 7th grader, found out about "join" just by
browsing docs in a hurry (and asked them to shoot
for a solution out of the blue).

A solution is like:

def rev (

[Edu-sig] Gearing up (Python course...)

2010-07-10 Thread kirby urner
I'm gearing up to do another Python course.  PSU seems
more locked down than ever BTW.  I've gotta be met by an
official to hand out user logins, as these cannot be
transmitted electronically.

That's not how it used to be when I taught there before.

We're going back to hand carry and paper delivery for
more sensitive information apparently, kinda retro.
I should wear something sensibly 1940s.

A primary technique is to teach enough basic syntax,
after startup and shutdown practice, to enable "doodling".

This means I get to talk about one thing, while they
multi-task, checking out arithmetic ops, range(), slice,
a few string ops, check the error messages.

Chatting about help & dir helps some, but probably
more useful is I doodle some too, projecting up front.

We cover a few bases, then they doodle while I ramble.
Maybe I talk about PEPs, go over some history, yak
about Pycons, poster sessions, user groups...

Then we cover a few more bases and repeat.

Doodle while hearing some talk about open source,
GNU, GPL, MIT, OLPC... chime in with news and views?
We'll get to Lightning Talks later (a way for students
to voluntarily share about projects).

A goal is to develop comfort with simple interactivity,
you could say "using Python as a calculator".  Saving
to site-packages, importing the namespace (different
ways to import) should round out this first section.

In terms of content, things to program around, I tend
to wander into spatial geometry, but not with any
coordinates or turtles at first.

I've got this "geometry plus geography" heuristic
goin' where these are the only two subjects under
the sun (per posts to mathfuture, a Google group),
so it's easy for me to frequent this area.

Geometry is thinking (imagination) and Geography
is the real world (i.e. everything else).

I'm a big fan of "gnomon studies" [0] which includes
figurate and polyhedral numbers.  'The Book of
Numbers' by Conway & Guy was influential.

I've already filed hundreds of posts about this in this
archive, so probably shouldn't get too verbose.

10 * f * f + 2 is a good one to play with.

>>> [10 * f * f + 2 for f in range(11)]
[2, 12, 42, 92, 162, 252, 362, 492, 642, 812, 1002]

The initial 2 should be a 1 if you wanna match up
with Encyclopedia of Integer Sequences.[1]

I like having polyhedra going, via figurate numbers,
because they're the paradigm "objects" or "action
figures" of the cybernetic vista.

Figurate or polygon numbers become polyhedral
numbers, i.e. we go from triangular numbers to
tetrahedral numbers pretty easily, or squares
to half-octahedra (Egyptian pyramids).

[ Actually, over on Math Forum, I've got a
curriculum guy telling me polyhedra just don't
relate to anything, that he can see, so I realize
it's sometimes an uphill battle to champion
their relevance, chemistry and biology
notwithstanding (all geography in the two-
subject framework) ]

Any "sim" or screen character may be thought of
as an animated, multi-faceted avatar, a "puppet"
of behind-the-scenes software (screen-as-theater,
one of the oldest motifs, so familiar from television).

However, aside from a few Youtubes (e.g. [2]), other
static web pages, I'm mostly relying on student
imaginations to provide the visuals at first.  It's like
learning to read without pictures, engaging the
imagination while focusing on a purely lexical
activity (reading).

I'm pretty adamant that programming is a more lexical
and/or algebraic activity, and whereas I'm a big fan
of right brain mental geometry, I'm concerned that
too many resources pander to an anti-lexical bias,
feeding student aversion to "straight text".

At some point, it pays to stop trying to make every
experience some kind of video game.  Better to
get back to games with words themselves (more
like crossword puzzles) and cultivate an awareness
of those.

Messing with fonts may come in handy (in Portland
we have Bram Pitoyo, a total font head, frequents
the conferences).  I always like to show off Akbar
font, mention The Simpsons and Matt G. (from
around here).

There's a kind of stunting or atrophy of the left brain
we need to worry about as well (cuts both ways).

That's why I want early "doodling" to be chiefly
lexical, with no immediate "turtle gratification"
(nor VPython at first, much as I love to use that
add-on).

Remember, these are teenagers, not tiny children.
They likely know how to type some, and won't have
a problem spelling out words.

Having these "words" (expressions, short programs)
"laugh and play" i.e. "talk back" because of the
interpreter environment, is supposed to be a game
in itself (a kind of "language game").

It's supposed to be interesting to reverse lists (play
with palindromes), pop a stack, feed a queue or
whatever.  Look up in a dict.  import cos and sqrt.

>>> from math import sqrt as root2
>>> root2(4)
2.0

>>> def root3(x):  return pow(x, 1.0/3.0)

>>> root3(27)
3.0

To uphold my reputation as an "objects first" kind
of teacher, I'm going to focus at least part o

[Edu-sig] Python script to generate whole cities in Blender

2010-07-05 Thread kirby urner
We haven't discussed Blender much on edu-sig,
but thought I'd share this link anyway:

http://arnaud.ile.nc/sce/index.php

With thx to synchronofile.com

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Updating some more...

2010-07-01 Thread kirby urner
Totally mind-boggling Gary.

Tracing through On-Line Dictionary of Integer Sequences I figured out
how to do it recursively, which might not be as much fun.  For one
thing, it takes forever to run.  I despair of ever reaching p(200) this way.
Major MacMahon rocks 'n rules (Hardy and Ramanujan too).

This song about Ramanujan's life is both funny and kinda sad:
http://www.archive.org/details/Ramanujan
(play control in upper right)

Kirby


>>> gen = a41()
>>> [next(gen) for i in range(60)]
[1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231,
297, 385, 490, 627, 792, 1002, 1255, 1575, 1958, 2436, 3010, 3718,
4565, 5604, 6842, 8349, 10143, 12310, 14883, 17977, 21637, 26015,
31185, 37338, 44583, 53174, 63261, 75175, 89134, 105558, 124754,
147273, 173525, 204226, 239943, 281589, 329931, 386155, 451276,
526823, 614154, 715220, 831820]

Here's the code:


def a41():
gen = a137683()
while True:
yield sum(next(gen))

def pascal():
row = [1]
while True:
yield row
row = [i+j for i,j in zip(row + [0], [0] + row)]

def invpascal():
gen = pascal()
while True:
row = next(gen)
if len(row)%2:
yield [row[i]*pow(-1,i) for i in range(len(row))]
else:
yield [row[i]*pow(-1,i+1) for i in range(len(row))]

def a137683():
gen1 = invpascal()
gen2 = a026794()
n = 1
ipmatrix = [] # inverse pascal triangular matrix
while True:
ipmatrix.append(next(gen1))
result = []
row = next(gen2)
for i in range(n):
col = [0 for j in range(n)]
for k in range(i,n):
col[k] = ipmatrix[k][i]
result.append(sum([i * j for i,j in zip(row, col)]))
yield result
n += 1

def a026794():
n = 1
while True:
row = []
for k in range(1, n+1):
row.append(T(n,k))
yield row
n += 1

def T(n, k):
"""
T(n, k)=if(k<1|k>n, 0, if(n==k, 1, sum(i=k, n-k, T(n-k, i
"""
if k < 1 or k > n:
return 0

if n == k:
return 1

else:
return sum([T(n-k, i) for i in range(k, n-k+1)])

# bonus, not used
def a010054():
n = 0
incr = 0
tri = incr
while True:
if n == tri:
yield 1
incr += 1
tri = tri + incr
else:
yield 0
n += 1







On Wed, Jun 30, 2010 at 6:49 PM, Litvin  wrote:
> At 07:01 PM 6/30/2010, kirby urner wrote:
>
> I did something similar with a Ramanujan series converging to pi...
>
> Since you mentioned Ramanujan...
>
> He and Hardy worked quite a bit on the partition function: p(n) = the number
> of different ways n can be represented as a sum of positive integers.  The
> sequence p(n) starts like Fibonacci numbers, 1, 1, 2, 3, 5... but the next
> one is 7.  Nice try!
>
> At some point around 1916, an amature mathematician Major MacMahon, who was
> "good with numbers" calculated _by hand_ for Hardy and Ramanujan p(n) for n
> = 1 through 200.  p(200) happens to be  3,972,999,029,388.  An interesting
> story.
>
> It is possible, of course, to write a recursive function to calculate p(n),
> but a more fun way is to use the generating function (1 + x + x^2
> +x^3+...x^n)*(1+x^2+x^4+x^6+...)(1+x^3+x^6+...)*...*(1+x^n) (due to Euler,
> as most everything else...)  When you distribute, the coefficients at x,
> x^2, ... of the resulting polynomial give you p(1), p(2), ... So this could
> be a basis for a meaningful project on lists and polynomials.
>
> If you plug a large enough number into the generating function, say, x =
> 1, you get a number whose groups of five digits (from the right) give
> you p(n) as long as p(n) < 1.  So for a relatively small n instead of
> multiplying polynomials you can multiply "periodic" integers
> 100010001...0001*10001...0001*...
> It is easy, of course, to generate these numbers using strings.  Then this
> becomes a meaningful exercise on strings.
>
> I am currently working on a "test package" for the Math and Python book and
> I've just added a question based on a small peace of this, so I felt like
> sharing.  Not sure whether this is for the left brain or for the right
> brain; these periodic strings are kinda cute. :)
>
> Gary Litvin
> www.skylit.com
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Updating some more...

2010-06-30 Thread kirby urner
Yeah, Python 3.x is not ready for prime time in several respects,
all talk of Eclipse aside, but that's to be expected as it's still
pretty new.

I've seen some buzz regarding the #python channel on Freenode,
where I gather some bots have been automatically steering
people away from the 3.x series.

edu-sig doesn't have any real time channel for assisting educators
or their students I don't think.  Too over-specialized maybe.
Asynchronous is good enuff, no need to compete with #python
eh?

Belated congrats to Vern Ceder for stepping up to lead poster
session at usa.pycon 2011 in Atlanta per PSF blog.
http://pyfound.blogspot.com/2010/06/leadership-for-pycon-us-2011.html

I think py-dev is aware of the situation with Python 3.x and
those planning to use that product for production roll outs will
continue encouraging its swift evolution.

As I was mentioning, the O'Reilly School of Technology has
already made the switch, as have the authors of Mathematics
for the Digital Age.[1]

Where I'm focused a lot goes back to spatial geometry and
VPython which I think gives just the right amount of "right brain"
gratification to let the "left brain" keep exercising those lexical
skills (programming, like algebra, like bash/posix/gnu, is
highly lexical).

Geometry + Geography is how the simulation games tend to
work, with a geography being potentially fantastic, a fantasy,
like Alice (in Wonderland) or Uru.[2]  Or a game might be closer
to real, as when running macro and micro economics
simulations (e.g. electrical grid management vs. home
appliances management).[3]

You'll find me on mathfuture (Google group) and math-teach
@ Drexel among other places.  A lot of times I don't think
the material is Pythonic enough to merit any notes to this list.
Sometimes I meet up with other posters to this list.

Using the Decimal class to explore limits some more is in
my queue.  For example, the number e, as in "e ** (1j * math.pi) = -1"
may be expressed as lim (1 + 1/n) ** n.

>>> import math
>>> math.e ** (1j * math.pi)
(-1+1.2246467991473532e-16j)

>>> n = 1.
>>> (1 + 1/n) ** n
2.7181459268249255
>>> math.e
2.7182818284590451
>>>

My first exercise with the Hubble folks was to look at phi to
some 100 places and do a string match against a text file
with phi to some 100K places.

http://www.4dsolutions.net/presentations/holdenweb/decimaldemo.py
http://www.4dsolutions.net/presentations/holdenweb/PhiTo10Places.txt

I did something similar with a Ramanujan series converging to pi,
however I felt my coding style was too ugly.[4]

This is a kind of real world convergence investigation that
computational math might include (as an exercise in coding skills),
whereas in the calculator era we stayed happy with much larger
epsilons.

Kirby

[1] http://www.skylit.com/mathandpython.html

[2] http://en.wikipedia.org/wiki/American_McGee's_Alice
http://en.wikipedia.org/wiki/Uru:_Ages_Beyond_Myst

[3] http://mathforum.org/kb/message.jspa?messageID=7111960&tstart=0

[4] http://worldgame.blogspot.com/2008/02/reflective-fragment.html
(has a link back to this archive)
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Eclipse as Python3 IDE

2010-06-27 Thread kirby urner
Just wanted to share experiences using PyDev plugin within
Eclipse, with Python 3...

I've not been unable to get pickle to work properly, with the
error confirmed by others.

Sometimes (in at least one case) an error marker will
indicate a module name cannot be resolved, and yet it
imports and works anyway.

Getting proper syntax-coloring around triple-quotes seems
problematic, especially when the first line is empty e.g.

"""
comments go here
"""

However, I'm able to get the coloring situation to resolve
by moving text around later...

On the whole, Eclipse is pretty capable in supplying an
interactive shell, lots of different windows.  There's even a
terminal window option if you want to do ssh into a
server right from within Eclipse.

As the above difficulties get ironed out, I think Eclipse will
continue to serve as a development platform for Pythonistas.
It's not the only option, given Visual Studio, Wing IDE etc.,
but it's one of the better free ones (eMacs, vim -- these
do everything too, in the hands of experienced users,
Notepad not so much).

[ I remember how Jason Cunliffe used to post a lot about
Leo to this archive.  There's a school of thought that's more
into "literary programming" as I'd call it, where comments
might be relatively copious, with more hypertext relationships.
You get these fancy markups... ]

Some of you may be familiar with the O'Reilly School of
Technology (OST) and its use of Eclipse as a front end to
accredited courses in the many languages, databases
and so on.

Rather than use the free-standing Eclipse, which is an option,
you get a customized student version called Ellipse that
runs of their servers in a remote desktop session.

This seems a creative approach and gets a next generation
of developer prepared with one of the state of the art environments,
using some of the best industry standard tools (e.g. Python
and MySQL).

Kirby

PS:  in other news, I've continued to focus on the plight of the
lone FoxPro coder (which was me for many years, but not just
me) and possible migration paths for legacy applications.

FoxPro is a dialect of xBase nutured by Microsoft over the
decades.  It competes with their other products and too many
people use it for free (not the original business model, unlike
Java's) so the plan is to discontinue support for it by 2015
I think it is.

This decision is having lots of boat rocking-ripple effects,  It's
not automatic that the .NET platform is where to go next,
certainly not with VB necessarily.  New developers don't
want to waste time learning a proprietary dead language
that might be hard to come by down the road, so there's
increasing pressure to migrate those legacy FoxPro apps
that still do valuable work.

I haven't been tracking closely and don't know if MSFT is
taking IronPython that seriously, in terms of marketing and
outreach.

Server side apps still seem to be gaining over thick clients in
many institutional settings, but again, I'm not posing as
having a lot of overview here.  Gotta read all those IT mags
I guess, but who has the time?  Pointers to true story
use cases welcome.
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] posts to math forum mentioning Python

2010-06-16 Thread kirby urner
Sharing these links cuz they yak about MFTDA (textbook), oft
mentioned on edu-sig (still here Gary?):

http://mathforum.org/kb/message.jspa?messageID=7099591&tstart=0
http://mathforum.org/kb/message.jspa?messageID=7099594&tstart=0

This one (below) doesn't mention Python, but is the kind of
thing I've used Python to communicate about:

http://mathforum.org/kb/thread.jspa?threadID=2084375&tstart=0
(why I was asking about 3D/4D Logo, which I've been looking at)

E.g.
http://www.4dsolutions.net/ocn/pymath.html

(Fig 1 = Mite, compare w/ Fig 10 depiction in PDF by Senechal
http://tetrahedraverse.com/tverse/packings/temp2/tetraspace.pdf
)

Kirby Urner
4Dsolutions.net

--
"Computer science is the new mathematics."

-- Dr. Christos Papadimitriou

(thx to mp)
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Math + Python: reviewing some themes (long)

2010-06-14 Thread kirby urner
On Tue, Jan 26, 2010 at 2:53 AM, David MacQuigg 
wrote:
> kirby urner wrote:
>>
>> I've been hyping "digital mathematics" as a kind of niche marketing term,
>> as distinct from "discrete" but is this wise?   Per math-thinking-l
(another
>> list), I'd say I'm in the distinct minority in thinking "digital math" is
a
>> good term.  It's unexplored, not conservative, whereas discrete math is
>> already accepted and entrenched.

...

>
> I would call it "Computational Thinking".  There have been a series of
> articles on revising CS curricula in recent issues of Communications of
the
> ACM.  I recommend the articles by Chris Stephenson and Peter Denning
> (December 2009).
>

Thx for the pointer!

INTERNATIONALIZATION
===

Singapore Math, popular among home schoolers / scholars, has been explicitly
IT-friendly for a long time and I'm wondering if something more like MFTDA
will be issuing forth from that corner.  Wouldn't surprise me.

A Japanese equivalent might base itself around Ruby for coding but otherwise
seem somewhat similar.

Phillips Academy is a pace-setter, not unlike West Point, so I'm sure this
curriculum is getting eyeballed by education experts overseas (if they're
doing their jobs).

I've been sharing it around the Portland for sure, and we're quite the
cosmopolitan hub, news spreads...

I just think "digital math" (whatever we call it) is hovering in the global
Zeitgeist these days, MFTDA another harbinger, a positive sign on the
horizon.

Over on math-teach today, we're getting links like this one:

http://www.dougengelbart.org/home-page/welcome-to-the-bootstrap-alliance.html

It's not like Seymour Papert or Doug Engelbart wree born yesterday or
anything.  It's just that NCTM is finally taking more interest in Web 2.0
and such topics.

http://nctmconference.blogspot.com/2009/04/blogs-tweets-and-web-20.html

http://www.slideshare.net/mcleme4419/eclips-nctm-boston-secondary

etc.

>> 3.d OBJECTS FIRST?
>> 



>>  What examples do teachers wish to contribute?  What would be a good
>> introductory example of multiple inheritance I wonder?  I recall David
>> MacQuigg sharing some examples where __mro__ (method resolution order)
made
>> an appearance.
>
> MRO was an advanced topic in an advanced chapter on OOP, not anything I
> would include in an introductory course.  In fact, I wouldn't even make
OOP
> a special topic.  It's just the most natural way to solve a lot of
problems.

In my view, the promise of OO, starting with Smalltalk, was to mirror a way
we already think.

The word "object" does not belong to computer science originally, but to
ordinary language.

Dot notation is supposed to be expressive because we're *not* trying to
inculcate some inner circle knowledge of computer internals, memory
management, garbage collection.

We're just leveraging what's already a feature of ordinary thought patterns.

Lesson plan:

===

Student A comes to the front of the room, writes a few commands on the white
board she is willing to obey

>>> carla.walk(10)

>>> carla.say("Hello")

>>> carla.dance_move(1)

Student B holds a pointer, and in response to requests (raise hands,
polling), points to a requested action.  Student A carries out the requested
behavior.

Kids who've played Sims already know the drill.  We're talking about
puppets.  There's no computer anywhere in this picture, just dot notation
and a way of triggering behaviors.

Followup:

Get volunteers A, B, C in front of the room and have a wadded up piece of
paper as an argument.  Call that a "message object" and have commands for
passing it:

>>> carla.has_message
True

>>> carla.pass_message(jim)

>>> carla.has_message
False

>>> jim.has_message
True

etc.
===

BIOLOGY FIRST


>  Students should be *using* objects (lists, etc.) from day 1.  Then, if
> there is time later in the course, I would show how to *design* objects.
>  Even then, you really don't have to say much about inheritance,
> polymorphism, abstract classes, MRO, and all the stuff that professional
> programmers will get in later courses.
>

My preferred technique, described over the years as "cave painting" involves
putting something rather simple on the screen.  Walk through a Dog and
Monkey class, then show how you might move the digestive tract methods, eat
and poop (stomach a list) to the Mammal class and inherit.

This is just a language game and doesn't have to be that intimidating.
Biology is already cram packed with this inheritance metaphor, is where I'd
argue CS got it in the first place.

If the objective is to te

Re: [Edu-sig] news & views

2010-06-11 Thread kirby urner
Thank you Daniel, this makes my day.

Downloading now...

Kirby


On Fri, Jun 11, 2010 at 7:50 AM, Daniel Ajoy  wrote:
>> Date: Wed, 9 Jun 2010 23:56:58 -0700
>> From: kirby urner 
>>
>> Regarding Logo, there's an esoteric genre of Logo
>> where the turtle swims in a 3D tank, has roll,
>> pitch and yaw type parameters, more like a small
>> airplane.  I'm pretty sure we had open source free
>> versions.  Lemme go check:
>>
>> ... found some links.  Anyone recommend a
>> 3D Logo page?
>
>
> http://neoparaiso.com/logo/galeria-mswlogo.html
>
> FMSLogo is free and does have 3D, and not just wireframes but polygons, 
> lighting, perspective.
>
> https://sourceforge.net/projects/fmslogo/files/
>
>
> Daniel
>
>
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] news & views

2010-06-09 Thread kirby urner
Regarding Logo, there's an esoteric genre of Logo
where the turtle swims in a 3D tank, has roll,
pitch and yaw type parameters, more like a small
airplane.  I'm pretty sure we had open source free
versions.  Lemme go check:

... found some links.  Anyone recommend a
3D Logo page?

My approach was to write turtle like commands
that would parse into static instructions in ray
tracing language, so you didn't see any output
by the turtle in real time.  Very low budget (zero).
The L-systems paper I wrote captures some of
the flavor:

http://www.4dsolutions.net/ocn/lsystems.html
(lotsa broken links)
http://www.4dsolutions.net/ocn/numeracy3.html
(scroll down for fractal tree)

These days I'm interested in 3D/4D Logo because
of the Mite, Syte and Kite discussion.**  These are
space-filling shapes, with the Mite being a center-
piece of some of my Saturday Academy classes
in so-called Martian Math (wherein Python gets
used):

http://wikieducator.org/Martian_Math
http://www.flickr.com/photos/17157...@n00/sets/72157622961425831/

Also, I'm anchoring for Holden Web while Steve
sojourns at Pycon / Singapore, which is starting
today.

http://pycon.sit.rp.sg/

Holden Web is part of an OST group developing
curriculum for intermediate Python students
(beginner already on-line).  The interface is Ellipse,
a student version of Eclipse.  Steve is the
curriculum writer, packs a lot in.

Here's a screen shot from earlier today:

http://www.flickr.com/photos/17157...@n00/4686547486/sizes/l/in/photostream/

Python1 module comes with a 2.x version of
Python in a Nutshell (Martelli).  I need to go find
a 3.x version, suggest OST use that instead,
given course content.

This is state of the art, meaning Python 3.1, with
all the related challenges of finding drivers and
adapters.  I'm glad for that PEP moratorium, giving
library maintainers more of a chance to keep up.

On another front, I've been helping my friend in
Indonesia with his wxPython + Visual connection.
The wx GUI is to set parameters only, with
VPython hosting its own window (embedding
the latter in the former is a trick I've not seen
done yet -- they say use PyOpenGL).  Some
kind of physics problem (he's in a technical
college).

On yet another front (or more on the polyhedra
front), MIT's ConceptNet is ready for business with
Python bindings.  You'll find a huge database of
words associated with other words -- not the
same as a thesaurus, more like "free association"
semantic webs of olden days.  They kind of goof
on "tetrahedron" though, suggesting it's a polygon
and/or "sides" must all be the same (both
assertions false):

http://www.flickr.com/photos/17157...@n00/4680326861/in/photostream/
http://csc.media.mit.edu/docs/conceptnet/overview.html

Saw some action on Diversity, with mention of
edu-sig.  Maybe someone wants to report (some
overlap in foci & concerns).

Kirby

**  (explaining my cryptic nomenclature more):

Mite (minimum space-filler) = AAB (plane nets on-line)
http://www.flickr.com/photos/17157...@n00/4676742214/
http://www.rwgrayprojects.com/synergetics/s09/figs/f5400b.html

Sytes = Mite + Mite
http://www.flickr.com/photos/17157...@n00/4679491702/in/photostream/

Kites = Syte + Syte
http://www.flickr.com/photos/17157...@n00/4678858801/in/photostream/

OST = O'Reilly School of Technology
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Factory functions: synthesizing top-level names

2010-05-27 Thread kirby urner
On Thu, May 27, 2010 at 3:15 AM, Andre Roberge  wrote:
>
>
> On Thu, May 27, 2010 at 2:52 AM, kirby urner  wrote:
>>
>> >
>> > Much appreciated André!
>
> It was a fun challenge.
>  :-)
>>
>> >
>> > I think our solutions are similar:
>> >
>>
>> ... yours is better though, in that you don't make use of exec.
>>
>> My use of it was superfluous.
>>
>> Changing my solution, in light of yours:
>>
>> #===
>>
>> def makeroot(N):
>>   try:
>>       assert type(N)==type(1) and N>=0
>>   except:
>>       raise ValueError("0 <= N <= integer")
>>
>>   fname = "root" + str(N)
>>
>>   if N==0:
>>       globals()[fname] = lambda x: pow(x, 0)
>>   else:
>>       globals()[fname] = lambda x: pow(x, float(1)/N)
>>
>>
>> for i in range(11):
>>    makeroot(i)
>>
>> #===
>>
>
> Technically, your use of globals() instead of locals(), like I did, is
> better, in that it allows you to have it inside a function body, and still
> be available at the module level, as per your stated goal.
>
> However, I find the use of lambda to be too restrictive, in principle, as it
> obviously works only for expressions, and not complex functions.  If this
> example is to be used as a prototype to show students how to do this kind of
> name assignment, then the way I have done it with an inner named function
> (which I first learned about *years* ago, from a post from you on edu-sig!
> I believe it was
> http://mail.python.org/pipermail/edu-sig/2005-March/004590.html) is a better
> way to go.
>
>>
>> Kirby
>

Yes sir, I agree.  The Python lambda is weak (on purpose) in not providing
for full scale anonymous functions.  Binding to the function object returned
by an inner function def is a more liberal strategy, allows for more
complexity.

This thread will document these suggestions and nuances.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Factory functions: synthesizing top-level names

2010-05-26 Thread kirby urner
>
> Much appreciated André!
>
> I think our solutions are similar:
>

... yours is better though, in that you don't make use of exec.

My use of it was superfluous.

Changing my solution, in light of yours:

#===

def makeroot(N):
   try:
   assert type(N)==type(1) and N>=0
   except:
   raise ValueError("0 <= N <= integer")

   fname = "root" + str(N)

   if N==0:
   globals()[fname] = lambda x: pow(x, 0)
   else:
   globals()[fname] = lambda x: pow(x, float(1)/N)


for i in range(11):
makeroot(i)

#===

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Factory functions: synthesizing top-level names

2010-05-26 Thread kirby urner
On Wed, May 26, 2010 at 7:21 PM, Andre Roberge  wrote:

>
> Ok, here's my solution:
>
 def make_root(i):
> ...    def _root(x):
> ... return pow(x, 1.0/i)
> ...    return _root
> ...
 for i in range(1, 11):
> ... locals()['root' + str(i)] = make_root(i)
> ...
 root2(4)
> 2.0
 root4(64)
> 2.8284271247461903
 root6(64)
> 2.0
>
> Cheers,
> André
>

Much appreciated André!

I think our solutions are similar:

"""
http://mail.python.org/pipermail/edu-sig/2010-May/009998.html
http://mail.python.org/pipermail/edu-sig/2010-May/00.html
"""

def makeroot(N):
try:
assert type(N)==type(1) and N>=0
except:
raise ValueError("0 <= N <= integer")

fname = "root" + str(N)

if N==0:
fdef = "globals()['%s'] = lambda x: pow(x, 0)" % fname
else:
fdef = "globals()['%s'] = lambda x: pow(x, float(1)/%s)" % (fname,N)

exec(fdef)

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Factory functions: synthesizing top-level names

2010-05-26 Thread kirby urner
> By what magic might we turn a string object into
> a top-level name:  that is the question this lesson
> addresses.

I do have an answer in the queue, my proposed solution.

However I'd be happy to see others toss in some ideas,
just to test whether my lesson plan is clear enough to
get across what the challenge is.

Maybe not.

On another front, I'm wanting to tell the story of free
and open source software to a next generation of teen,
and wondered if FOSS veterans here would have any
feedback regarding the following thumbnail:



GNU = GNU is not Unix and was the original inspiration for the
free software movement, centered on what become known as
the GNU Public License (GPL).

The GPL was a way for copyright holders to insist that their hard
work not be used only selfishly by others, that the fruits of their
labors achieve maximum positive benefit for omni-humanity, to
put a Global U spin on it.

Once the GPL was out there getting the work done (e.g. Linux),
a safe-enough ecosystem was developed for a bevy of alternative
licensing schemes, some of which allow shops to take something
inhouse, transform it, and release it under a more restrictive
license agreement, if they release it at all.

[ Python could be an example of this, in that developers of the
IronPython codebase have been enabled to start with CPython,
the original version, with the resulting codebase being free and
open source under a different set of rules from the GPL or even
from whatever the original Python was using.  Actually, the story
is more complicated than that, in that Jim H. first worked on the
Java implementation before moving to C# in an attempt to prove
the CLR (common language runtime) engine was unsuitable for
dynamic languages.  He came to the conclusion that the CLR
engine could work, hence the IronPython project. ]



The original context is some Google group (a new one).  The
relevant thread is accessible from this blog post FYI:

http://mybizmo.blogspot.com/2010/05/math-reform.html

Where it says:
Rhombic Triacontahedra etc. (Synergetics list) -- Urner

(I'm still adding to this list of May 2010 math reform writings).

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Factory functions: synthesizing top-level names

2010-05-26 Thread kirby urner
Creating Top-Level names root0, root1, root2... rootN

Setting the stage:

We've come across an ethnicity, in our voyages
of the starship whatever, that doesn't share our
fascination with squares and cubes.  For example,
when multiplying n * n, it never occurred to them
to picture n * n squares in a checkerboard pattern.
Rather, they have a more Chinese Checkers bias
towards triangles and hexagons, and their picture
of n * n is an equilateral triangle subdivided into
n ** 2 similar sub-triangles.

Likewise, their picture of n * n * n, or n**3 is a
tetrahedron, though here the subdividing process
results in a matrix known to Earthlings ("terra-ists")
as the FCC and/or CCP and/or... whatever Earthling
terminology.

The Challenge:

The anthropologist-astronauts we've left behind
to work and study with these people (to be
collected on a next pass a year from now, unless
they plan on staying longer), are using Python, and
find that saying 'sqrt' just gets in the way (keeps
them habituated to patterns of thought they're trying
to snap out of).

What they'd like to do is this:  for 2nd, 3rd, 4th,
5th etc. root of a number, have the functions
root2, root3, root4... up to root10 routinely available,
perhaps in a module called roots or radicals.

>>> import radicals as r
>>> r.root3 ( 2.0 / 3.0 )
0.8735804647362989

So how might we generate root0... root10 in a
factory function, such that these function names
become top level within their generating and/or
defining module?

True, we could individually define these functions
per the example below, but what is a clever way
of generating rootN in principle, such as root2012,
taking 2012 as an argument.

Hints:

For root2, you might take an obvious shortcut:

from math import sqrt as root2

For root3, consider the following:

def root3 (x):  return pow( x, 1.0/3.0 )

In general:

def rootN (x):  return pow( x, 1.0/N)

Rationale for this exercise:

Students often want a way to factory-produce
new names at the top level, from within a contained
scope (such as from within a function).

These top level names may be of data, functions or
whatever arbitrary objects.  The production process
often involves synthesizing new names on the fly,
as strings.  Strings are "right side" objects, usually
assigned names, but not themselves names of
anything.

By what magic might we turn a string object into
a top-level name:  that is the question this lesson
addresses.
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Calling functions...

2010-05-16 Thread kirby urner
Hey Kirby!!  This is the best explanation I've seen of Python's argument
passing subtleties.  If you don't mind I would like to post it on our
PyKata website in a section "Tips from the Masters", with you as author,
of course.  We could also put a link to a page on your website, if you
prefer.

-- Dave

Would be great on PyKata!

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Calling functions...

2010-05-15 Thread kirby urner
Something I maybe hadn't been clear on
before cramming for a workshop:

Even functions with purely positional
parameters may be passed a dict, in
which case the positional parameters
will be treated like named ones, i.e.
the dict will map to them.

I'll use the new formating protocol:

>>> from __future__ import print_function

>>> def f(a, b, c):
print("a={0}, b={1}, c={2}".format(a,b,c))


>>> f(1,2,3)
a=1, b=2, c=3

Here's what I'm illustrating:

>>> thedict = dict(c=5,a=10,b='cat')

>>> f(**thedict)
a=10, b=cat, c=5

Now what if we try to sneak in an argument
that doesn't map:

>>> thedict = dict(c=5,a=10,b='cat', d='dog')
>>> f(**thedict)

Traceback (most recent call last):
  File "", line 1, in 
f(**thedict)
TypeError: f() got an unexpected keyword argument 'd'

The d is caught, an exception is raised.

So here we might add the all purpose "pooper scooper"
(yeah, scatological -- sometimes effective pedagogy):

>>> def f(a, b, c, **kwargs):
print("a={0}, b={1}, c={2}".format(a,b,c))

The d now gets through, though nothing echoes:

>>> f(**thedict)
a=10, b=cat, c=5

Lets make sure we see what's in "overflow":

>>> def f(a, b, c, **kwargs):
print("a={0}, b={1}, c={2}".format(a,b,c))
print(kwargs)


>>> f(**thedict)
a=10, b=cat, c=5
{'d': 'dog'}

Is an all purpose pooper scooper allowed to have
defaults?  No, default arguments are what turn
parameters into named parameters.  *args and
**kwargs (often so named by convention) are
not named parameters so much as "collectors"
of "overflow" arguments (made-up terminology).

>>> def f(a, b, c, d='dog', *e):
print("a={0}, b={1}, c={2} d={3} e={4}".format(a,b,c,d,e))


>>> f(**thedict)
a=10, b=cat, c=5 d=dog e=()
>>>

Speaking of made-up terminology, when I pass
**thedict as an argument, I tend to think of the
** as "explode".

If you don't double-star it, it goes through as just
the one argument and an exception gets raised:

>>> f(thedict)

Traceback (most recent call last):
  File "", line 1, in 
f(thedict)
TypeError: f() takes at least 3 arguments (1 given)

The same "explode" operator works for tuples in
that it "unpacks" the one argument into len(tuple)
arguments.  The typical use is to make (x,y,z)-tuples
map to some function that expects x, y and z as
separate arguments.

The error messages remind us when we fail to
"explode" one argument into many:

>>> def f(x, y, z):
return x**2 + y**2 + z**2

>>> f(1,2,3)
14
>>> coords = (1,2,3)
>>> f(coords)

Traceback (most recent call last):
  File "", line 1, in 
f(coords)
TypeError: f() takes exactly 3 arguments (1 given)
>>> f(*coords)
14
>>> f(dict(y=2,x=1,z=3))

Traceback (most recent call last):
  File "", line 1, in 
f(dict(y=2,x=1,z=3))
TypeError: f() takes exactly 3 arguments (1 given)
>>> f(**dict(y=2,x=1,z=3))
14

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] The perfect IT environment in a school

2010-05-08 Thread kirby urner
On Fri, Apr 30, 2010 at 12:19 AM, Jan Ulrich Hasecke
 wrote:
> Hi,
>
> since three years I am guiding a Python voluntary workgroup in a school
> and we are suffering from a badly organized IT environment (a rigidly
> restricted Windows setting).
>
> Most of all we miss a decent VCS as Mercurial or Bazaar. In the official
> IT classes they never used a VCS so it was never installed.
>
> While thinking about this I discovered that some other things are
> missing. For eg. we cannot install a web framework due to the strange
> restrictions. They do not have Zotero installed. For students the
> FF-plugin Zotero would be a great tool to make bibliographies.
>
> Does anyone yet compiled a list of things which may not be missing in a
> perfect IT environment in a school? Perhaps I can lobby some teachers to
> improve their environment.
>
> juh
>

Some thoughts:

A perfectly designed IT environment for a school is not modeled
on the commercial private company with a closed shop IT
department responsive to users in the rest of the company.

Rather, given the school is supposed to be teaching IT skills,
the students and faculty together co-manage and plan the school's
IT functions.

There is no sense of us-and-them, although some students
and faculty choose to become more deeply involved than
others, given temperament and predilections.

Perhaps one gets assistance from consultants or district geeks,
volunteers in the private sector, but faculty and students are
still responsible for their own school's internal network at the
end of the day.

There is no separate IT department per se, only a set of positions
that people rotate through, sysop A for awhile, sysop B for another
spell, and so forth, with responsibilities partially overlapping.

Classroom content includes explaining and training for these jobs.

At the hardware level, a decision is whether to have standalone
workstations with local hard drives, perhaps sharing a server,
or dumb terminals, with servers doing a lot of the processing. **

At Free Geek, we would convert some of the former into the
latter species by removing hard drives and installing booting
ethernet cards that would take one directly to the LAN.
Everything was server-based.

In some ways, I think that's a better model for a school, as
local drives tend to over-specialize the workstation in
question.  Best if you get access to all your files and projects
no matter which terminal you choose, be that in your dorm
(presuming dorms) or the library (presuming libraries).

Of course it's not either/or.  Students and faculty may have
personal laptops or netbooks, with the school providing only
terminals, but with USB ports.  Laptops may have VPN
access to server-based personal accounts via wifi or
ethernet.

Letting faculty and students govern the shared infrastructure
does not mean falling away from best practices necessarily,
though the standards should be different where academia is
concerned, as here a premium is placed on openness in the
liberal arts tradition (presuming a school of that character,
not saying all of them are).

Students experience a lot of freedom to download and install,
to experiment with new material.  The shared operating
system needs to be tight enough to permit local
experimentation, without endangering or corrupting the
work in neighboring accounts.

That's what the great multi-user operating systems of this
world are designed to provide:  relatively well insulated
processes and channels, that allow individual users ways
to mount devices, manage a branching file system, with
user-controllable sharing with peers and limited powers
to wreak havoc.

The corporate IT curricula are training sysops to lock
everything down pretty tightly in hopes of frustrating any
cyber attacks.  A problem with this approach is one
starts to treat every employee as a potential threat and
IT becomes both adversarial and prosecutorial regarding
company infrastructure.

In an academic setting, this fortress mentality puts a
damper on scholarship more generally, resulting in a
dumbed down internal culture -- a vicious circle that
may lead to a school's suffering some loss of reputation.

The ideal liberal arts academy or think tank is transparent
enough to not care about proprietary scholarship leaking
out, as the whole point of research is to share it with the
public.

Of course that's a completely idealized view, whereas
in truth many secrets are jealously protected within
academia, where people have the same human impulse
to sometimes keep stuff under wraps.

A 4-way collaboration between local faculty, students,
alumni, and a cloud computing platform, customized
specifically for a given school, is a likely long term
pattern.  Students don't necessarily want to drop
their accounts just because they graduate from the
school.  Alumni include faculty as well.

If the school provides public-facing web pages for
students, faculty and alums, then we're looking at
a pretty serious IT operation.  Findi

Re: [Edu-sig] programming skills and IQ tests..

2010-05-05 Thread kirby urner
On Wed, May 5, 2010 at 2:08 PM, Jurgis Pralgauskis
 wrote:
> Hello,
>
> I think one of best ways to teach programming is with examples (of
> course with a bit of theory explanation).
> I'd like to test my students' general ability to undersnand examples.
> Because I am confused, is it my fault or their laziness, or sth else,
> that some of them (nearly 30%) understnand nearly nothig what they were 
> taught.
>

Reconcile yourself to a bell curve response (including to IQ tests)
and don't berate students in the lower 30%, as you yourself are
in the lower 30% on other axes of measure (so many types of IQ).
We all fall short, in one dimension or another.  Python and/or whatever
is not for everyone, CP4E notwithstanding.  The goal is to provide
ample opportunity, not insist that everyone "get it" (whatever that
means).  There's a difference between being friendly and insisting
on being a friend.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] scientific computing in Python

2010-04-29 Thread kirby urner
My daughter got a hand-me-down GeForce GS8400 from a friend
at school.  That's like a $45 video card, yet is presumably advanced
enough to support Cuda, and therefore PyCuda.  What's that?
http://documen.tician.de/pycuda/

We keep getting back to numpy arrays as a basis for computer
graphics.  Linear algebra with numpy.matrix looks like a good
way to go in a digital math class.

>From Cut-the-Knot, this 9x9 invertible matrix:

>>> import numpy as np

A result of cutting and pasting:

>>> m = """1 1 1 1 1 0 1 0 0
 0 1 0 1 0 1 1 0 1
 1 1 1 0 1 1 1 0 1
 0 1 1 1 0 0 0 1 1
 0 1 0 1 1 1 0 1 0
 1 1 0 0 0 1 1 1 0
 1 0 0 1 1 0 1 1 1
 1 0 1 1 0 1 0 1 0
 0 0 1 0 1 1 1 1 1""".split()

Convert to integers:

>>> mat = np.matrix(np.array([int(x) for x in m]).reshape(9,9))
>>> mat
matrix([[1, 1, 1, 1, 1, 0, 1, 0, 0],
[0, 1, 0, 1, 0, 1, 1, 0, 1],
[1, 1, 1, 0, 1, 1, 1, 0, 1],
[0, 1, 1, 1, 0, 0, 0, 1, 1],
[0, 1, 0, 1, 1, 1, 0, 1, 0],
[1, 1, 0, 0, 0, 1, 1, 1, 0],
[1, 0, 0, 1, 1, 0, 1, 1, 1],
[1, 0, 1, 1, 0, 1, 0, 1, 0],
[0, 0, 1, 0, 1, 1, 1, 1, 1]])

Getting the inverse is now as simple as:

>>> print np.round(mat.I, 2)  # that's mat.I with I for Inverse

[[-0.17 -0.23  0.48 -0.07 -0.12  0.11  0.32  0.27 -0.51]
 [ 0.07 -0.07  0.2   0.33  0.2   0.27 -0.2  -0.33 -0.27]
 [ 0.32 -0.12 -0.04  0.2  -0.24 -0.12 -0.36  0.2   0.32]
 [ 0.23  0.37 -0.32 -0.07  0.08 -0.29  0.12  0.27 -0.11]
 [ 0.08 -0.28  0.24 -0.2   0.44 -0.28  0.16 -0.2   0.08]
 [-0.27  0.27  0.2  -0.33  0.2  -0.07 -0.2   0.33  0.07]
 [ 0.48  0.32 -0.56 -0.2  -0.36  0.32 -0.04 -0.2   0.48]
 [-0.11 -0.29 -0.32  0.27  0.08  0.37  0.12 -0.07  0.23]
 [-0.51  0.11  0.48  0.27 -0.12 -0.23  0.32 -0.07 -0.17]]

http://www.cut-the-knot.org/explain_game.shtml

Connecting the dots twixt Pycuda and numpy:
http://documen.tician.de/pycuda/array.html#pycuda.gpuarray.GPUArray

Perry Greenfield has had much to do with getting Python
going at the Space Telescope Science Institute (STScI).
We invited him to give a lightning talk during my class,
but he was stuck in Amsterdam owing to the volcanic
ash problem in Iceland.

http://www.scipy.org/wikis/topical_software/Tutorial

http://stsdas.stsci.edu/perry/pydatatut.pdf
(144 pages by Perry Greenfield and Robert Jedrzejewski
-- about analyzing astronomical imagery in Python with
numpy, pyfits, numdisplay etc.).

Numpy has a lot in common with IDL, an inhouse analysis
language for many on the Hubble project.  In sharing
research data with the wider public however, it's easier if the
files might be worked on by free and open source software.
IDL ain't cheap.

http://www.cfa.harvard.edu/~jbattat/computer/python/science/idl-numpy.html

Speaking of Cuda (used to code for the GPU vs. the CPU), there's
a PyopenCL as well, also by Andreas Klöckner.

http://developer.amd.com/GPU/ATISTREAMSDK/pages/TutorialOpenCL.aspx

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] blogged mention of Ed Cherlin, MFTDA

2010-04-28 Thread kirby urner
Hey Ed, your name goes by in my (eclectic, all over the map) blog post
of today, thought I'd give you a heads up.

http://worldgame.blogspot.com/2010/04/wheeling-dealing.html

I know my suggestion to Mike D that he get involved in compiling APL
for the XO didn't go anywhere (yet) -- that seemed a tad esoteric even
for him.  Either way, I consider you kindred spirits.

Also, I do these photo-collages or tableaus as I sometimes call 'em.

In yesterday's, I included Math for the Digital Age in tandem with A
Love of Discovery, a work in the contructivist tradition.

http://mybizmo.blogspot.com/2010/04/first-person-physics.html **

I learned from my meeting with Bob that VPython is now being
maintained from North Carolina State (not Carnegie Mellon).

http://www.ncsu.edu/PER/

Kirby


**
For more information (mentions meeting with Dr. Bob Fuller):

"""
Dr. Fuller is a student of Dr. Robert Karplus when it comes
educational theory and techniques. A Love of Discovery sits in my
living room on the "time capsule" (semi-cylindrical shelves) between a
book by Linus Pauling and Wolfram's thick tome.
"""

http://worldgame.blogspot.com/2010/04/back-in-97214.html
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] teaching Python

2010-04-23 Thread kirby urner
On Fri, Apr 23, 2010 at 3:24 PM, Mark Engelberg
 wrote:
> On Fri, Apr 23, 2010 at 11:46 AM, Bill Punch  wrote:
>> To round out the
>> top three, which are the ones that get even my best students, look at the
>> below:
>>
>> myVar = 27
>>
>> def myFun ():
>>     print myVar
>>     myVar += 1
>>     return myVar
>>
>> print myFun
>>
>> What happens when you run this?
>>
>
> To fully appreciate Bill's example, I think it's worth pointing out
> that this version would behave exactly as expected:
>
> myVar = 27
>
> def myFun ():
>    print myVar
> #    myVar += 1
>    return myVar
>
> print myFun()
>

Also, for contrast:

myVar = [27]

def myFun ():
print myVar
myVar[0]+=1
return myVar

>>> myFun()
[27]
[28]

The above works because the we're not referencing an unbound local,
are instead mutating a global.  No need to declare myVar global as there
could be no other legal meaning.  Functions look outside the local
scope for bindings.

def myFun ():
print myVar
myVar = 1
return myVar

The above crashes because the print references an unbound local.
It's a local because of the local binding (don't call it "rebinding")  --
can't be the same as the global in that case, so no sense asking
to print it before it has a
value.

def myFun ():
global myVar
print myVar
myVar = 1
return myVar

>>> myFun()
[32]
1

>>> myVar
1

The above works because the print statement accesses the global.
Said global is then rebound.  Of course the return is not required
for the change to occur at the global level.

def myFun ():
myVar = 1
print myVar
return myVar

No problem local myVar is already bound when print is encountered.
The global myVar is unchanged.

myVar = [27]
[27]

def myFun ():
print myVar
myVar = []
return myVar

The above crashes.  It's the binding of myVar to some object other than
what the global myVar already references that makes it a local to this
function's scope, not the fact that it's bound to a mutable.  Can't print a
local before the binding occurs.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] teaching Python

2010-04-23 Thread kirby urner
I had the good fortune to lead a three day
immersive training in Python for scientist
technicians working with astronomical data
from Hubble.

The focus was basic, core Python, although
the workaday environment is intensively
NumPy and Pyfits related (also matplotlib).

Students found this behavior somewhat
confusing.

>>> def f(arg, y=[]):
y.append(arg)
return y

>>> r = f(10)
>>> r
[10]
>>> r = f(11)
>>> r
[10, 11]
>>> r.append(100)
>>> f(12)
[10, 11, 100, 12]
>>>

Here's one of the explanations for this behavior:

http://mail.python.org/pipermail/python-list/2007-March/1116072.html

In the above example, y is bound to a mutable object
at the time the function def is evaluated, not at runtime
each time the function is called.  Once this object
starts filling with data, it doesn't go out of scope but
persists between function calls -- even though "y" is not
in the globals namespace (it "lives" in the function).

It gets worse:

>>> f(11,[])
[11]
>>> f(12,[])
[12]
>>> f(13)
[10, 11, 100, 12, 13]
>>> f(14)
[10, 11, 100, 12, 13, 14]

One would think the empty list passed in as y would
"override" and/or "reinitialize" y to the empty list.
Instead, the passed in argument is bound to y at
runtime, then goes out of scope.  Meanwhile, the
object assigned to y at the time of evaluation is
still there in the background, ready for duty if no
2nd argument is passed.

>>> r = f(12, [])
>>> r
[12]
>>> r = f(r)
>>> r
[10, 11, 100, 12, 13, 14, [12]]

A metaphor I use is the "guard at the castle gate".

At the time of evaluation (when the module is compiled
and the function is defined -- whether or not it gets
called), objects get stored in a closet at the gate
entrance, and those parameters assigned to defaults
will always get those same objects out of the
closet, dust them off, and use them whenever
nothing gets passed for the parameter to "run with"
at the time the function is called.

If nothing is handed over at "call time" then use
whatever you've got in the closet, is the rule.

If the default object is mutable and nothing is passed
in, then the guard at the gate (the parameter in
question) is bound to the "closet object" and does
whatever work with that object, returning it to the
closet when done.

There's no re-evaluation or re-initialization of the
default object at the time the function is called so
if it's mutable and stuff got added or changed, then
it returns to the closet in its changed form.  It
does not "revert" to some evaluation-time value.

>>> del r
>>> def f(arg, y=[]):
global r
y.append(arg)
r = y
return y

>>> r

Traceback (most recent call last):
  File "", line 1, in 
r
NameError: name 'r' is not defined
>>> r = f(10)
>>> r
[10]
>>> r = f(11)
>>> r
[10, 11]
>>> r = []
>>> r = f(11)
>>> r
[10, 11, 11]

In the above case, r has been made a global variable
inside the function.  Assigning r to the empty list
above merely rebinds it externally however, does
not affect y's default object in the closet.  When
the function is run with no argument for y, r is
rebound within the function to our growing default
list object.

>>> f(9)
[10, 11, 11, 9]
>>> r
[10, 11, 11, 9]
>>> f(12)
[10, 11, 11, 9, 12]
>>> r
[10, 11, 11, 9, 12]
>>> r = []
>>> f(12)
[10, 11, 11, 9, 12, 12]

Again, it does no good to set r to the empty list
with the expectation of reaching the y default in
the castle closet.  r is simply being rebound and
is on the receiving end for y, which, in getting
no arguments, simply reverts to using the growing
list.

At the end of the function call, however, r is bound
to the same object as y (because of r = y, with
r declared global), so we do have an opportunity
to affect the y default object...

>>> r[0]=999
>>> r
[999, 11, 11, 9, 12, 12]
>>> f(12)
[999, 11, 11, 9, 12, 12, 12]

Ta dah!

>>> r.pop(0)
999
>>> r.pop(0)
11
>>> r.pop(0)
11
>>> r.pop(0)
9
>>> r.pop(0)
12
>>> r.pop(0)
12
>>> r.pop(0)
12

The closet object has now had its members popped.  We're
back to an empty list to start with, thanks to runtime
operations:

>>> f(9)
[9]
>>> f(9)
[9, 9]

So what's a quick way to empty a list without rebinding, i.e.
we don't want to pop everything or remove one by one.  Nor
do we want to end up with a bunch of None objects.

Here's our global r:

>>> r
[9, 9]

Check it out with a new global:  we're able to delete slices:

>>> test
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> del test[0]
>>> test
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> del test[1:5]
>>> test
[1, 6, 7, 8, 9]

... so that must mean we're able to delete all members of a
list, without rebinding to a new list object:

>>> del test[:]
>>> test
[]

Experimenting with our function some more:

>>> f(11)
[9, 9, 11]
>>> f(12)
[9, 9, 11, 12]
>>> f(13)
[9, 9, 11, 12, 13]

So this is r before:

>>> r
[9, 9, 11, 12, 13]

And this is r after:

>>> del r[:]
>>> r
[]

... meaning the y's default object in the
castle gate closet has likewise been emptied
out, given r is bound to it.

>>> f(13)
[13]
>>> f(13)
[13, 13]

... l

[Edu-sig] modules "versus" programs

2010-04-19 Thread kirby urner
I'm sensing some confusion and/or a mish-mash of ideas around
the idea of a Python script, module, library, program.  In Python,
these somewhat amount to the same thing in that to load a module
is to run a script (even if it doesn't "do" anything).  However, when
people go to write a program, they're often not thinking how the
very same module might also serve in a library capacity.

Is this because of inherited thinking?  In the good old days, a
library was like (is like) a .dll or .so, i.e. a dynamic link library
or shared object.  Programs would do function calls to these
these libraries, which would not be designed to work as
"standalone" programs.  This is how our operating systems
work, commercial code of all kinds.  We do our work atop
mountains of "dependencies" hence "dll hell" and the need
for package managers like Synaptic.

What people discover about Python is the power of the interactive
shell, not just for doodling but for getting some serious work done.
They discover it's possible to import utilities, 3rd party code, and
work with it directly.  There's less of a need to i/o to disk or pipe
stuff from one utility to the next when you're in shell mode, as
here you have your persistent data objects as a part of your
session.

Those of us coming from APL and LOGO are more used to the
idea of a "session", where you interact with the interpreter while
building up a rich environment of session materials.  Smalltalk
also has this idea of a persistent image.  When you come back
to the session, it's more like restoring from hibernation.

A Python module may also be simply for data storage.  If you've
gone to all the trouble to parse in some file, turning all the strings
into numbers, and put those numbers into Python lists, other
data structures, then why go back to that same file to start with?
Take your native Python data and store that as a module, maybe
thousands of lines long.  You could also serialize it as a pickle,
but maybe keeping it human readable is what's important.

Python data structures are at least as readable as XML a lot
of the time.  We should have more .py files that are actually just
data files.  But then they could have a thin layer of functions
and objects that make manipulation of that data easier.

import cities

might give you all cities in the world with a population > x,
complete with lat/long, populations, other data.  Sure, one
could store all this in a database.  But it's not either/or.
Import the entire CIA World Fact Book as a Python module
why not, with each nation state an object already pre-loaded.
http://www.servinghistory.com/topics/The_CIA_World_Factbook
I point to this data source as it's public domain, so no worries
about converting to Python.

Say I have a million lines of data in a .py module, and I import
it, that builds a .pyc right?  I'm not necessarily sucking that
whole data structure into memory.  The dictionary
data structure should be able to handle it.  I could have
12 million social security numbers keying to names and
addresses, import that as a module, and not suddenly have
all that in memory correct?  Then I could retrieve records
by key just like from a database (indeed, a hash table is
a kind of database).  I guess I'd need it in memory when
I started searching it, but given how much memory computers
have these days, that wouldn't necessarily be a problem.

This is getting back to the "rich data structures" idea.

Maybe we should do baseball modules.  Seems like one
of the main features of baseball is massive amounts of
data and statistics.  What would that look like in Python?
How about teams and players as objects, so you could
import a team object and go team.players() to get back
a list of player objects.  Each one of those would have
season stats etc...

I'm writing this without myself being any kind of huge
baseball fan, just know some who are who might enjoy
programming and computers a lot more if we'd only pump
out more modules full of real data they really care about.

Apropos:
http://mail.python.org/pipermail/python-list/2006-July/1031208.html

Static data that doesn't need updating a lot might be easiest.
I was recently suggesting the Periodic Table would make a
good module.  Constellations and their contained stars, some
info about each star...  of course such modules would take
work.  I'm thinking governments are especially positioned to
serve the schools by this means.  Moving to Python in
technology and humanities subjects (not mutually exclusive)
would mean using modules such as these to better communicate
with a learning, studious public.  Our new kind of math course
would have an easier time getting off the ground if such
resources were to become more available IMO.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] calculus and not-calculus using Python

2010-04-19 Thread kirby urner
I've mostly been writing about a new kind of math class at the high school
level that distinguishes itself from the precalculus - calculus track.

This has partly to do with politics, as I think it's easier to develop something
new and set that alongside already existing options (traditional courses)
than it is to introduce reforms in already "programmed" offerings.

However, Python has some capabilities when it comes to calculus, in
scipy and Sage for example.  Plus it's of course easy to take anything
one might do with a calculator in support of learning calculus concepts,
and do that same thing in Python instead.

This was somewhat my approach in writings I did on the catenary some
years ago (the catenary is a curve similar to a parabola but different).

http://www.4dsolutions.net/ocn/catenary.html

At this point though, it's maybe a moot point whether we try to embrace
more calculus with Python or not.  The premise was doing something
more exciting with technology than scientific calculators, introducing
a real programming language, and yet having this considered a math
class as much as a computer class.  This was against the backdrop
of the "math pipeline" being broken according to many criteria, i.e.
in need of some upgrades.

Some progress has been made in small niches, but in many respects
the current mood is to freeze features i.e. the response to rapid
change is to codify and pickle that which once was.

So I'm back to thinking only brand new courses will have a chance.
They have to be seen as new, and the expectation must be that
new material will be covered.  Perhaps for this reason I find myself
venturing into Wolfram territory as he's always talking about his
"new kind of science".  Those little cellular automata studies are
actually pretty easy to implement in Python (we've done it here
on edu-sig, with John Zelle's graphics.py, PIL and native Tkinter).

http://www.4dsolutions.net/presentations/holdenweb/mini_nks.py

I'm going to say more about these calculus exercises at some
point, not sure how soon.  This relates to the thread about
generating tables.

That was pretty fruitful thread, glad so many jumped in.  We need
to see that in some ways having computers put out to text files
is a way to get back to the good old days,  when we could explore
reams of data.

What's better nowadays is we don't really need all that paper (lets
not waste it).  We have hard drives and LCDs instead.

Kirby



PS:  found this old exhange with Matthias of DrScheme fame.  He just
got some prestigious award, per an announcement on math-thinking-l.

=

from scipy.integrate import quad, dblquad, Inf
from numpy import arange
from math import exp, log, pi, sin, cos

def test0():
"""
Integration example
http://www.scipy.org/doc/api_docs/SciPy.integrate.quadpack.html
"""
def thefunc(x):
return cos(x)

for a in arange(0, 2*pi, 0.1):
output = quad(thefunc, 0, a)[0]
fmtstring = "Integral of cos(x) from 1 to {0} = {1}:  sin({0}) = {2}"
print fmtstring.format(a, output, sin(a))


def test1():
"""
Integration example
http://www.scipy.org/doc/api_docs/SciPy.integrate.quadpack.html
"""
def thefunc(x):
return 1./x

for a in range(1,21,2):
output = quad(thefunc, 1, a)[0]
fmtstring = "Integral of 1/x from 1 to {0} = {1}:  ln({0}) = {2}"
print fmtstring.format(a, output, log(a))

def test2():
"""
Double integration example
http://www.scipy.org/doc/api_docs/SciPy.integrate.quadpack.html
"""
def I(n):
return dblquad(lambda t, x: exp(-x*t)/t**n,
   0, Inf,
   lambda x: 1, lambda x: Inf)

print I(4)
print I(3)
print I(2)


def test3():
"""
Double integration example
same as above but without using lambda
http://www.scipy.org/doc/api_docs/SciPy.integrate.quadpack.html
"""

def mkfunc(n):
def thefunc(t, x):
return exp(-x*t)/t**n
return thefunc

def xfrom(x):
return 1

def xto(x):
return Inf

def I(n):
thefunc = mkfunc(n)
return dblquad(thefunc, 0, Inf, xfrom, xto)

print I(4)
print I(3)
print I(2)

def doall():
test0()
#test1()
#test2()
#test3()

if __name__ == '__main__':
doall()
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] for another lesson plan needing code

2010-04-17 Thread kirby urner
"""
Menu Fun
by K. Urner

Oregon Curriculum Network:  DM Track

Building up a small vocabulary of test
modules will help you experiment with
design patterns and syntax.  You may
wish to repurpose the code to be about
something other then menu fun.  Maybe
save a snapshot with a different name.
Fork off in a new direction.

Possible grade level: DM(0)
Suggested activities:
* add the ability to create and retire trains
* have a menu that dynamically lists trains
* keep track of trains by number or name
* after choosing a train, then prompt with status menu
* add the option to pickle or otherwise store a train
for future retreival.

Exercises the following:
string.Template, getattr, hasattr, setattr

Illustrates:
putting functions in a list and treating them as
callables.
"""

from string import Template  # to be more interesting

"""
this Train class might be instantiated multiple times.
However in the code below, only a single instance is
created when the mainloop is launched.
"""

class Train( object ):
"""
Only the one global train object in this module.
Behaves likes C struct.  No methods, just state.
"""
pass

"""
these functions check and/or change the status of
the train, including whether it has a 'moving'
attribute, added programmatically
"""

def start_train(thetrain):
if hasattr( thetrain, 'moving' ):
if thetrain.moving == True:
print "The train is already moving."
return
thetrain.moving = True
print "The train has started."

def stop_train(thetrain):
if hasattr( thetrain, 'moving' ):
if thetrain.moving == False:
print "The train has already stopped."
else:
thetrain.moving = False
print "The train has stopped."
else:
print "The train has never moved."

def add_car(thetrain):
if getattr(thetrain, 'moving', False):
print "Train moving, cannot add car."
else:
# Remains of an old error, left in for didactic purposes
# print "DEBUG: ", getattr(thetrain, 'cars', 0) + 1
# thetrain.cars = setattr(thetrain, 'cars', getattr(thetrain,
'cars', 0) + 1)
setattr(thetrain, 'cars', getattr(thetrain, 'cars', 0) + 1)
print "%s has %s cars" % (thetrain.name, thetrain.cars)

def remove_car(thetrain):
if getattr(thetrain, 'moving', False):
print "Train moving, cannot remove car."
else:
setattr(thetrain, 'cars', getattr(thetrain, 'cars', 1) - 1)
if thetrain.cars <= 0:
thetrain.cars = 0
print "%s has no cars" % thetrain.name
else:
print "%s has %s cars" % (thetrain.name, thetrain.cars)

def end(thetrain):
if hasattr(thetrain, 'moving'):
print "The train is %s." % (
['not moving','moving'][int(thetrain.moving)],)
else:
print 'The train never moved.'
print "Logging out."

mainmenu = Template("""
$name
===
1 - start train
2 - stop train
3 - add car
4 - remove car
0 - quit
""")

def menu_loop():
"""
the only train is created here and persists only
so long as the loop keeps looping.  Consider adding
menu options to store and retreive the train's state
"""
otrain = Train()  # a train is born!
otrain.name = "L&O Express"

things_to_do = [start_train, stop_train, add_car, remove_car] #
global functions

while True:
print mainmenu.substitute({'name':otrain.name})
menusel = raw_input("Choice?: ")


if menusel in ['1','2','3','4']:
sel = things_to_do[int(menusel) - 1]
sel(otrain)
elif menusel == '0':
break
else:
print 'Choose 1,2 or 0'
print "Quitting"
end(otrain)
# otrain goes out of scope here

if __name__ == '__main__':
menu_loop()
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] intro to regular expressions

2010-04-15 Thread kirby urner
Here's a module people could easily expand upon, staying with
Jabberwocky as the target text.

I'm by no means a master of the regexp.  For example, I wanted to pick
out all sentences with
Jabberwock including those beginning and ending with quote marks (if
present), i.e. keeping
the quotes in the match.  My current attempt loses the quote marks,
keeping the enclosed
sentence.

One could imagine 20-30 more regexps, if not hundreds, populating this
file.  The doctest
version could display expected output (except it gets kinda verbose
(appended) -- maybe
selected examples only...).

Kirby

===

"""
Playing with regular expressions...
GPL 2010 4D Solutions

This small suite of tests could easily be
augmented with more elaborate ones, or
simply variations on the theme.  Consider
this a workbench for test out your regexps.
"""

import re

poem = """
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.

"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!"

He took his vorpal sword in hand:
Long time the manxome foe he sought-
So rested he by the Tumtum tree,
And stood awhile in thought.

And as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!

One, two! One, two! and through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.

"And hast thou slain the Jabberwock?
Come to my arms, my beamish boy!
O frabjous day! Callooh! Callay!"
He chortled in his joy.

'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.
"""

def show_all(title, regexp, match_list):
print "%s\n%s" % (title, len(title) * "=")
print "regexp: %s\n" % regexp
if match_list:
for list_item in match_list:
print list_item,'\n'
else:
print "No Matches"
print "\n\n"

def test0():
"""
Show the line of text in which Jabberwock appears,
with ^ matching after \n, not just at the start
of the string (the purpose of the MULTILINE flag).
Given the word Jabberwock is not in the first line,
there is no match without MULTILINE
"""
regexp = r"^.*Jabberwock.*$"
p = re.compile(regexp, re.MULTILINE)
m = p.findall(poem)
show_all("Lines with Jabberwock", regexp, m)

def test1():
"""
Sentences in which Jabberwok appears, starting
with a capital letter and ending with punctuation.
The non-greedy .*? matches across \n because of
DOTALL.  After the first capitalized word, the
matcher goes through any character that's not
a terminating punctuation mark, through the
string Jabberwock, and on to the terminus.
"""
regexp = r'[A-Z]\w+\b[^.!?"]+Jabberwock.*?[?!.]'
# how to include outside quotes if present?
p = re.compile(regexp, re.MULTILINE | re.DOTALL)
m = p.findall(poem)
show_all("Sentences with Jabberwock", regexp, m)

def test2():
"""
Find all strings enclosed in quotes (") that also
and with an exclamation point.  The *? makes *
behave in a "non-greedy" manner, so the first
satisfying pattern is considered a match.
"""
regexp = r'".*?!"'
p = re.compile(regexp, re.MULTILINE | re.DOTALL)
m = p.findall(poem)
show_all("Exclamations", regexp, m)

def test3():
"""
Here we're looking for words starting with capital
letters, then we're grabbing up to 3 characters on
either side, including newlines if need be. The DOTALL
is what picks up newlines.
"""
regexp = r'.{0,3}[A-Z]\w+\b.{0,3}'
p = re.compile(regexp, re.MULTILINE | re.DOTALL)
m = p.findall(poem)
show_all("Capitals", regexp, m)

def test4():
"""
Here we're looking for words starting with capital
letters, then we're grabbing up to 3 characters on
either side, including newlines if need be. The DOTALL
is what picks up newlines.
"""
regexp = r'.{0,3}[A-Z]\w+\b.{0,3}'
p = re.compile(regexp, re.MULTILINE | re.DOTALL)
m = p.findall(poem)
show_all("Capitals", regexp, m)

def alltests():
test0()
test1()
test2()
test3()

if __name__ == "__main__":
alltests()

===

Lines with Jabberwock
=
regexp: ^.*Jabberwock.*$

"Beware the Jabberwock, my son!

The Jabberwock, with eyes of flame,

"And hast thou slain the Jabberwock?




Sentences with Jabberwock
=
regexp: [A-Z]\w+\b[^.!?"]+Jabberwock.*?[?!.]

Beware the Jabberwock, my son!

And as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!

And hast thou slain the Jabberwock?




Exclamations

regexp: ".*?!"

"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware t

Re: [Edu-sig] How do virtual 3D Second Life classrooms compare to WebEx for distance learning?

2010-04-15 Thread kirby urner
Before 2nd Life there was Active Worlds, including some set aside for
education.  Friends and I built a virtual world and held conferences
there.  Bonnie de Varco built a virtual high school.  We sent in our
avatars at appointed times, looked around and talked.

You'll find a screen shot here, plus links that still work, even after a
decade:

http://www.4dsolutions.net/ocn/lsystems.html  (no avatars
shown -- a point of view shot, facing north.

Bonnie and I overlapped when she was chief archivist for the
Buckminster Fuller Institute.  A lot of our content was related to
polyhedra, which made a virtual world in some ways ideal, as
we could move amidst the very subject matter we were yakking
about.  Gerald de Jong was developing his Elastic Interval
Geometry and we'd meet about that as well (meeting in
person was more satisfying though -- for all its bells and
whistles, 2nd Life etc. are no more than a multi-user doll
houses).

Having attended a Howard Rheingold lecture recently (he's
made studying Cyberia (i.e. 2nd world i.e. cyberspace) a
lifetime focus, starting with The Well) I am sensitive to the
fact that many people just stumble around in Second Life
and find it far from intuitive.

I think one needs to provide a strong use case up front, to
recruit willing participants.

My example, of wanting to make Polyhedra a focus, or L-systems,
or other art, and of wanting to pioneer the shared doll house
experience with a virtual worlds anthropologist (Bonnie), might
serve as a basis for future meetups along these lines.

Kirby

Citations / annotations:
http://members.cruzio.com/~devarco/portfolio.htm (mentions Virtual High School)
http://mybizmo.blogspot.com/2010/04/smart-mobs.html  (see 3rd from
last paragraph)

On Wed, Apr 14, 2010 at 9:58 PM,   wrote:
> I don't know if this educational topic is allowed on this but here goes...
>
> I do online math classes with video conferencing and a shared whiteboard.
>
> I'm trying to find out if doing virtual classes in Second Life with avatars
> offers any benefits.  I've read up on this topic and the reports vary.
>
> Anyone have any experience going to a "class" in Second Life?
>
> cs
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Why Python?

2010-04-15 Thread kirby urner
<< snip >>

Ed Cherlin wrote:

> I propose to teach children the basics of the essential features used
> in all of the major languages, in primary school. My short list of
> really major concepts includes
>
> arithmetic (prefix in LISP, postfix in FORTH, infix everywhere else)
> variable names are pronouns
> namespaces
> Boolean algebra
> sets
> permutations, sorting, and searching
> combinatorics
> lists of lists (LISP, SCHEME)
> arrays (APL)
> forests (arrays of trees, J)
> OOP (Smalltalk, Python)
> minimal syntaxes with neither parentheses nor precedence
> parse trees
> first-class functions
> functional programming
> number base/polynomial equivalence
> data/program equivalence
> database
> topological (dependence) sorting for spreadsheets
>

I'd be interested in an adaptation of this curriculum for teens
to adults.

Or maybe we'd use the elementary comix or cartoons or
whatever you're using, in addition to the various languages.
Adults learn a lot from kid-oriented materials (Sesame
Street for example -- teaches a lot about how to make
cool YouTubes, lightning talks).

I'm looking to advance adult / child understanding and
appreciation for polyhedra as well, a traditional Renaissance
focus.  The five Platonics and their duals (the five Platonics)
plus dual-combos (combining duals to get new polys):
that's a theme for anime in bars as well as schools.

http://coffeeshopsnet.blogspot.com/2010/04/smart-bar-lcds.html

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Why Python?

2010-04-14 Thread kirby urner
On Wed, Apr 14, 2010 at 12:06 PM, Bill Punch  wrote:

<< snip >>

> - open source and language changes. I'm a big fan of open source, but it is
> often a two edged sword. When Python started, it generated such enthusiasm
> and resulted in so many packages, which was wonderful. Then, the language
> guys came along and broke Python for the 3.x series, making a "better"
> language. Well, that's nice and all, but the difference between writing a
> package the first time and fixing a package for a bunch of language changes
> is pretty big. Lots of open source folks are happy to do work for cudos and
> praise (the first time) but no one wants to do the nasty work of a language
> upgrade. Who knows how long till numpy gets upgraded to 3.x, and it must
> happen for many other packages, and so on and so forth. Open source is a
> great starter but it has its troubles w.r.t long term maintenance and
> changes. Till then, we are stuck with 2.x if we want to work with all those
> nice packages. Worse, people developing for 3.x may not wait and write their
> own numpy (or whatever package), causing a package break. Now there are two,
> with two groups and all the hassle that goes with it. Forking is another
> feature of open source (look at all the linux distros).
>

"Why Python sucks" with a focus on this or that feature, is a somewhat
well-established genre at Pycons and such, a type of lightning talk in
many cases.

Good to welcome dissenting and dissatisfied voices.  Any one of us
may need to vent some pet peeves in that way.**

Strong proponents of Python, such as yourself, need to be clear you
are not blind to her limitations.

Sometimes when a shortcoming is described, a fix is proposed
(as a PEP) but that's not a requirement, nor even indicated in some
cases.

In the case of list comprehensions, that syntax seems pretty
entrenched.  Set and dictionary comprehensions have followed.

Regarding the leap from 2.x to 3.x in particular, I don't think
having Python be open source is to blame.  Guido himself had
some backward incompatibilities he wanted to introduce.  Not
every language designer gets such an opportunity and it's not
an easy jump to make (lots of thought has gone into it).

Had it not been for Guido's leadership and active desire to get
on with some of these changes, the momentum / inertia of the
larger open source community might have prevented 3.x from ever
becoming a reality.  From my tone, you may guess I'm feeling up
beat about 3.x and its future.  True enough.

I also think the acceptance of this PEP to freeze the core
language for awhile, to give more 3rd party package maintainers
some breathing room, is a good move by Guido, Brett Cannon et al.

http://mail.python.org/pipermail/python-ideas/2009-October/006305.html

Kirby

> I'll cut it there. Languages are tools. If you were a carpenter, you might
> learn how to use a hammer first but then move on to other tools as your
> problems change. You cannot solve all your problems with a hammer, which is
> why other tools exist. Same with languages. Each has their advantages, their
> flaws. Python is a great way to start, but don't think it is the only way to
> go.
>
>       >>>bill<<<
>
>
>

** For me, it's a lack of language bindings to applications we still don't
have yet, simulations and so forth (some of which I've described
elsewhere) -- and not enough Rich Data Structures in native Python,
these latter to with content outside of computer science.

Just today I was in this meeting talking about how I'd like to simply
download a source .py file and go:

>>> import elements
>>> atom = elements.Carbon(neutrons=8)
>>> atom.protons
6
>>> atom.radioactive
True

Another module would have a data structure such as:  every
nation-state as of year X (a context) with a link to every nation-state
with a shared border (a graph or polyhedral structure).  These are
just examples.  I go back in this archive with this theme, have
provided some data of my own:

http://markmail.org/search/?q=edu-sig+stillaguamish

etc.

This isn't a beef with the language so much as with surrounding eco-
system.
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Those polyhedra again (ch.py)

2010-04-14 Thread kirby urner
On Wed, Apr 14, 2010 at 4:58 PM, kirby urner  wrote:
> """
> This version adds an instance variable self.keep
> that propagates though the scaling method to
> the next of kin.  For example:
>

"propagates through"... phraseology maybe not that clear.

The "keep" word is like from "castle keep", with a polyhedron
being like a special box for a keepsake.  The scaling method
instantiates a new object of type M with volume and edges
re-scaled according to the argument.  I don't bother with surface
area.  The name 'keep' is pointing back to the same object at
the origin of this chain of progeny.

I find this an interesting study in Python's naming conventions,
-- plus the polyhedra are designed to be instructive...

Interactive session with remarks...

Instantiate an object with keep bound to a
dictionary object

>>> rh = ch.R_Dodeca(keep={'mites':48})

double the size through two "generations" of
subsequent object:

>>> rh1 = rh * 2
>>> rh2 = rh1 * 2
>>> rh2.volume
384

Note that rh2.keep still points to the same
object as the original rh.keep does.

>>> rh2.keep
{'mites': 48}

adding a new (key,value) pair to rh.keep does
not rebind it to a new object -- rh.keep still shares
the same referent as rh2.keep

>>> rh.keep['a']=96
>>> rh2.keep
{'a': 96, 'mites': 48}

Here, in rebinding rh.keep to an immutable string, we
no longer name the same object as rh1.keep or rh2.keep
rh.keep is not a "class variable".

>>> rh.keep = 'new value'
>>> rh2.keep
{'a': 96, 'mites': 48}

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Those polyhedra again (ch.py)

2010-04-14 Thread kirby urner
"""
This version adds an instance variable self.keep
that propagates though the scaling method to
the next of kin.  For example:

>>> import ch
>>> c = ch.Cube()
>>> c.volume
3
>>> c.keep
[]
>>> bigc = c * 2
>>> bigc.volume
24
>>> c.keep.append("gem")
>>> c.keep
['gem']
>>> bigc.keep
['gem']
>>>


"""

from math import sqrt as radical

phi = (1 + radical(5))/2

class Poly( object):

def __init__(self,  edge = 1, edge_name = "edge",
 volume = 1, greekname = "Tetrahedron",
 platonic = True, dual = "Tetrahedron", keep=[]):
self.edge = edge
self.edge_name = edge_name
self.volume = volume
self.greekname = greekname
self.platonic = platonic
self.dual = dual
self.keep = keep

def scale(self, scalefactor):
edge = self.edge * scalefactor  # edge unbound to self
volume = self.volume * pow(scalefactor, 3)  # likewise volume
# print("DEBUG:  a star is born: a new %s" % self.__class__.__name__)
return self.__class__(*(edge, self.edge_name, volume, self.greekname,
  self.platonic, self.dual, self.keep))

__mul__ = __rmul__ = scale # e.g. tetra = tetra * 3

def __repr__(self):
return "Polyhedron of type %s (vol: %s)" % (self.greekname, self.volume)

class Tetra( Poly ):
pass

class Cube( Poly ):
def __init__(self, edge = 1, edge_name = "any face diagonal",
 volume = 3, greekname = "Cube",
 platonic=True, dual="Octahedron", keep=[]):
super(Cube, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual, keep))

class Octa( Poly ):
def __init__(self, edge = 1, edge_name = "any edge",
 volume = 4, greekname = "Octahedron",
 platonic=True, dual="Cube", keep=[]):
super(Octa, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual, keep))

class R_Dodeca( Poly ):
def __init__(self, edge = 1, edge_name = "any long face diagonal",
 volume = 6, greekname = "Rhombic Dodecahedron",
 platonic=False, dual="Cuboctahedron",keep=[]):
super(R_Dodeca, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual, keep))

class R_Triac( Poly ):
def __init__(self, edge = radical(2)/2, edge_name = "any long face
diagonal",
 volume = 7.5, greekname = "Rhombic Triacontahedron",
 platonic=False, dual="Icosidodecahedron", keep=[]):
super(R_Triac, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual, keep))

class Icosa ( Poly ):
def __init__(self, edge = 1.0, edge_name = "any edge",
 volume = 5 * phi**2 * radical(2), greekname = "Icosahedron",
 platonic=True, dual="Pentagonal Dodecahedron", keep=[]):
super(Icosa, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual, keep))

class P_Dodeca ( Poly ):
def __init__(self, edge = 1/phi, edge_name = "any edge",
 volume = (phi**2 + 1) * 3 * radical(2), greekname =
"Pentagonal Dodecahedron",
 platonic=True, dual="Icosahedron", keep=[]):
super(P_Dodeca, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class Cubocta ( Poly ):
def __init__(self, edge = 1, edge_name = "any edge",
 volume = 20, greekname = "Cuboctahedron",
 platonic=False, dual = "Rhombic Dodecahedron", keep=[]):
super(Cubocta, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

def test1():
c = Cube()
print "First shape: %s" % c
print "Dual: %s  Platonic: %s" % (c.dual, c.platonic)

d = P_Dodeca()
print "Second shape: %s" % d
print "Dual: %s  Platonic: %s" % (d.dual, d.platonic)

def test2():
print "\n\nVolumes Table\n="
for shape in (Tetra(), Cube(), Octa(), R_Triac()*pow(2./3,1./3),
  R_Dodeca(), R_Triac(), P_Dodeca(), Icosa(), Cubocta()):
poly = "{0} ({1} = {2:.4g})".format(shape.greekname,
shape.edge_name, shape.edge)
print "{0:<60}{1:>8.4g}".format(poly, shape.volume)

def test3():
print "\n\nDuals Table\n=="
for shape in (Tetra(), Cube(), Octa(), R_Dodeca(), R_Triac(),
P_Dodeca(), Icosa(), Cubocta()):
print "{0:<30}{1}".format(shape.greekname+"
*"[int(shape.platonic)], shape.dual)
print "\n * = Platonic"

if __name__ == "__main__":

# test1()
test2()
test3()
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] an OO example (another zoo.py)

2010-04-14 Thread kirby urner
"""
playing with polymorphism
by Kirby Urner
Portland, Oregon
April, 2010
"""

import re
from random import choice

class Animal(object):

def __init__(self, name):
self.name = name
self.stomach = []

def eat(self, food):
self.stomach.append(food)

def poop(self):
if len(self.stomach) > 0:
return self.stomach.pop(0) # queue

def noise(self, howmany):
pass

def __repr__(self):
return "A %s named %s in location %s" %
(self.__class__.__name__, self.name, id(self))

class Mammal(Animal):

def __init__(self, name):
self.blood = "warm"
super(Mammal, self).__init__(name)

class Reptile(Animal):

def __init__(self, name):
self.blood = "ambient"
super(Reptile, self).__init__(name)

class Monkey(Mammal):

def noise(self, howmuch):
noises= ["Hoot","Screech","Jabber"]
return "! ".join([choice(noises) for i in range(howmuch)])+"! "

class Dog(Mammal):

def noise(self, numbarks):
return numbarks * "Woof! "

class Snake(Reptile):

def noise(self, howmany):
return "Hi.. " * howmany

def test1():
animal1 = Dog("Spot")
animal2 = Monkey("Red Devil")
animal3 = Snake("Barry")
print animal1, "goes: \n", animal1.noise(3)
print animal2, "goes: \n", animal2.noise(4)
print animal2, "goes: \n", animal2.noise(1)
print animal1, "blood ", animal1.blood
print animal2, "blood ", animal2.blood
print animal3, "blood ", animal3.blood

if __name__== "__main__":
test1()
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Why Python?

2010-04-13 Thread kirby urner
On Tue, Apr 13, 2010 at 11:02 AM,   wrote:
> On Tue, Apr 13, 2010 at 10:30:49AM -0700, David MacQuigg wrote:
>> Good observation.  I wasn't thinking of parallel computing at all.  I
>> can see a need for something very different in this realm.  I'll stick
>> with my original bet, however, if we limit our consideration to
>> "mainstream" languages.  I will bet that languages like Fortress,
>> designed to deal with concurrency, will be used only by specialists, and
>> that the majority just needing to process payroll records or program a
>> website, will stick with whatever evolves from Python.
>
> I agree.  When speed isn't important, there is no reason to welcome the added
> complexity of concurrent programming.
>

Lets not exaggerate the current standing of Python within industry.

The technicons in places like Indonesia still mostly don't teach it,
pretty new in the Philippines etc..

Singapore / Pycon may turn some heads, but a lot of production work is
done in other languages besides Python, such as Java, VB, Perl and so
forth, and this is as it should be.  Mathematica is one of the most
prevalent languages and I don't see Python eclipsing it (or vice
versa).

J has its niche in the financial sector they tell me, an arena in
which Python has only just emerged as a contender thanks to its now
sporting a decimal type written by Facundo Batista and implemented by
Facundo Batista, Eric Price, Raymond Hettinger, Aahz, and Tim Peters.

All I'm saying is that Python is not now and never has been the King
of Languages, nor is it my impression that it's bucking for that role
(it's not my impression that geekdom even has such a job opening).

Python "plays well with others" which means it expects to have others
to play with, many others, including concurrently.

New languages are and will be coming down the pipe, like Go most
recently (a candidate implementation language?) and Python's
capabilities will change depending on what it's written in.

PyPy allows what by today's standards could be considered freakish
behaviors, more normal to those frequenting exotic circles -- like
Cirque du Soleil (currently with tents here in Portland).  Fresh ideas
for language features will likely keep coming from that test bed.

>> That's not to say the 1% is unimportant.  Here we will find brilliant
>> programmers working on sophisticated techniques to break large problems
>> into pieces that can be executed concurrently by hundreds of processors.
>> Each problem is very different, and we may find programs for circuit
>> simulation using very different techniques than programs for weather
>> prediction.  These programs will be run in an environment controlled by
>> Python.  The circuit designer or atmospheric scientist will not be
>> concerned about the details of concurrency, as long as the result is fast
>> and accurate.
>

There's a school of thought out there that says operating systems are
supposed to handle concurrency pretty well.  Some designs boot
multiple Pythons as multiple processes and let the OS take care of
concurrency issues.  Why reinvent the wheel and rely on internal
threading?  Instead of multiple threads within Python, make each
Python its own thread.

These concurrently running Pythons are then trained to communicate in
a loosely coupled fashion by reading and writing to centralized SQL
tables, which double as audit trails.

If a process dies, there might need to kill a process (zombie snake
problem), and maybe the controlling process (like air traffic control)
launches a new one -- depends on many factors.

I'm thinking of a buzzbot I know about, by Portland Energy Strategies
(Patrick Barton et al).  I've posted about it before over recent
months.

Also, think about Twisted, the basis for vast multi-user games.

You might think Python couldn't hold its own in such a server
intensive interactive environment, but here the approach is to take
maximum advantage of asynchronous architecture.

That being said, I'm not suggesting only Python is ever used.  The
whole idea of a "glue language" is you have other things to glue.

I don't think Python's global interpreter lock is always the big
bugaboo some people consider it to be.  Concurrency has many meanings,
and is an issue computer science has been tackling regardless of the
number of chips.  What's true about Python is it's designed to shield
programmers from wanting or needing to know much about machine
architecture.

You have sockets, ports, tcp/ip, various pickling and packaging
protocols (like json), but you're not thinking in terms of chips or
individual registers on those chips.

Does this mean I think Python has a realistic chance of completely
replacing Erlang as a cell phone language?  No.  Why would anyone
wanna replace Erlang?  They should be teaching that at New Mexico
Tech, no?

Promela anyone?
http://en.wikipedia.org/wiki/Promela

> Interesting observation.  Python would still be useful in a world with
> concurrent tools as a glue language at wo

Re: [Edu-sig] Radical Math: debugging help?

2010-04-12 Thread kirby urner
On Mon, Apr 12, 2010 at 9:16 PM, kirby urner  wrote:

<< snip >>

OK, a couple replies to this one:

> (a) I found the bug:  I'd neglected to subclass 'object' as my root object,
> so was not getting new-style classes, just classic classes -- we still
> have that distinction in 2.6.

I was also mistakenly passing 'self' as a first parameter to
super(Type, self).__init__.

> (b) I made numerous enhancements for this new improved deluxe
> edition, appended herewith:
>

Here's the output you get if you run it as is, except the alignment
here is messed up (not a fixed width font for me here):


Volumes Table
=
Tetrahedron (edge = 1)                                             1
Cube (any face diagonal = 1)                                       3
Octahedron (any edge = 1)                                          4
Rhombic Triacontahedron (any long face diagonal = 0.6177)          5
Rhombic Dodecahedron (any long face diagonal = 1)                  6
Rhombic Triacontahedron (any long face diagonal = 0.7071)        7.5
Pentagonal Dodecahedron (any edge = 0.618)                     15.35
Icosahedron (any edge = 1)                                     18.51
Cuboctahedron (any edge = 1)                                      20


Duals Table
==
Tetrahedron*                  Tetrahedron
Cube*                         Octahedron
Octahedron*                   Cube
Rhombic Dodecahedron          Cuboctahedron
Rhombic Triacontahedron       Icosidodecahedron
Pentagonal Dodecahedron*      Icosahedron
Icosahedron*                  Pentagonal Dodecahedron
Cuboctahedron                 Rhombic Dodecahedron

* = Platonic


>    def scale(self, scalefactor):
>        edge = self.edge * scalefactor  # edge unbound to self
>        volume = self.volume * pow(scalefactor, 3)  # likewise volume
>        # print("DEBUG:  a star is born: a new %s" % self.__class__.__name__)
>        return self.__class__(edge = edge, edge_name = self.edge_name,
>                              volume = volume, greekname = self.greekname)

Found a bug already:  the scale method had yet to pass on its full complement
of parameters when giving birth to a scaled version of itself.  Here's what
I changed it to:

def scale(self, scalefactor):
edge = self.edge * scalefactor  # edge unbound to self
volume = self.volume * pow(scalefactor, 3)  # likewise volume
# print("DEBUG:  a star is born: a new %s" % self.__class__.__name__)
return self.__class__(*(edge, self.edge_name, volume, self.greekname,
  self.platonic, self.dual))


Testing (old code):

>>> t = Tetra()
>>> t.dual
'Tetrahedron'
>>> t.volume
1
>>> newt = t.volume * 3
>>> newt.dual

Traceback (most recent call last):
  File "", line 1, in 
newt.dual
AttributeError: 'int' object has no attribute 'dual'
>>> newt.platonic

Traceback (most recent call last):
  File "", line 1, in 
newt.platonic
AttributeError: 'int' object has no attribute 'platonic'


Testing (new code):

>>> reload(ch)

>>> t = Tetra()
>>> t = 3 * t
>>> t.volume
27
>>> t.dual
'Tetrahedron'
>>> t.platonic
True
>>> c = Cube()
>>> c = c * 3
>>> c.volume
81
>>> c.platonic
True
>>> d = ch.R_Dodeca()
>>> d.platonic
False
>>> e = d * 5
>>> e.volume
750
>>> e.platonic
False
>>> e.dual
'Cuboctahedron'
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Radical Math: debugging help?

2010-04-12 Thread kirby urner
On Sat, Apr 10, 2010 at 4:41 PM, kirby urner  wrote:
> Below is current source for ch.py, a module for exploring volume
> relationships starting with a "ground state" (a default) known as the
> concentric hierarchy of polyhedra.

OK, a couple replies to this one:

(a) I found the bug:  I'd neglected to subclass 'object' as my root object,
so was not getting new-style classes, just classic classes -- we still
have that distinction in 2.6.

(b) I made numerous enhancements for this new improved deluxe
edition, appended herewith:

"""
Radical Math, Portland, Oregon (April, 2010)

A reading and Python module (GPL, 4Dsolutions.net)
"""

from math import sqrt as radical

phi = (1 + radical(5))/2

class Poly( object):

def __init__(self,  edge = 1, edge_name = "edge",
 volume = 1, greekname = "Tetrahedron",
 platonic = True, dual = "Tetrahedron"):
self.edge = edge
self.edge_name = edge_name
self.volume = volume
self.greekname = greekname
self.platonic = platonic
self.dual = dual

def scale(self, scalefactor):
edge = self.edge * scalefactor  # edge unbound to self
volume = self.volume * pow(scalefactor, 3)  # likewise volume
# print("DEBUG:  a star is born: a new %s" % self.__class__.__name__)
return self.__class__(edge = edge, edge_name = self.edge_name,
  volume = volume, greekname = self.greekname)

__mul__ = __rmul__ = scale # e.g. tetra = tetra * 3

def __repr__(self):
return "Polyhedron of type %s (vol: %s)" % (self.greekname, self.volume)

class Tetra( Poly ):
pass

class Cube( Poly ):
def __init__(self, edge = 1, edge_name = "any face diagonal",
 volume = 3, greekname = "Cube",
 platonic=True, dual="Octahedron"):
super(Cube, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class Octa( Poly ):
def __init__(self, edge = 1, edge_name = "any edge",
 volume = 4, greekname = "Octahedron",
 platonic=True, dual="Cube"):
super(Octa, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class R_Dodeca( Poly ):
def __init__(self, edge = 1, edge_name = "any long face diagonal",
 volume = 6, greekname = "Rhombic Dodecahedron",
 platonic=False, dual="Cuboctahedron"):
super(R_Dodeca, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class R_Triac( Poly ):
def __init__(self, edge = radical(2)/2, edge_name = "any long face
diagonal",
 volume = 7.5, greekname = "Rhombic Triacontahedron",
 platonic=False, dual="Icosidodecahedron"):
super(R_Triac, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class Icosa ( Poly ):
def __init__(self, edge = 1.0, edge_name = "any edge",
 volume = 5 * phi**2 * radical(2), greekname = "Icosahedron",
 platonic=True, dual="Pentagonal Dodecahedron"):
super(Icosa, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class P_Dodeca ( Poly ):
def __init__(self, edge = 1/phi, edge_name = "any edge",
 volume = (phi**2 + 1) * 3 * radical(2), greekname =
"Pentagonal Dodecahedron",
 platonic=True, dual="Icosahedron"):
super(P_Dodeca, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

class Cubocta ( Poly ):
def __init__(self, edge = 1, edge_name = "any edge",
 volume = 20, greekname = "Cuboctahedron",
 platonic=False, dual = "Rhombic Dodecahedron"):
super(Cubocta, self).__init__(*(edge, edge_name, volume,
greekname, platonic, dual))

def test1():
c = Cube()
print "First shape: %s" % c
print "Dual: %s  Platonic: %s" % (c.dual, c.platonic)

d = P_Dodeca()
print "Second shape: %s" % d
print "Dual: %s  Platonic: %s" % (d.dual, d.platonic)

def test2():
print "\n\nVolumes Table\n="
for shape in (Tetra(), Cube(), Octa(), R_Triac()*pow(2./3,1./3),
  R_Dodeca(), R_Triac(), P_Dodeca(), Icosa(), Cubocta()):
poly = "{0} ({1} = {2:.4g})".format(shape.greekname,
shape.edge_name, shape.edge)
print "{0:<60}{1:>8.4g}".format(poly, shape.volume)

def test3():
print "\n\nDuals Table\n=="
for shape in (Tetra(), Cube(), Octa(), R_Dodeca(), R_Triac(),
P_Dodeca(), Icosa(), Cubocta()):
print "{0:<30}{1}".format(shape.greekname

Re: [Edu-sig] Why Python?

2010-04-12 Thread kirby urner
On Mon, Apr 12, 2010 at 12:36 AM, kirby urner  wrote:

<< SNIP >>

> How about scholarships for veterans to enter nursing, other medical
> professions?
>
> The health professions are ravenous for computing and data
> services.
>
> My daughter is the Portland district champion debater at 15,
> having started her high school's team in the first place.  I worry
> though:  why waste her talents at some backward academy
> that doesn't even teach about tetrahedral mensuration?  How
> many dead mineshaft canaries does it take I wonder?
>
> Maybe by the time she graduates we'll have some respectable
> colleges out there.
>

Of course the above won't make a whole lot of sense if you're
just tuning in, as what means "tetrahedral mensuration" and
why should any respectable college -- such as Earlham in
Indiana (the topic of a cell phone conversation from the Pauling
House this morning) -- include that on a syllabus?

The following three posts may provide some elucidation, plus
they are using Python (the 1st shows execution, the 2nd
shows source code) and so are especially apropos on edu-sig:

http://groups.yahoo.com/group/synergeo/message/58259
http://groups.yahoo.com/group/synergeo/message/58260
http://groups.yahoo.com/group/synergeo/message/58262

Basically I'm using the Decimal type to give the flavor of
some extended precision "arithmetic" regarding some basic
polyhedral relationships.

As some of you know, our subculture (ethnicity) has a
unit volume tetrahedron, per this TV segment outline
(more storyboarding for CSN):

http://coffeeshopsnet.blogspot.com/2010/04/smart-bar-lcds.html

Also here:
http://groups.google.com/group/mathfuture/browse_thread/thread/4aa4b568e87ba90b?hl=en

A problem with the Synergeo archive, however, is it doesn't
support significant whitespace, whereas this Mailman archive
does, making it much better for sharing actual source code.

Therefore I am taking the liberty of reposting that here:

#=

import decimal
from decimal import Decimal
import re

print """
I will now give you the radius of a rhombic
triacontahedron of volume five, computing in tetra-
volumes.

"""

myothercontext = decimal.Context(prec=100, rounding=decimal.ROUND_HALF_DOWN)
decimal.setcontext(myothercontext)

print decimal.getcontext()


# long limo vip numbers
one = Decimal('1.')
two = Decimal('2.')
three = 
Decimal('3.')
five = Decimal('5.')

print "Five: %s" % five
radical2 = two.sqrt()
radical3 = three.sqrt()
radical5 = five.sqrt()

print "2nd root of 2: %s" % radical2

phi = (one + radical5) / two
print "Phi: %s" % phi

scalefactor = (two/three) ** (one/three)

print "Shrink by: %s" % scalefactor
print "Radius: %s" % ((phi / radical2) * scalefactor, )

"""
phi to a 100K places
(potentially, check this resource:
http://goldennumber.net/PhiTo10Places.txt )
"""

phi_million = 
"1.618033988749894848204586834365638117720309179805762862135448..."
 # add more digits for a match

strphi = str(phi)
results = re.match(strphi, phi_million)
if results:
print "Successful match for phi value: %s" % (results.span(), ) #
((  ),) returns tuple as single %s
else:
print "No match with phi_million"

#=

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Why Python?

2010-04-12 Thread kirby urner
On Sun, Apr 11, 2010 at 7:51 PM, Edward Cherlin  wrote:
> On Sun, Apr 11, 2010 at 21:03, Andrew Harrington  wrote:
>> Well put David.
>>
>> My choices are always about me and a particular situation.  I would not
>> teach J to beginners
>
> I would use the +-*% (+-×÷) subset of J in first grade for arithmetic,
> alongside Turtle Art (with stack tiles), and  Etoys, including
> Scratch. By third grade, we could introduce programming in J/APL,
> Logo/LISP, FORTH, Python, and Smalltalk. At some point, we could show
> how each represents the same internal parse tree in quite different
> textual forms. What the LISPers call "syntactic sugar". This is a
> fundamental Computer Science concept.
>

I'd like to see a school form around your druthers, with ways to
facilitate turnover, so those most advantaged by this approach
would have some chance to (a) discover this for themselves
and (b) keep a slot in an initially rare environment.

One would hope we might learn enough from your approach to
transfer some of what's working to other sites.

Your school of thought would spread in proportion to its achieving
results, but without this stultifying demand that everything be proven
risk-free before any pilots get started (as if the status quo were
a result of such iron-clad assurances).

A vicious circle:  don't try anything until you can prove it's not in
error.  This results in paralysis, in nothing being tried.  Nothing
ventured, nothing gained -- we've all heard that a million times.

Hey, I'd've provided you with space and a budget years ago.  We'd
be reading of your stellar results in the electronic papers by now!

All that being said, I'd also sponsor other schools with quite different
approaches.  Television programming is even more powerful than
computer programming in a lot of ways, as it feeds directly into the
optic nerve thereby filling human memory banks, helping condition
responses.  What a powerful medium!

Some schools need to put more focus on TV skills, lest all the
effective recruiting commercials be for competing services.

Maybe the math curriculum includes some J, but with a starry
sky backdrop, with class content projected to a sheet strung
between tree trunks (or is the sheet itself some kind of LCD?).

You had to hike 20 miles to get here.  A lot of the databases you
study are about local flora and fauna.  Some kind of boarding
school?  International students?  Public?  Federally funded?

Lets fight early onset diabetes by ending discrimination against
physical activity as intrinsically "non-mathematical".

"Math is an outdoor sport" is one of our slogans.

>> or to people not crunching a lot of mathematical stuff
>> regularly, but for the professional statisticians and electronic traders I
>> know, J is a fabulous language, and very worth the modest learning curve.
>
> J would enable children to crunch data sets easily, allowing a radical
> deepening of every subject. The learning curve would be very modest
> when integrated with arithmetic and elementary science, and applied to
> languages, history, geography, health, and gym.
>

Glad you mentioned health and gym.  Doing the math around joules
and calories, relating these to food values (content):  lots of crunchy
data sets to work with, as you say, lots of working out.

The chemistry of food, digestion, and nutrition, includes cooking, learning
to cook.  Where those TV-making skills come in handy: producing cooking
shows for the school servers.

Using Python for a graphing calculator in math class need to not
be special, extraordinary, honors or advanced.  It's just the obvious
and everyday thing we should be doing already.

Besides, maybe we're not going to college right away?  Other
services calling, and offering their own training?

Given how FUBAR the Global U is right now, one could understand
why creating high debt for high tuitions simply to further over-specialize
our students might be considered counter-productive.

How about scholarships for veterans to enter nursing, other medical
professions?

The health professions are ravenous for computing and data
services.

My daughter is the Portland district champion debater at 15,
having started her high school's team in the first place.  I worry
though:  why waste her talents at some backward academy
that doesn't even teach about tetrahedral mensuration?  How
many dead mineshaft canaries does it take I wonder?

Maybe by the time she graduates we'll have some respectable
colleges out there.

>> J is an interesting case.  Iverson did not totally open up the source.
>
> There is a published version of the source for an earlier version of
> J, without the IDE, graphics, and so on. I have a copy. There has been
> some talk of creating a Free Software version, but no activity that I
> know of. However, Iverson's son Eric is considering GPLing some
> version of J in support of One Laptop Per Child and Sugar Labs. I need
> to bother him about it again, because I am about to apply for two XO
> 1.5 

Re: [Edu-sig] using Python as a calculator

2010-04-11 Thread kirby urner
>
> The chapter on interest calculations in Liber Abaci was particularly 
> important.
>

I'm sure you're right.  Euler added to the interest calculations literature
as well.

Nasty stuff, interest, really gets out of hand.

But then nature is full of exponentially curved responses.  I don't wonder
that humans have a heckuva time figuring any of it out.

Simulations have been helpful.  Lets do more of those.  Threading on
math-teach about that (instead of "programming games" we're
"programming simulations" -- then it's less trivial all of a sudden).

> No, in spite of the title, not based on the abacus, any more than
> calculus is based on pebbles.
>

Understood:  Fibonacci was showing algorithms that'd obviate the
need for a contraption (device).  I was simply pointing out that the
Indian-Arabic numbers map to the abacus, with 0 holding a "no
beads" position i.e. the symbolic sand-scribbles make up for
not having a real device handy.

You're saying Roman numerals mapped to the abacus too,
which somewhat surprises me, as I don't see what they're
using for a zero (no beads).  It all seems really cumber-
some, but I guess that's because I'm not Roman (I only
lived in Rome for six years and by then most had converted
to the new system -- I spent my first year learning about
non-decimal money but that's cuz this was Junior English
and I had to wear a tie).

> In the mathematical theory of languages, we can regard any
> Turing-complete symbol-and-rule set as a way to express all of
> mathematics, but that is outside the question of what language to
> teach or publish in, when the aim is communication with humans.
>

One could argue that I suppose.

I hail from the Wittgenstein camp.  We don't necessarily boast
of any "mathematical theory of languages".  I consider the basis
of mathematics more anthropological than logical, if ya know
what I mean.

When I teach Martian Math, it's all about Axiom Castles along
the beach, picturing Oregon Coast.  These sandcastles build
on axiomatic foundations, but what underpins them all (sand)
is not axiomatic and does not forbid multiple sandcastles.

Is chess a mathematical language game?  Must there be a
'right answer'?  Must all mathematical structures be Axiom
Castles?  Good questions.

Martian Math dispenses with a lot of 20th century "dimension
talk" i.e. it uses the "dimension" concept differently.  So what
though?  There are already multiple meanings after the
shake-out, with Coxeter's not the same as Einstein's, per
page 119 of 'Regular Polytopes' ( "tesseract not equal
time machine" might be a fun way to memorize this fact).

I bring in Karl Menger's "geometry of lumps" and link it to a
minimum topology (the simplex) of unit volume, thereby
getting a rationalized volumes table for the Platonics and
their dual-combos.  Fun game, works in Chinese as well,
other languages.  Lots of published literature, including in
illuminated text.

http://coffeeshopsnet.blogspot.com/2009/03/res-extensa.html

Does this Martian Math threaten the other sandcastles?
Not in Oregon it doesn't.  We have that live and let live
attitude.  Euclideans go in peace among us, often unaware
of our presence.

>> Also, one could argue that all creatures are mathematicians in some
>> innate way (Keith Devlin's point).
>
> So they are, beyond argument. So why are we telling them how they want
> to do math and computing? The mindset of "When I want to hear your
> opinion, I'll tell it to you" is what I hate most about education
> systems of the past and present.
>

Who is "we" here?  Are you included?

>> Carving out a special caste of humans and calling them "mathematicians"
>> is a practice within various institutions.
>
> Mathematicians are not a caste, but a guild with stiff entry
> requirements. I am not a full member, since I quit after my BA and
> went to teach in the Peace Corps.
>

You might see it that way.  Or maybe you found in the Peace Corps
that all kinds of brilliant people never have the privilege to participate
in any university system, given how the curriculum sucks so bad and
everyone is way too over-specialized.

If our curriculum were any good at all, the Global University would
be far less FUBAR.

Let's keep reminding ourselves and our teachers that we're not OK
with this status quo.  The mathematics must be seriously flawed,
given how we're so messed up (is, I think, a responsible attitude,
vs. trying to always render all practicing professionals above
reproach, off the hook -- we have serious reforms to implement).

One of the coolest mathematicians I work with is an HVAC engineer.

>> I've noticed many of these institutions promote a kind of snobbery,
>> but then such is the human ego.
>
> See The Theory of the Leisure Class, by Thorstein Veblen, and Buddhist
> teachings on no-self. Reverse snobbery is also a feature of human ego.
>

I miss Bhutan.  Really cool people, great scenery (scary-big mountains).

>> Note that numpy shares some of APL's and J's ability to shape data
>>

Re: [Edu-sig] [ANNC] pynguin-0.7 (python turtle graphics application)

2010-04-11 Thread kirby urner
2010/4/11 Lee Harr :
>
> Pynguin is a python-based turtle graphics application.
>     It combines an editor, interactive interpreter, and
>     graphics display area.
>

I like the idea of using turtles to plot graphs.  Replacing graphing
calculators with Python is easier when there are simple plot functions
available (yes, I know about matplotlib, Sage...)

Curious how much of the Standard Library turtle model gets used here.
Is the turtle stuff all rewritten from scratch.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] using Python as a calculator

2010-04-11 Thread kirby urner
>> Sorry, I don't know J (Kirby does), but this is exactly the reason I prefer
>> Python. Readability counts (for me).
>
> That's what they said to Fibonacci when he tried to explain why Arabic
> numerals were better for math than Roman numerals. But Roman numerals
> are better in readability and algorithmic complexity if you rarely do
> anything but add and subtract, as merchants did before interest
> payments became critical. Roman numerals are precisely equivalent to
> abacus notation. It is odd that the distinction between math/science
> programming and business programming is nearly a thousand years old,
> but there it is.
>

Fibonacci's Liber Abaci introduced the Indian/Arabic number system,
based on the abacus.  The place value system corresponds to the
rods of the abacus, with the zero corresponding to a rod with no beads
(a place holder).

Roman numerals, in contrast, have nothing to do with abacus notation
and have no place value e.g XIV for 14 or MMMCCC for 3300.

http://www.novaroma.org/via_romana/numbers.html

Roman numbers suck for arithmetic operations of any kind IMO.

> numbers =. i. 11  NB. 0..10
>

...similar to Python's range built-in.

> These objections are trivial and uninformed. You aren't a
> mathematician, you don't like math and math notation, so there is
> nothing more to say, except please stand out of the way of people who
> can benefit from it and want it.
>

One could argue any computer language comprises a math notation.

Also, one could argue that all creatures are mathematicians in some
innate way (Keith Devlin's point).

Carving out a special caste of humans and calling them "mathematicians"
is a practice within various institutions.

I've noticed many of these institutions promote a kind of snobbery,
but then such is the human ego.

> You can append a table to a table if they have a dimension in common.
> You can't append a table to a list unless the list is turned into a
> one-row table.
>

Note that numpy shares some of APL's and J's ability to shape data
into multi-dimensional objects with rank.

>>> import numpy
>>> a = numpy.array(range(10))
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a.reshape((2,5))
array([[0, 1, 2, 3, 4],
   [5, 6, 7, 8, 9]])
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a = a.reshape((2,5))
>>> a
array([[0, 1, 2, 3, 4],
   [5, 6, 7, 8, 9]])
>>> numpy.concatenate((a,a))
array([[0, 1, 2, 3, 4],
   [5, 6, 7, 8, 9],
   [0, 1, 2, 3, 4],
   [5, 6, 7, 8, 9]])
>>> numpy.concatenate((a,a), axis=1)
array([[0, 1, 2, 3, 4, 0, 1, 2, 3, 4],
   [5, 6, 7, 8, 9, 5, 6, 7, 8, 9]])

>>> I can easily give you a short sequence of lessons leading to this
>>> level, introducing some other arithmetic, transcendental, and
>>> array-handling functions along the way, and a little more about
>>> operating on functions to define new functions.
>>
>> Python is much nearer to standard Math-notation, that is a good thing.
>
> LOL. Math notation is what mathematicians use, not schoolchildren.

Math notations, like music notations, are the common heritage of
humankind, not the special property of an elite caste of human.

That being said, many math notations, including computer languages,
are quite opaque until deciphered.

Those already "in the know" may exult in their exclusive knowledge,
that's been true since time immemorial.

Those cryptic expressions on a T-shirt from the MIT gift shop serve
as mnemonics, are reminders of long hours spent unpacking the
meanings.

To a non-initiate, it all looks like so much unreadable APL. :)

Of course non-math notations share in these encrypting / compacting
capabilities.  You needn't use math notations to create operational
systems (institutions) with their respective insiders and outsiders,
with insiders often ranked according to their "degree" of inner-ness.

We've not really defined "mathematics", "mathematician" or
"math notation" for the purposes of this thread, so maybe one
could argue that all notations are inherently mathematical in
that they're aids to thought processes, which processes by their
very nature are computational in some degree.

Is Chinese a math notation?  Write a 500 word essay on why it
is.  Write another 500 word essay on why it isn't.

> They are constantly inventing more of it. What you call math notation
> is known to mathematicians as "arithmetic".
>

Iverson called APL an executable math notation (MN).  MNs were
divided into machine-executable and not.

Leibniz dreamed of machine-executable logical languages.  We have
them now, call them "computer languages".

> There is no standard math notation.
>

Nor is there a strongly fixed meaning to the concept of "math
notation".  Is Python a math notation?  One could argue that it
is.  Or call it a machine-executable logic.

> Polish: + 1 2
> Infix: 1 + 2
> Reverse Polish: 1 2 +
>
> Reverse Polish is one of the two standard calculator input systems,
> the one used by engineers, from HP. Polish is standard in LISP and
> combinatory lo

Re: [Edu-sig] using Python as a calculator

2010-04-11 Thread kirby urner
On Sat, Apr 10, 2010 at 9:25 PM, Helene Martin  wrote:
>
> (Speaking as a high school teacher with ~120 students in 3 different
> levels of computer science courses in a public school in Seattle)
>

That's hard work and you have my respect for it.

I started out as a full time high school teacher, mostly math, but only
stayed with St. Dominic Academy (Jersey City) for two years.

Later I wound up at McGraw-Hill and looked from the text book publisher
angle (I was on the 28th floor of a skyscraper in Rockefeller Center,
commuting from my friend Ray Simon's apartment in Brooklyn.

> I guess my point is that computer science in general and programming
> specifically have so much opportunity to be exciting for both the
> majority of students who are burned out on "traditional classes" as
> well as the minority of students who "know they likely won't be taken
> seriously if they boast of math skills and yet evidence no ability to
> think like computer scientists" (come on, that requires a high level
> of intellectual sophistication and is REALLY rare).  I think we need
> to exploit that opportunity to its full potential.
>
> I steer away from purely math-oriented examples because they alienate
> the majority of my students.  It's a tricky balancing act and I
> certainly can't claim to have figured it out.  Selfishly, I'd like to
> see the brilliant minds in this group sharing examples or ideas that
> the average 13-18 year old would find exciting and worthy of further
> exploration.  For example, a while back, Gregor Lingl shared a Turtle
> Graphics example in which a turtle performs a random walk collecting
> "coins" as it goes.  There are lots of interesting mathematical
> concepts to discuss in there and it requires students to use a lot of
> programming tools and ideas but it also has a "cool" factor.
> Furthermore, the basic idea is reasonably simple to understand and to
> see a use for (we can simulate other kinds of real-world situations,
> etc).
>

Yes, and I would not want to get in your way.

What I like to do in some of my classes (I still get teaching gigs through
the private sector) is show up with an XO or two, those One Laptop per
Child gizmos that Ed does Turtle Art for.

Our XO HQS in Portland, Oregon is one Duke's Landing on SE Belmont,
where Michael D. is tending mine among others, got me a developer's key
and everything, upgraded me to the latest Sugar.

http://www.flickr.com/search/?q=XO&w=17157...@n00
(tagged with XO in my Photostream)

http://www.flickr.com/photos/17157...@n00/4104822975/
http://www.flickr.com/photos/17157...@n00/4105591168/
(at Duke's specifically)

The Python application that puts Python most in one's scope is called
Pippy.  The fact that Sugar itself is a Python program will escape notice
unless they somehow get access to this lore, through a teacher or other
peer, perhaps via the Web.

The last gig I did was for a Free School event near Duke's, a place
called Flipside around the corner from Muddy Water's.

http://worldgame.blogspot.com/2010/03/radical-math.html

Anyway, that's a lot of Portland geography most people here won't know
(check Google Earth if curious, or Google Street Views -- here's Duke's

http://preview.tinyurl.com/ydeyzjl

).

Also, in the public sector, I took the whole of Winterhaven's 8th
grade for a spin.  Winterhaven is a one of Portland public's and a
kind of geek Hogwarts for some families.  It only goes up through
middle school though (8th grade).

What I taught there was a mixture of Python and GIS/GPS subjects,
per recommendations from other faculty.

The thinking has evolved since then to where we might adapt this for
high schools by having kids actually venture forth from their buildings
in teams, riding the buses and such, following various clues -- a kind
of geocaching as an organized sport, but also an academic exercise.

I could send links, but this is already pretty long.

Here's a peak at some of the work that we accomplished at
Winterhaven.

http://www.4dsolutions.net/ocn/winterhaven/

> I agree that we as educators are not entertainers and that learning is
> important for the sake of learning but at the same time, we need to be
> careful not to on one hand deplore the fact that students aren't
> taking computing courses while on the other creating courses which are
> dry and esoteric.
>

What we're trying to get off the ground in Oregon are pilot classes
that go towards the 3 year math requirement (mandatory for a h.s.
diploma) yet include computer programming as a part of the content,
maybe (I personally would hope) more of this GIS/GPS stuff.

It's a math course in other words, and yet Python might be used
for a language, like if teachers go with the Litvins' text, which I highly
recommend, among others.  In a hands-on music class, students
pick an instrument.  In hands-on math, you pick a computer
language (at least one, but one leads to another if a student
gets curious).

I just got a mailing from Saturday Academy today in fact

[Edu-sig] Radical Math: debugging help?

2010-04-10 Thread kirby urner
Below is current source for ch.py, a module for exploring volume
relationships starting with a "ground state" (a default) known as the
concentric hierarchy of polyhedra.

The user begets various polyhedra from their class definitions, then resizes
them at will, perhaps using the * operator in place of the scale method:

>>> import ch
>>> rt = ch.R_Triac()
>>> rt.volume
7.5
>>> rt = rt * pow(2/3., 1/3.)
DEBUG:  a star is born: a new R_Triac
>>> rt.volume
5.0009
>>> rt.edge
0.61771467052713269
>>> rt = ch.R_Triac()
>>> rt.edge
0.70710678118654757
>>> rt.edge_name
'long face diagonal'

The concentric hierarchy is formed from the five Platonics, a primitive set
that is closed under the operation of "make my dual".

When the duals combine, e.g. the tetrahedron with itself, you have the
option to intersect the edges so as to form yet another polyhedron (not
necessarily Platonic).

Here's what you can do with the five Platonics in that regard (i.e. o +
o.dual == something).

tetrahedron + tetrahedron == cube

octahedron + cube == rhombic dodecahedron

icosahedron + pentagonal dodecahedron == rhombic triacontahedron

There's some question as to how to scale these relative to one another, when
defining a ground state.

The tetrahedron, cube, octahedron and rhombic dodecahedron all have obvious
volume relationships if you start in this way.

Anyway, here's my puzzle:  I'm using Python 2.6, but my call to
Poly.__init__ within its subclasses would surely be more stylish where
super() used instead.

However, all my trials with super(), have so far resulted in errors.

If you fix this and even provide a clear explanation as to how this fix
works, you might become part of a famous inner circle.  The concentric
hierarchy is poised to take the world by storm, at least in NCTM circles.
 Here's a lesson plan I've been touting.

http://www.bfi.org/our_programs/bfi_community/synergetics (follow link to
NCTM web site)

Kirby

PS:  all the dual combos are rhombohedra i.e. have rhombic faces.  You may
criss-cross these diamond faces to get tri-rectangular tetrahedral wedge
shapes that include the center point.  In the case of the cube and rhombic
dodecahedron, one gets the same shape, called a Mite in this namespace (for
"minimum tetrahedron" -- it's a space-filler).  In the case of the rhombic
triacontahedron, one gets the T-module (T for triacontahedron).  Provided
our scaling is done right, 3 * T = Mite (volumetrically speaking).  I will
be adding these in a next edition.  My thanks to David Koski for technical
assistance on this project.


*== ch.py ==

from math import sqrt as radical

phi = (1 + radical(5))/2

class Poly:

def __init__(self,  edge = 1, edge_name = "edge",
 volume = 1, greekname = "Tetrahedron"):
self.edge = edge
self.edge_name = edge_name
self.volume = volume
self.greekname = greekname

def scale(self, scalefactor):
edge = self.edge * scalefactor  # edge unbound to self
volume = self.volume * pow(scalefactor, 3)  # likewise volume
print("DEBUG:  a star is born: a new %s" % self.__class__.__name__)
return self.__class__(edge = edge, edge_name = self.edge_name,
  volume = volume, greekname = self.greekname)

__mul__ = __rmul__ = scale # e.g. tetra = tetra * 3

def __repr__(self):
return "Polyhedron of type %s (vol: %s)" % (self.greekname,
self.volume)

class Tetra( Poly ):
pass

class Cube( Poly ):
def __init__(self, edge = 1, edge_name = "face diagonal",
 volume = 3, greekname = "Hexahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class Octa( Poly ):
def __init__(self, edge = 1, edge_name = "edge",
 volume = 4, greekname = "Octahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class R_Dodeca( Poly ):
def __init__(self, edge = 1, edge_name = "long face diagonal",
 volume = 6, greekname = "Rhombic dodecahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class R_Triac( Poly ):
def __init__(self, edge = radical(2)/2, edge_name = "long face
diagonal",
 volume = 7.5, greekname = "Rhombic Triacontahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class Icosa ( Poly ):
def __init__(self, edge = 1, edge_name = "edge",
 volume = 5 * phi**2 * radical(2), greekname =
"Icosahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))

class Cubocta ( Poly ):
def __init__(self, edge = 1, edge_name = "edge",
 volume = 20, greekname = "Cuboctahedron"):
Poly.__init__(self, *(edge, edge_name, volume, greekname))
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread kirby urner
On Sat, Apr 10, 2010 at 9:23 AM, Helene Martin  wrote:

> I humbly disagree that this is the right place to start.  I teach
> students with diverse backgrounds -- some extremely bright and others
> really behind in school and using Python as a calculator is one thing
> they would all agree is terrifically boring and not so compelling.
> How many students have ever said "man, I really wish I had a trig
> table right now?"
>
>
Yes Helen, I really do understand this concern.

It's a concern that somewhat worries me though.

Maybe the problem is students aren't being paid to be there.

Should we offer frequent flyer miles for assignments turned in?  On Delta?


> I agree that one way to sell programming is to incorporate it into
> math courses and maybe that kind of start is more appropriate there.
>
>
Ah, now I see the problem.

There's this notion of trying to "sell programming" whereas world class
schools already mix computer programming with math.

Speaking of which, check out this cool steampunk monitor:

http://steampunkworkshop.com/lcd.shtml


> It's not like I start with fireworks and fanfare but I'm thrilled to
> see Turtle be fun and compelling for students of all levels.  Most of
> them discover Python can do math when they try to see whether they
> could pass in a scaling parameter and guess that multiplication is
> probably an asterisk.  I mention order of operation and integer
> division and we move on.
>
>
My students know they likely won't be taken seriously if they boast of math
skills and yet evidence no ability to think like computer scientists.

Knowing how to program is just one of those "goes with the territory" kinds
of skills associated with STEM.

My bias derives from literature funded in some measure by
DARPA-with-a-backwards-R -- for "radical"  (a CP4E commercial).

Why is OLPC / G1G1 is so important:  to help kids elsewhere from suffering
the same fate.


> I enjoy reading this list and learn many interesting tidbits from it
> but, as I think I've mentioned before, I often find myself chuckling a
> bit.  A lot of what is said on here is so incredibly esoteric and far
> from my students' realities!
>

I teach Pythonic Math off and on through a nonprofit backed by Silicon
Forest interests.

The view of many Silicon Foresters is that the traditional math education
being provided in high schools is simply a forced march in the wrong
direction.

My students have been highly diverse, including a Goth girl who hated school
(wicked smart though), many with English as a 2nd language, many home
schoolers.  Lots of disaffected, refugees.

Those doing well on the calculator / calculus track may see no reason to
leave The Matrix.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] using Python as a calculator

2010-04-10 Thread kirby urner
On Fri, Apr 9, 2010 at 9:41 AM, Edward Cherlin  wrote:

> [sigh]
>
> Do math tables in a math array language.
>
> degrees =. i. 91  NB. 0..90
>
> radians =. degrees * o. % 180
>
> table =. |: degrees, 1 2 3 o./ radians
>
> where
>
> =. is assignment
> i. creates a list of consecutive numbers starting at 0.
> NB. is the comment marker
> o. x is pi times x
> % x is reciprocal of x, so o. % 180 is pi/180
> |: is transpose
> , appends an array to another. It turns a list into a table in order
> to match dimensions.
> 1 2 3 o. x gives sine, cosine, tangent of x
> / creates a table with the given function (o.) applied to two list
> arguments
>
>
Thanks Ed.  Nostalgia trip.

Yeah, my first reaction was similar to Christians:  if we need to learn a
whole new language to do a trig table, that's hardly productive-seeming.
 How to use the tools we already know?

And yet I've suggested a minimum of two languages, even if foreground
emphasis is given to just one.  The other might be purposely off-beat, like
COBOL or something.  REBOL anyone?  Or it might be a closer relative to
Python, such as JavaScript (for which Alan Kay has a lot of respect).

NB. for nota bene as I recall.  I always treasure the Italian influence.
 APL was (is) like Greek.

Below is the source for the trig table generator, a snap shot.  The inner
circle on this one, which includes Chairman Steve, is debating whether
TypeError should really be caught.

On the "aff side" (as debaters say, when arguing in the affirmative), a
capricious, not necessarily malicious user might feed in a filename of like
3, or type([ ]).  That's not a filename at all, so catch it with TypeError.


On the "neg side", there's a school of thought which says exceptions are
about catching "honest mistakes" i.e. the exception suite is showing what
one might legitimately expect as an error:  in this case an IOError because
the file cannot be created (e.g. is write-protected, is specified in a
non-existent directory or something of that nature).

I forget how J handles exceptions of this nature (wrong path,
write-protected file) -- I seem to recall a bunch of system call features,
but it has been some years...

Kirby

===

def trigtable(therange, fileout = None):
"""
Print a trig table, to stdout or to a file
http://mail.python.org/pipermail/edu-sig/2010-April/009890.html

Rewrite with "with statement"?
"""
if fileout:
try:
thefile = open(fileout, 'w')  #lets hope for a legal filename
(optional path part)
except (TypeError, IOError) as exc:
print("Unable to open file: {0}".format(fileout))
raise
else:
thefile = sys.stdout

for row in therange:
theta = radians(row)
print("{0:>5g}  {1:.9f}{2:.9f}{3:e}".format(
row,cos(theta),sin(theta),tan(theta)),file= thefile)
if fileout:
thefile.close()


> The result is a 91 row, 4 column table of angles and trig function values.
>
> --
> Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
> Silent Thunder is my name, and Children are my nation.
> The Cosmos is my dwelling place, the Truth my destination.
> http://www.earthtreasury.org/
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] using Python as a calculator

2010-04-08 Thread kirby urner
I think Guido was wise to start his tutorial by showing how we
might use Python as a calculator.

We might assume many students in this day and age are quite
familiar with this device, and even if they're not, the text might
project one, show a picture on the screen, if what these things
used to look like (still do).

However, one thing calculators lack over the old wood pulp
textbooks are trig tables with multiple rows showing a lot of
data at the same time.  Their small "chat window" does not
permit much data to be seen at one time.

Back in the day, a student could run her finger down the
rows, as the number of angular degrees increase from
0 to 60 and onward to 90, perhaps all the way around to
360.

Going across the row, one would have sine and cosine,
perhaps tangent.  Having all the data visible at once, or spread
across a few pages, inspired some insights and understanding,
as one could see the trends in the numbers, plus these
"click stop" rows where the numbers would suddenly be
super easy, like 1/2 and 1/2 for both sine and cosine.

Calculators don't give us that kind of output, but earlier office
computing machines did have paper i/o, called a tape, usually
a scroll mounted on a spool and fed through a small printer.

As one added numbers, one printed to tape, perhaps a running
total.  The tape itself was a valuable item (especially once it
had the data on it).

Large computers came with line printers that hit on continuous
feed paper with holes along both sides, often with green and
white stripes.  I will not try to recapitulate the long history
of printing devices, except to point out that computers
inherited them while slide rules and calculators did not.

The equivalent in Python is stdout and/or some file in storage,
on the hard drive or memory stick.  The program output
shown below would be an example of this kind of i/o.

Notice that unless a file name is given (optional), the data
is to stdout.

I'm going to do a full 90 degrees, just to remind myself of
the patterns students got in the old days, before trig tables
were replaced with calculators, much as dial watches were
replaced with digital ones (not necessarily a smart move
in all cases).

>>> imp.reload(newprint)

>>> newprint.trigtable(range(91), "trigtable.txt")

The contents of trigtable.txt:

0  1.00.00.00e+00
1  0.9998476950.0174524061.745506e-02
2  0.9993908270.0348994973.492077e-02
3  0.9986295350.0523359565.240778e-02
4  0.9975640500.0697564746.992681e-02
5  0.9961946980.0871557438.748866e-02
6  0.9945218950.1045284631.051042e-01
7  0.9925461520.1218693431.227846e-01
8  0.9902680690.1391731011.405408e-01
9  0.9876883410.1564344651.583844e-01
   10  0.9848077530.1736481781.763270e-01
   11  0.9816271830.1908089951.943803e-01
   12  0.9781476010.2079116912.125566e-01
   13  0.9743700650.2249510542.308682e-01
   14  0.9702957260.2419218962.493280e-01
   15  0.9659258260.2588190452.679492e-01
   16  0.9612616960.2756373562.867454e-01
   17  0.9563047560.2923717053.057307e-01
   18  0.9510565160.3090169943.249197e-01
   19  0.9455185760.3255681543.443276e-01
   20  0.9396926210.3420201433.639702e-01
   21  0.9335804260.3583679503.838640e-01
   22  0.9271838550.3746065934.040262e-01
   23  0.9205048530.3907311284.244748e-01
   24  0.9135454580.4067366434.452287e-01
   25  0.9063077870.4226182624.663077e-01
   26  0.8987940460.4383711474.877326e-01
   27  0.8910065240.4539905005.095254e-01
   28  0.8829475930.4694715635.317094e-01
   29  0.8746197070.4848096205.543091e-01
   30  0.8660254040.55.773503e-01
   31  0.8571673010.5150380756.008606e-01
   32  0.8480480960.5299192646.248694e-01
   33  0.8386705680.5446390356.494076e-01
   34  0.8290375730.5591929036.745085e-01
   35  0.8191520440.5735764367.002075e-01
   36  0.8090169940.5877852527.265425e-01
   37  0.7986355100.6018150237.535541e-01
   38  0.7880107540.6156614757.812856e-01
   39  0.7771459610.6293203918.097840e-01
   40  0.766030.6427876108.390996e-01
   41  0.7547095800.6560590298.692867e-01
   42  0.7431448250.6691306069.004040e-01
   43  0.7313537020.6819983609.325151e-01
   44  0.7193398000.6946583709.656888e-01
   45  0.7071067810.7071067811.00e+00
   46  0.6946583700.7193398001.035530e+00
   47  0.6819983600.7313537021.072369e+00
   48  0.6691306060.7431448251.110613e+00
   49  0.6560590290.754709580

Re: [Edu-sig] [OT] Re: Dreaming in Code by Scott Rosenberg (2007)

2010-03-28 Thread kirby urner
On Sun, Mar 28, 2010 at 5:36 AM, Bert Freudenberg  wrote:
> On 28.03.2010, at 07:54, kirby urner wrote:
>>
>> I tried introducing "FOSS witch" on Diversity (python.org) and
>> appeared to get no takers.
>>
>> Hacker, pirate, wizard, geek, dictator... but not witch.
>
> Google for "haecksen".
>
> The German word for witch is "Hexe", plural "Hexen". The German pronunciation 
> of "Haeckse" is almost identical to "Hexe". It was created as a play on the 
> word "Hacker" which is masculine in German, the canonical femininum would be 
> "Hackerin" (i.e., 'hacktress'). But "Haeckse" is much more playful and 
> creative so this is how some women in the CCC started to call themselves. 
> Also it sounds decidedly unixy, some old-school hackers still insist the 
> plural of "unix" is "unixen" and the boxes running them are "boxen".
>
> Since "witch" nowadays has a generally positive connotation (not the least 
> because of J.K.Rowling's and other's books) it at least elicits a giggle when 
> telling girls about this. In Germany anyway.
>
> - Bert -

Very cool Bert, and also encouraging.

Thx!  I'll share with other members of the coven.  :)

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Dreaming in Code by Scott Rosenberg (2007)

2010-03-27 Thread kirby urner
> Surprisingly, this book has not been mentioned before on Edu-sig if a Google 
> search of the archives is to be believed.
>

I believe you're correct.

> Here are excerpts [and comments on the excerpts] which suggest why it might 
> be useful to Python-using Educators:
>
> pg 41
> Torvalds, who is known as Benevolent Dictator for Life of the Linux operating 
> system, consistently exudes a calm optimism about the long-term prospects for 
> the movement he symbolizes. "In science," as he explained in a 2004 interview 
> in Business Week, "the whole system builds on people looking at other 
> people's results and building on top of them.  In witchcraft, somebody had a 
> small secret and guarded it--but never allowed others to really understand it 
> and build on it. Traditional software is like witchcraft.  In history, 
> witchcraft just died out. The same will happen in software. When problems get 
> serious enough, you can't have one person or one company guarding their 
> secrets. You have to have everybody share in knowledge."
>

I'd not seen this quote before.

I understand his point of course.

However, having someone proclaimed a dictator in Business Week saying
negative stuff about witchcraft might not be the best PR imaginable.

The guy lives in Portland, you'd think he'd know better?

Note that wizards seem to get off, i.e. Unix culture embraced the
wizard meme (Google for hits), but not witch (hardly any).

I tried introducing "FOSS witch" on Diversity (python.org) and
appeared to get no takers.

Hacker, pirate, wizard, geek, dictator... but not witch.

I realize there are male witches (technically) but thought some
"subversive word" (like pirate) with a clear slant towards women,
might actually be a positive contribution.

Just about all the hits on Google are my own uses of this term ("FOSS
coven" was another).

I think the history here is that both alchemy and witchcraft were
proto-sciences and didn't so much die out as transform.  They became
actual sciences with the spread of literacy and less persecution by
religious authorities.

Witches were herbalists, practitioners of medicinal arts.  Alchemists
were metallurgists and chemists.

The culture witches lived in believed in curses and spells (as many do
today), so countering spells against a client would count as
psychotherapy by today's standards.  Witches were proto-psychologists.

Witchcraft waned in proportion to people no longer taking it
seriously, meaning you could no longer be put on trial for its
practice, any more than for practicing magic or voodoo -- unless
animals were harmed in the process, or you happened to be an
economist. :)

I'd rather cast the Spanish Inquisition as cathedralist and anti-FOSS,
secretive and control freaky:  a priesthood (mostly male and
hierarchical), looking appropriately klannish in those
identity-masking pointy hoods.

Witches and wizards, good people of the forest, are more egalitarian
and self-organizing, are the open sourcery types trading goods and
skills in the free-wheeling bazaar.  They're like faculty at Hogwarts,
more liberal artsy, more collegial.

Just my own bias.

OK, back to regularly scheduled programming...

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] about iterators, range, and summing consecutive integers

2010-03-26 Thread kirby urner
On Fri, Mar 26, 2010 at 10:38 PM, kirby urner  wrote:

<< snip >>

> How else might we address a Python range object?
>
> With slicing notation:
>
>>>> d[1]
> 1
>>>> d[4]
> 4
>

Erratum:  no, not with slicing notation, with individual indexes only:

>>> d[2:3]
Traceback (most recent call last):
  File "", line 1, in 
d[2:3]
TypeError: sequence index must be integer, not 'slice'
>>>

Apologies.

Thanks for the pointer to an overview of turtle graphics responses Daniel.

I always thought Logo was under-appreciated for what it could do
completely independently of having a turtle.  Your libraries prove that
you really appreciate Logo.

Speaking of turtle art, I found this entertaining session with Alex Martelli
helping out:

http://stackoverflow.com/questions/1452311/turtlegraphics-python-constraining-random-moving-turtle-in-a-circle

Note:  The iterator stuff I just posted is to help with a 'Gnomon
Studies' lesson plan...
http://groups.yahoo.com/group/synergeo/message/58114

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] about iterators, range, and summing consecutive integers

2010-03-26 Thread kirby urner
Here are some looks at summing consecutive integers, ways
to sum 1 + 2 + ... + n in Python:

We start with the closed form, which doesn't actually need
to iterate through intermediate terms, works directly with n,
the last term in the sequence:

>>> def trinumbs(n):
return n * (n + 1)  // 2

These next two make use of all the intermediate values:

>>> def trinumbs2(n):
return sum(range(1,n+1))

>>> def trinumbs3(n):
i = 1
thesum = 0
while i <= n:
thesum = thesum + i
i += 1
return thesum



Although all of these give the same answers, between the last two,
the very last one is the most "classic" in terms of what an old time
imperative programmer would expect.  Having a range() function
built right into the language is more APL-like.  Most "classic"
imperative languages such as FORTRAN and PL/1 required the
programmer to do all the incrementing "by hand" (explicitly).

You will find more about the range() function below.

Notice the two ways of incrementing and rebinding.  When
writing thesum = thesum + i, the name 'thesum' is being rebound
to the result of thesum plus whatever value i names.

The equal sign (=) is not used to assert equality but as an
"assignment operator".  Objects have names and the assignment
operator is what binds a name to an object.

i += 1 is a shorter way of saying i = i + 1 and is borrowed from
C / C++, is a much used convention.



Python has very few control statements.  Another way to write the
above would be:

>>> def trinumbs4(n):
i = 1
thesum = 0
for i in range(1, n+1):
thesum = thesum + i
return thesum

The keywords 'while' and 'for' are the two main looping constructs.

trinumbs2 is making use of another built-in that directly consumes
the output of range( ), and that is the sum( ) function.

Since range( ) is zero-indexed, and since our tacit understanding
is we're working with "natural" or "counting" numbers starting with 1,
both uses of range (in trinumbs2 and trinumbs4) bump up the
starting and ending parameters.

If you feed only one argument to range, this is mapped to its
ending parameter with the start parameter defaulting to 0.

range ( 10 ) is equivalent to range (start = 0, stop = 10), except
range doesn't take keyword arguments, so you can't actually
get away the the 2nd expression.

Examples:

Only one parameter, so an ending parameter:

>>> list ( range( 10 ))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Two parameters, so a starting and ending parameter:

>>> list ( range(1, 11 ))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Three parameters, so a starting, ending and "increment by"
or "step" parameter:

>>> range(2,31,2)
range(2, 31, 2)
>>> list ( range(2,31,2) )
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]

Yes, you may increment negatively, but then remember not to
make your starting value less than your stopping value:

>>> list ( range(1, 10, -1) )
[]

>>> list ( range(10, 0, -1) )
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

range(5) returns a "range object" (of type range) which may in turn
be interacted with in various ways:

>>> d = range(5)

>>> d
range(0, 5)

>>> type(d)


>>> list(d)
[0, 1, 2, 3, 4]

>>> tuple(d)
(0, 1, 2, 3, 4)

>>> sum(d)
10

How else might we address a Python range object?

With slicing notation:

>>> d[1]
1
>>> d[4]
4

Although it's an iterable (you may iterate over it, using 'for'), d is
not an iterator, meaning it's not supportive of 'next' (as no __next__ rib
internally).

The built-in iter function will trigger an object's internal __iter__ method,
if there is one, and return an iterator prepared to be eaten by next().

>>> next(d)
Traceback (most recent call last):
  File "", line 1, in 
next(d)
TypeError: range object is not an iterator

>>> k = iter(d)

>>> next(k)
0
>>> next(k)
1
>>> next(k)
2

>>> d
range(0, 5)

>>> j = iter(d)

>>> next(j)
0

>>> next(k)
3

Notice that k and j above are two separate iterators and
they go through to exhaustion independently of one
another.  Once an iterator has been exhausted, it will
no longer return contents, including in response to
the print function.

>>> theiterator = iter(d)
>>> next(theiterator)
0
>>> next(theiterator)
1
>>> print(theiterator)

>>> print(list(theiterator))
[2, 3, 4]
>>> next(theiterator)
Traceback (most recent call last):
  File "", line 1, in 
next(theiterator)
StopIteration

In the above example, d (which is our range object) is
the source of a fresh iterator, theiterator.  After nexting
through two terms, the print function is used.

The first use simply returns the type of the object, not
its contents.  However, by feeding theiterator to the
list function, we cause it to squirt out the rest of its
contents, meaning it is now exhausted.

When theiterator is then fed to the next method, it
raises an exception, a StopIteration.

>>> def test():
try:
next(theiterator)
except StopIteration:
print("I'm exh

[Edu-sig] Fwd: course outline (pythonic math)

2010-03-25 Thread kirby urner
Here's something I originally posted to another list, but one that
is white-space insensitive.  Hardly a venue for sharing anything
Pythonic.  Anyway, it's relevant here too.

This is more of a sketch than something I've poured over for
hours, just trying to give the gist of a possible Discrete Math
course, one among hundreds or thousands or... not trying
to write "the national standard" (blech).

Kirby



DIGITAL MATH:

Cardinality versus Ordinality
  Naming things
 Two different versus two the same
 Of zip codes and phone numbers
  Sorting things
 Equality, greater than, less than
  Hello World!
 A Biotum Class (Python)
 A Snake Class (Python)

Numbers and Bases
  Positional Notation
  Lore:  Algorithms liberate Europe (Liber Abacci)
  Lore:  from ASCII to Unicode
  Decimal versus Hexadecimal
  Volume Bases:  Tetrahedron versus Cube

Functions and Relations (Part 1)
  Lore:  the rise and fall of New Math
  Mappings
Python's dictionary structure
Caesar Codes
Lore:  from secret key to public key crypto
  Inverse Functions
  Injection, Surjection, Bijection
  What's a Relation?

On Growth and Form
  Functions for Gnomon Growth
  Triangular Numbers
  Lore and Proof: Gauss summing 1..100
  Square Numbers
  Proof: Sum of consecutive squares
  Tetrahedral Numbers
  Cubic Numbers
  Lore:  Fibonaccis and Phi
  Generating Fibonaccis
  Generating Polyhedral Numbers
  Generating Pascal's Triangle
  Triangular and Tetrahedral Numbers

Prime and Composite Numbers
Euclid's Method for GCD
Primes versus Composites
Strangers
Totatives and Totients

Functions and Relations (Part 2)
  Permutations
  Polyhedral Rotations (dice in Casino Math)
  Composition of Functions (a kind of multiplying)

Abstract Algebra I
   Multiplication:  What is it
  Python and "Modulo Numbers"
  Vegetable Group Soup
  Cayley Tables
   Group Properties (CAIN and Abelian)
   Addition:  What is it
   Rings and Fields

Preview of Future Topics
   Supermarket Math
  SQL
  web frameworks
   Neolithic Math
  artifacts and encoded geography
  constellations
   Casino Math
  random number generators (Python)
  Deck and Card classes (Python)
   Martian Math
  Sphere packing and the Octet Truss
  Tetrahedral Accounting
   Pentagon Math
  Lore:  geodesic spheres and domes, radomes
  Phi in Fuller's concentric hierarchy

Notes for Teachers:

Cardinality versus Ordinality --

Before we order or sort, we need to recognize which things or
objects are of which type.  This course uses a type based
mathematical logic known as the Python computer language, so
awareness of types will be front and center from the get go.
Exercises will include querying objects as to their types.

Z-axis (depth dimension):  if you've going through this in
a spiral with plans to go deeper each time, then at some
point your students may want to define their own classes
and implement meanings for __lt__ __gt__ __eq__, Python's
"ribs" (special names) for < , > and == respectively.  However,
this course outline does not make too many assumptions about
which turn of the spiral one is in.  Students will vary, as
will teachers.

Numbers and Bases --

This should feel like fairly easy review.  I recommend playing
Tom Lehrer's 'New Math' from 'That Was the Year that Was' and
making sure students get that it's mathematically correct.  This
is looking ahead to later lore, where we talk about the rise and
fall of New Math.

About Lore:  this curriculum is premised on the notion that
storytelling is integral to passing on a culture, and that too
much time on a technical axis, to the exclusion of narrative
context, is either counter-productive or is an intentionally
applied filter aimed at testing student tolerance for
"in the dark" learning.

Functions and Relations (Part 1) --

A lot of this is standard Algebra 1.  New Math helped writers
formalize their notion of function as distinct from a relation,
using set theoretic constructs.  This may not be the right place
for a Python dictionary on a first pass.  I was getting into
Caesar Codes again recently, relating them to permutations and
polyhedral rotations, and am freshly persuaded this is one of the
better routes to elementary group theory, just ahead.

http://mail.python.org/pipermail/edu-sig/2010-March/009867.html
http://mail.python.org/pipermail/edu-sig/2010-March/009870.html

On Growth and Form --

Here's a way to connect the graphical and lexical without getting
into XYZ coordinates or vectors right off.  Gnomon studies and
sphere packing keep the number sequences connected to the
visualizations.  Influences and valuable resources here would
include 'The Book of Numbers' by Conway and Guy, 'Gnomon' by
Midhat Gazale, and certain passages from 'Synergetics' by R.B. Fuller,
with bolstering writing from H.S.M. Coxeter.

Lore:  getting a sense of Coxeter's outrage on finding nature's
geometry had been patente

Re: [Edu-sig] Confused how teach geometry and importance of teaching geometry in 21st century.

2010-03-25 Thread kirby urner
On Thu, Mar 25, 2010 at 7:40 PM,   wrote:
> I'm teaching high school math to homeschoolers and I'm looking for how to make
> geometry year meaningful.
>

Most geometry taught in high school is flat, planar.

This is a problem in an age of HDTVs, LCDs.

If you wanna blow some time on a meandering meditation on
just this theme, 'Beyond Flatland', here's something I wrote
last night.  This takes off from a 1997 Math Summit held here
in Oregon, with Keith Devlin, Roger Penrose, Ralph Abraham
and other luminaries.

http://groups.yahoo.com/group/synergeo/message/58095

(maybe just scan the opening paragraphs, then decide
if it grabs ya -- I'm talking to an inner circle, using some
shoptalk, so probably a yawner).

> I'm having a "crisis of confidence" because from my viewpoint, algebra was 10x
> more useful for future math and science work.
>

10th grade geometry distills just some of the Euclidean
stuff.  There's precious little topology, no V + F = E + 2,
no Descartes Deficit, no sphere packing, gnomon studies,
hardly much about polyhedra, their duals, little to nothing
about Phi...

I agree with ya, a big rip off.

Fortunately, the Internet is brimming with cool stuff, so
much to see and do.  Lots of great Java applets, no reason
to avoid them (we're not language bigots).

Geometry in the sense of events in space is about geography,
which (going big) includes astronomy and (going small)
internal organs, cells, molecules down to whatever particles.

In other words, geometry applies to the whole kit 'n kaboodle
so can't be "irrelevant to science" no matter how hard we try.

My advice:  remember to stay spatial, with planar as subset
(special case) of spatial.

Regarding Python in particular, I recommend getting into
VPython.  Also POV-Ray if you have the time, and VRML.
I've got lots of writings on this at my web site, complete
with source.

Recommended:  'The Book of Numbers' by Conway and
Guy.  Lots to program around.

> The only thing I can remember that was useful from geometry was a few volume
> and area formulas.  That can justify maybe a month but not a whole YEAR of
> geometry!?!?
>
> cs
>

I've spent many years with the Python + Geometry combo.

One pay-off is I generated most of the graphics at my web
sites and am therefore free to upload them to Wikipedia
and Wikieducator, where the authorities tend to be sticklers
about intellectual property.

Given all these cool graphics are mine, mine, mine, I feel at
liberty to spread them.  Thank you Python.  Thank you other
free tools.

> P.S. Yes yes I know that geometry is meant to teach logical reasoning.  Maybe
> one can get that from chess, debate club and other activities as well if
> not better?  People also say geometry is where you learn proofs.  Couldn't
> proofs be just as easily emphasized in all the other math classes?
>

If you're free to work in a home schooling setting, then you
can blend the topics a lot more, as student interest meanders.

'The Geometrical Foundation of Natural Structure: A Source
Book of Design' by Robert Williams would be a good title to
start with.  It's not a textbook.  Dover Press books tend to
be quite affordable though, this one not too hard to obtain.

If you're into lore or stories, which I consider central to any
credible curriculum, then maybe the Siobhan Roberts bio of
Donald Coxeter would be work getting and sharing with
students.

There are some juicy stories in there, gossip about Escher's
son I think it was, trying to break into the radome business...
radomes were those DEW line things across Canada, a
manifestation of the cold war

Lots more to say, but since this is a topic I've worked on a
lot, I need to hold back, not open the floodgates.  Lots here
in the archive.

Thanks for joining us.

Oh, and if you get the Litvins text, Math for the Digital Age
and Programming in Python, then you'll find stuff on graphs
(in the sense of networks), mostly planar, but it's easy to
turn graphs into polyhedra with the wave of a magic wand.

Turtle Art / Turtle Graphics...

Springie.com.

Darwin @ Home.

Gregor helped me with getting Python turtle to draw the plane-net
for a T-module (back to my shoptalk), 120 of which build a rhombic
triacontahedron (an important shape with thirty 1 x phi diamond
facets).

Per Robert Williams, once you start jamming polyhedra
together, you're into lattices, and that's Linus Pauling style
chemistry, nanotechnology, crystallography -- no shortage
of relevant pages and projects.

Happy camping!

Kirby

> --
> ___
>
> Christian Seberino, Ph.D.
> Email: ch...@seberino.org
> ___
> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Python projects for CS1

2010-03-24 Thread kirby urner
<< snip >>

Kirby wrote:

> p = "Able was I ere I saw Elba"
>>
> e = encode(p, coding)
> e
>> 'AejlgfwtgIglclgIgtwfgEjew'
>>
> decode(e, coding)
>> 'Able was I ere I say Elba'
>>

Kirby replies:

First of all:  Happy Ada Lovelace Day!

Secondly:  Yikes!  I see the typo here (quoted above).

My actual IDLE session had some mistakes so when
I built up this posting, I cut and pasted the working bits,
but then kept this early wrong value for the plaintext p.

When p was enciphered / deciphered, it came back right,
i.e. decode(encode( p )) should be the identity function
for arbitrary p.  However, it started out with this 'say'
mutation, instead of 'saw'.  This is a famous palindrome
by the way, not invented by me, and is put into the mouth
of Napoleon Bonaparte for mnemonic purposes.

Anyway, apologies for my sloppiness to future readers
who might stumble on this post.

Just to expand a bit while I'm at it:

Allowing our permutations to be random instead of rotations
clearly makes this a rather large permutation space, so the
kind of brute force code cracking suggested in the exercise
would be harder.

Were MFTDA (Math for the Digital Age) to morph into a
series, with more time given to many of the topics (in addition
to new topics), then the ramp up to RSA could be more
leisurely and include such as the Caesar Codes in more
detail.

Rotations of polyhedra may be described with such mappings,
with starting / ending points of the vertices.  One might think
of two copies of the same polyhedron superimposed, with the
A of one going to the D of the other upon rotation, other
vertexes moving accordingly.  Permutations give a road map
between the different positions, showing what states are but
one hop away (thinking of hypertoons again -- another thread).

Over on math-teach today, I've drawn an analogy between the
digital divide separating traditional math classes from their
more digital counterparts, and the Berlin Wall.  I claim to be
echoing Ronald Reagan in demanding it be torn down.

http://mathforum.org/kb/message.jspa?messageID=7019256&tstart=0
(rather lengthy, might be called a rant).

I actually think just using Python as a calculator might
can take one a long way.  One might be projecting some
spatial geometric relationship, such as an icosahedron
with faces glued to an enclosing octahedron's, lots of
phi relationships to check.  This is exactly what I was
doing yesterday in fact.

Here's an excerpt from my email outbox:

"""
Meant to include this Python excerpt (back of the napkin check on the
length he claims to find):

>>> from math import sqrt as radical
>>> phi = ( 1 + radical(5))/2.
>>> phi
1.618033988749895
>>> phi / radical(2)
1.1441228056353685
>>> phi / radical(2) + radical(2) / 2
1.851229586821916
>>>

...

http://www.rwgrayprojects.com/synergetics/s09/figs/f87242.html
(18.51... == volume of C. in figure)

That length of the octahedron (icosahedron inside) is 1/10 the volume
of the enclosed icosahedron.  Curious.

Just thought I'd mention, given we're on the topic of the icosahedral
hubs in many versions of Flextegrity.
"""

This might be a signature difference between using
Python in a math class versus a computer science class:
math students may make very light use of Python as
a calculator while focusing a lot of attention on problems
that do NOT require much if any programming to solve.

In other words, math students may often use Python
but do little or no programming with it -- not talking about
no programming in the whole course, just saying a whole
hour might go by where you just run Python as a scratch
pad on the side, have no need to compose or run
programs, other than to import from the occasional
library.

More like Sage in some ways, except we may just
get by with IDLE or something similar.

I underline this difference for the sake of teachers who
cringe at the word "programming".  Some people went
into math teaching precisely because they didn't like
doing that, or just see it as adding a lot of overhead.

BTW, I think 3.1.2 is taken a significant step in its
numeric display habits.  The IEEE floating point
specification is not messed with, but repr has a new
set of conventions.  In general, number formatting is
getting more powerful.

When it comes to bulk data, you start to need more
programming just for file i/o, although even here you
might get away with a lot, especially if the module in
question pre-stores the data.

This is the Rich Data Structure idea I was talking about,
i.e. if you want students to have the lat/long for every
major city on Earth, or to have the Periodic Table of
the Elements as a dictionary of Atom objects (however
designed), then just include the bulk data as a part of
the module, already loaded up into these sophisticated
structures.

Or, if you wanna be more ambitious, include a Reader
for grabbing and loading from raw files, either locally
provided or over the wire (having these in addition to
"ready to use" would be most convenient)

Re: [Edu-sig] Python projects for CS1

2010-03-23 Thread kirby urner
On Tue, Mar 23, 2010 at 7:29 AM, Bill Punch  wrote:

<< snip >>

> If you have any comments, we'd love to hear them.
>


Hi Bill --

I enjoyed poking through some of these, reminiscent of some of the
SuperQuest challenges for Oregon's annual software competition,
high school students working in teams, with a language of their
choice, to come up with a working solution in a time race.

I like how you cover a lot of territory.  Just looking at your page
reassures a student that computer programs are ubiquitous i.e.
in all walks a life (or a lot of 'em).  Teachers should feel heartened
as well, especially math teachers, seeking new relevance
amidst real world topics, like strangers in a strange land
(some of them).

I'm wondering if you sometimes revisit the same problem suggesting
different strategies for solution, perhaps after students have struggled
and turned in some work.  The same problem tackled multiple times
may help boost student self-confidence, as they perceive how their
powers are growing (like working out in a gym, lifting that same stack
more easily).

For example, the Caesar Code stuff is pretty interesting, as a generic
introduction to permutations, wherein rotations might be "multiplied".
You've got finite groups going here -- a topic I try to import from the
college math world, much of which hides behind "calculus mountain",
a killer peak most have to climb before they're even told "abstract
algebra" exists.  Yet so much fun could be had, so much cavorting,
if we could just play with "math objects" that play in groups.

http://www.4dsolutions.net/ocn/flash/group.html  (annoying noise!)

Another definition of a Caesar Code (Nero Code?  Hadrian Code?)
allows these codes to be completely random, though still one-to-one
of course, and includes the space character as another one to
encode, makes it all seem the more cryptic cuz of the wrecked
word boundaries.

So what if a student hasn't used dictionaries yet, or has only just
discovered them, and sticks with indexed strings, as your hints
suggest.  Coming back to the same problem later, newly armed
with a dictionary, list comprehensions, maybe the whole exercise
seems easier and more concise?  Don't wanna get *too* concise.

Example

IDLE 2.6.4

>>> from string import lowercase as lowers; from random import shuffle

Get lowercase a-z plus space character

>>> thechars = lowers[:26]+" "

>>> def makekey(instring):
thecopy = list(instring)
shuffle(thecopy)
return dict(zip(list(instring), thecopy))

Build the secret key with thechars, get back a dictionary:

>>> coding = makekey(thechars)

>>> coding
{' ': 'g', 'a': 'x', 'c': 'w', 'b': 'c', 'e': 't', 'd': 'n', 'g': 'h',
'f': 'm', 'i': 'j', 'h': 'k', 'k': 'a', 'j': 'o', 'm': 's', 'l': 'u',
'o': 'p', 'n': 'l', 'q': 'y', 'p': 'z', 's': 'f', 'r': 'b', 'u': 'q',
't': 'i', 'w': 'e', 'v': ' ', 'y': 'r', 'x': 'd', 'z': 'v'}

Define encoding and decoding functions, then test them.  Pass through
any letters not in the key:

>>> def encode(phrase, secretkey):
output = ''
for char in phrase:
output += secretkey.get(char, char)
return output

>>> def decode(phrase, secretkey):
output = ""
reverselookup = dict((value, key) for key,value in secretkey.items())
for char in phrase:
output += reverselookup.get(char, char)
return output

>>> p = "Able was I ere I saw Elba"

>>> e = encode(p, coding)
>>> e
'AejlgfwtgIglclgIgtwfgEjew'

>>> decode(e, coding)
'Able was I ere I say Elba'

My propensity, coming from a math teaching perspective, is to look
at a Python module as a "fish tank" with multiple mouths to feed,
i.e. I like to publish a simple API and feed arguments to functions
(other denizens) directly, sans raw_input prompts.

This more directly corresponds to the idea of a grab bag of tools,
a library, whereas a raw_input cycle more corresponds to polling
in a GUI, staying alert for user inputs.

Both modalities make a lot of sense, so I'm not saying I wouldn't
go with raw_input sometimes -- I know students like being prompted,
even by their own code.

Sometimes I even use text menus with switching. :)
http://www.4dsolutions.net/ocn/pymath.html  (example at the end).

Didn't see whether some of your challenges drop the raw_input
to seem more like libraries, or whether you ask for a menu.  Another
thing is to ask for command line arguments and use sys.args
-- so much fun, we might have, eh?

Anyway, we're all aware of these possibilities -- just thought I'd
remind myself of some of them.

Again:  reassuring to see the broad-based examples.

Hitting the same challenge multiple times, but with new tools
and/or concepts each time, is what many teachers call
"spiraling" as you likely know.

Pre-written code may be called "scaffolding" if you wanna
sound like you know the shoptalk.

In the high school math teaching world, John Saxon is often
cited for making especially strategic use of "spiraling"
although

Re: [Edu-sig] TurtleArt, Etoys, Scratch, GameMaker

2010-03-10 Thread kirby urner
On Tue, Mar 9, 2010 at 11:11 AM, Daniel Ajoy  wrote:
> Comparison between TurtleArt, Etoys, Scratch, and GameMaker, on how they 
> represent basic math concepts:
>
> * Negative Numbers (the number line)
> * Equality
> * Assignment
> * Binary arithmetic operator, addition
> * Decimal Numbers
>
> http://tonyforster.blogspot.com/2010/03/programming-and-mathematics.html
>

Thanks for posting to edu-sig Daniel.

We could use a lot more of this kind of literature.  This guy in
Austrailia is lightyears ahead of most bloggers I've read.  I note
MariaD has already posted her appreciative comments.

That's Maria Droujkova, salonstress for our Elluminate session the
other evening, twixt the functional programmers and a couple
imperative types.

http://mybizmo.blogspot.com/2010/02/learning-on-line.html

( Maria reminds me of Romany Marie, Queen of Greenwich Village:

http://coffeeshopsnet.blogspot.com/2009/03/serving-buzz.html  )

On the topic of turtles, I'm using them to draw plane-nets in this post:

http://mathforum.org/kb/message.jspa?messageID=7007687&tstart=0

They also come forward as illustrative of the object (instance) versus
type distinction, which is just a hair's breadth different from the
old philosophical distinction between ideal forms and their temporal
expression.**

If you scan the above post to math-teach, you'll see this passage,
especially apropos to threads here on edu-sig:

"""
> [b] Note that [2] is a discrete concept more or less, [3] is continuous MOL.
>

OK to play it this way. Length may be developed more discretely
if we need to. The literal pixels and voxels are discrete. Digital
computers, implementing these turtles, use discrete math.

This was one of my beefs with calling it Discrete Math instead
of Digital Math originally (talking about Track 2): they might
keep us from working with polyhedra if we called it discrete,
because polyhedra used to be considered "perfectly continuous
solids".

Giving them a purely digital treatment, on the other hand, such
as by rendering them with a ray tracer (POV-Ray), would not
bring us into conflict with those protecting Discrete Math from
"alien" topics. Digital Math would embrace Polyhedra.

As it turns out, you're able to get Polyhedra into discrete math
via graph theory (polyhedra (as wireframes) are simply graphs).
Litvins Math for the Digital Age has V + F == E + 2 in one
section, though most of its graphs are planar, like plane-nets.

In other words, my fears we're ill-founded and we'll be able
to make do with a Discrete Math labeling for Track 2. YMMV.
"""

Autobio:

For those of you just joining us, I'm a long-time activist on edu-sig
with my own quirky agenda:

0. to advance more computer programming in the context of high school
math learning especially (I used to be a high school math teacher,
after working under Dr. Rorty on the Wittgenstein stuff (he coined the
term "linguistic turn"), later at McGraw-Hill in computer literacy,
more recently a trainer with Saturday Academy (saturdayacademy.org),
attending that luncheon tomorrow @ Oregon Zoo (no kidding));

1. to advance a streamlining approach to polyhedra based on what I
sometimes call "tetrahedral mensuration" inheriting from the work of
an American Transcendentalist philosopher some of you may have heard
of, but thought he was an architect.  To this end, I've been using
Python + VPython, and Python + Povray especially.

I've been a controversial figure in the Python community, consider
myself lucky and privileged to be with PSF.  Chairman Steve and I did
some great work during Pycon 2009, however I missed Pycon 2010
entirely, needing to mind the fort in my zip code area (97214).  My
company, 4D Solutions, sponsors the Oregon Curriculum Network, which
has championed Python for some decades.  Check:
http://www.4dsolutions.net/ocn/cp4e.html



Kirby


> ___
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>

**  Do I think the object oriented shoptalk "just happens" to sound
philosophical by accident?  Does anyone I wonder?

On the contrary, isn't it obvious that OO was deeply embedded in
ordinary language to begin with?  We already think in terms of
"things" with behaviors and attributes.  We already think in terms of
the generic dog or horse (as a concept), versus the individual
manifestations of this animal, each in its own time and place.

Since the so-called "linguistic turn" in philosophy, we're respectful
of the "ordinary language" roots of anything -- a pretty radical
change from the old days, when "meta-physicians" ruled the roost.

( I should reintroduce myself as some guy who studied Wittgenstein's
stuff at Princeton.  Gregor, our resident turtle-meister (Standard
Library) has sent me some links about that, such as to pictures of the
house Wittgenstein designed in Vienna, for his sister I think it was.
Very austere and simple, not unlike his writing in some ways. )
__

[Edu-sig] Fwd: [pinoy-python-users] Dreampie - a new graphical shell for Python

2010-03-03 Thread kirby urner
Anyone here on edu-sig have experience with the product below
(appended from user group traffic)?

I've been away on math-teach duty, expostulating on tetrahedral
mensuration again, the intersection with Python + VPython (or Python +
POV-Ray) being polyhedra, vector objects etc.

http://mathforum.org/kb/thread.jspa?threadID=2047973&tstart=15

I don't get coherent / articulate objections to these proposals, so
it's not like I'm countering specific arguments.  The National Council
of Teachers of Mathematics seems to have come around.

http://www.bfi.org/our_programs/bfi_community/synergetics/synergetics/nctm_embraces_synergetics

math-thinking-l has gone back to sleep.

This essay remains one of my strongest, re a type-based
object-oriented approach to algebra (what the functional programmers
will probably want to shoot down):

http://mathforum.org/kb/message.jspa?messageID=6992862&tstart=0

Today's concern is how to counter the stereotype of Computational Math
as purely sedentary.

Doing mathematics and doing physically strenuous activities should not
always been considered opposite ends of the spectrum.

Kirby



-- Forwarded message --
From: JM Maranan 
Date: Wed, Mar 3, 2010 at 6:00 PM
Subject: [pinoy-python-users] Dreampie - a new graphical shell for Python
To: Pinoy-Python-Users 


Just found out a new Python shell from the mailing list. Here is a
feature in a breeze from the author himself

I'm pleased to announce DreamPie 1.0 - a new graphical interactive
Python shell!

Some highlights:

* Has whatever you would expect from a graphical Python shell -
attribute completion, tooltips which show how to call functions,
highlighting of matching parentheses, etc.
* Fixes a lot of IDLE nuisances - in DreamPie interrupt always works,
history recall and completion works as expected, etc.
* Results are saved in the Result History.
* Long output is automatically folded so you can focus on what's
important.
* Jython and IronPython support makes DreamPie a great tool for
exploring Java and .NET classes.
* You can copy any amount of code and immediately execute it, and you
can also copy code you typed interactively into a new file, with the
Copy Code Only command. No tabs are used!
* Free software licensed under GPL version 3.

Check it out at http://dreampie.sourceforge.net/ and tell me what you
think!

Have fun,
Noam

--
You received this message because you are subscribed to the Google
Groups "Pinoy-Python-Users" group.
To post to this group, send email to pinoy-python-us...@googlegroups.com.
To unsubscribe from this group, send email to
pinoy-python-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/pinoy-python-users?hl=en.
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Fwd: python for math

2010-03-01 Thread kirby urner
I hope Mark (not his real name) joins us on edu-sig.  As you will see
below, I'm encouraging him to do so, at which point he might reveal
his true identity.

He teaches AP Calculus and has been experimenting with using Python to
abet student understanding, with mixed results.

Kirby


-- Forwarded message --
From: kirby urner 
Date: Mon, Mar 1, 2010 at 8:47 AM
Subject: Re: python for math
To: mark


Hi [ Mark ] --

I'm not proposing to replace traditional math notation with Python's,
only to have a computer language expressing these same concepts
without too much clutter.

For example, you might implement a simple Polynomial type in
just a few lines of code (pre-written) and have methods for objects
of this type to (a) produce roots (b) multiply together (c) add
together.

You then have the ability to discuss polynomials as "objects" that
add and multiply, like number types.

Here's a clear essay about the approach:

http://mathforum.org/kb/message.jspa?messageID=6992862&tstart=0

To put it simply:  I favor introducing "dot notation" (common to many
computer languages) as just another math notation.

More:
http://www.4dsolutions.net/presentations/p4t_notes.pdf

I'm into spatial geometry a lot, as I think the bigger / sharper screens
(beyond calculator screens) should have lots of Z-axis, i.e. the
depth dimension needs to be there.

Just transferring a lot of flat stuff, not going spatial, is too much of
a psychological let down, given what students already know computers
can do.

I have a simple non-Euclidean geometry I like to get into (simple in the
sense of easy definitions), but that doesn't preclude doing all the usual
stuff, including with XYZ vectors (another type of math object, easily
expressed in Python, and easily rendered to screen using VPython).

FYI here's an interesting text book some of us are using:
http://www.skylit.com/mathandpython.html

This is not a full blown "math objects" approach.  In fact, there's
no real object oriented programming except on page 88-89 (2nd
edition).  For the most part, it's just using Python in place of a
scientific calculator, in hopes of keeping up with the rest of the
world, which is moving in the same direction.

That's what I'd tell parents:  in the real world, computers and
computer programming (including in Mathematica) have far more
currency than scientific calculators.  Used wisely, computer
technology, including with some programming, is likely to
open more doors, give a better sense of more career options,
provide a stronger orientation.

Understanding more about computers and their connection to
math is vital to a "how things work" approach, which emphasizes
explanations of such basic topics as tabulation of data, these
days accomplished with SQL.  Some mention of SQL, even some
use of it (sqlite?), is completely apropos in Computational Math,
but maybe not in an AP calculus course.

Thanks for conversing on this topic.  I encourage you to join edu-sig,
where lots of educators are pondering these very issues.  We've
had recent threads on Sage etc., and are currently discussing the
interface between math and computer science, at the secondary
school level especially.  See the edu-sig page at Python.org for
more info.

http://www.python.org/community/sigs/current/edu-sig/

Kirby


On Mon, Mar 1, 2010 at 7:52 AM,   wrote:
> On Sun, Feb 28, 2010 at 09:44:25PM -0800, kirby urner wrote:
>> Keep in mind that a reading knowledge of a language is far easier
>> to acquire than a "write from scratch on a blank canvas" mode.  If
>> the lesson plan involves eyeballing already written code, making
>> minor tweaks, this is probably going to yield greater results and/or
>> student satisfaction than sitting them down in front of a white screen
>> and saying 'write something that integrates a polynomial'.
>
> You may be onto something here.  Are you saying you'd prefer ALL math concepts
> be introduced in Python code?  That may have benefits.  One potential way you
> could defend that is that you can't be unambiguous in Python.  You *can* with
> classical math notation.  For example, does sin^(-1)(x) mean the "reciprocal
> of the sine function" or the "Arcsin (inverse) function"?
>
> There is a physics book that attempts to do
> something similar with Scheme.  It is called "Structure And Interpretation of
> Classical Mechanics".
>
>
> An innovative curriculum that introduces everything in Python code with 
> objects
> may speed learning.  If parents ask "why better?", I can say it is unambiguous
> compared to classical math notation.
>
> Thanks a 10^6.
>
> [ Mark ]
>
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Pilot testing the new AP CS definition

2010-02-28 Thread kirby urner
Interesting thread.

If CS manages to stop being a mere elective, that would change the
dynamics.

In Oregon, the push is to fold anything worthwhile in CS into math
proper, as at least that counts towards a requirement (3 years of
math), whereas CS is highly dispensable when the budge ax cuts
(as it does so often -- the priority is replacing those helicopter
engines, thanks to sandstorms, am I right?).

If there's an activist CS community working to save this subject
at the high school level, we should learn more from this thread.

I'm pretty sure Singapore is positioned to beat the pants off of
the USA in this area, but I could be wrong.  Some states have
a budget.

Paying attention,

Kirby

On Sun, Feb 28, 2010 at 9:38 AM, Helene Martin  wrote:
> I'm a UW graduate teaching high school CS in the Seattle area.  Larry
> and I are trying to schedule a meeting this week to discuss how we can
> collaborate.  I teach a Python-based course called Creative Computing.
>
> Let me know if there are any messages you would like relayed in
> person.  I'll definitely let him know that there's active interest in
> helping out in this community.
>
> If you're on here, hi Larry. =)
>
> Hélène.
> http://garfieldcs.com
>
> On Sun, Feb 28, 2010 at 7:42 AM, Jeff Elkner  wrote:
>> Potentially important news for Python in education:
>>
>> http://computinged.wordpress.com/2010/02/27/pilot-testing-the-new-ap-cs-definition/
>>
>> I wonder if Larry (http://www.cs.washington.edu/homes/snyder/) would
>> like help in either developing or testing his new course?
>>
>> jeff elkner
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Feb 24 cs-in-math Elluminate meeting (Math 2.0)

2010-02-25 Thread kirby urner
On Thu, Feb 25, 2010 at 8:27 PM, Edward Cherlin  wrote:
> On Thu, Feb 25, 2010 at 19:33, kirby urner  wrote:
>> I briefly blogged about our meeting last night.
>>
>> http://mybizmo.blogspot.com/2010/02/learning-on-line.html
>
> Thank you.
>
>> I posted Ed Cherlin's Chinese + Arabic sig
>
> Japanese/Urdu in language, but you are correct as to writing system.
>

UNICODE
===

Got it, was wondering about that.

Those unicode strings showed up fine in the chat window when I cut and
pasted them, with independent confirmation from a distant reader.

In contrast, my recent unicode tests to the Math Forum show Drexel's
system remembers the entities (the surd and phi symbols in this case)
but doesn't display them.

http://mathforum.org/kb/thread.jspa?threadID=2046042&tstart=0  (fyi)

<< hi Carl >>

> I am a great admirer of the tribe and the languages, although I also
> enjoy the UnLambda language.
>

Yeah, I'm not eager to feud with the Great Lambda tribe, find them
somewhat intimidating.

I get the sense they've been waiting for a place in the sun a long
time, especially when it comes to math teaching.  All these so-called
imperative / procedural languages (Python among them) just getting in
the way, hogging the road.

From that point of view, my OOish type stuff is like a bad dream,
because I'm aiming to perpetuate what's supposed to be shriveling on
the vine around now.

Rex Page really doesn't want people using for-loops to explain Sigma
notation (the greek letter thing), says it takes really advanced
mathematics to intelligently discuss for-loops, so we just shouldn't
do it at the pre-college level.

Maria D., somewhat new to this debate, courageously invited those
present at the meeting last night to dive in on these issues, but we
seemed too preoccupied getting a handle on this form of synchronous
communication (the fancy control panel, the division of roles...).

Rex was at our meeting last night as well.


NUDGING PHILOSOPHERS
=

I've recently gone banging on doors in the philosophy department
suggesting long-simmering debates of this nature should be getting a
hearing in those chambers.

Lets get these ostensibly articulate, widely-read individuals to take
a big picture view and play air traffic controller more successfully.

We need to stop squabbling and give a next generation a better ride.
Better to bring these debates to a head, under expert managers, than
to let them simmer and fester decade after decade.  That just leads to
nothing happening.

In recruiting for this cause, I'm hearkening back to when philosophy
was still proudly a source of overview, was at the apex of the trivium
/ quadrivium (co-piloting with theology), its avatars confidant they
could render their diplomatic services across disciplines where
needed.

I'm overtly nostalgic for those liberal arts values, associated with
the Italian Renaissance in some degree.

In my readings, the great bugaboo we all need to counter is
"over-specialization".

Whereas narrowing one's focus is usually considered a "good thing"
(how one becomes "a professional"), I was signaled to read 'Operating
Manual for Spaceship Earth' at the Woodrow Wilson School of Public
Affairs (where I enrolled in some courses).

Now I'm seeing a big need for "glue languages" performing a role
analogous to Python's in a computerized ecosystem (Python plays well
with others, talks to lots of different software).

Philosophers should consider it a part of their job description to
come up with better glue languages (ones humans might use).  Douglas
Hofstadter has done valuable of work in this direction, with 'Godel
Escher Bach' etc.   And what about Wolfram?

>> The Great Lambda worshipers are a tribe to our north, inherit through
>> LISP, LOGO and Scheme, although that middle language donated its
>> turtle to the OO camp, also working in Ruby right?
>
> And in Turtle Art, written in Python, on Sugar.
>

We have this sort of punk grunge techno-anarchist coffee shop called
Duke's Landing on SE Belmont that's like a HQS for XO activity.
Michael D. is always upgrading his, is now running that Xtra Ordinary
system on one of them.

I contributed an XO to the mix just the other night in fact, in the
context of one of our 'Vegans not Pigs' events (bands get together and
play, then eat vegan food cooked on the premises and marvel at how
affordable that is, only $2 a plate -- but then Evelyn fries up her
chicken as an option, for extra $).

http://www.flickr.com/photos/17157...@n00/4317536243/  (event poster)
http://www.flickr.com/photos/17157...@n00/4374854038/in/photostream/
(XO at Duke's)
http://controlroom.blogspot.com/2010/02/doing-math.html  (event writeup)

My journals and Photostream are full of pro-

Re: [Edu-sig] Django or Web2Py for PyWhip

2010-02-25 Thread kirby urner
On Thu, Feb 25, 2010 at 6:00 PM, DiPierro, Massimo
 wrote:
> Mind that my opinion is biased since I am the author of web2py.

<< snip >>

> I will be happy to answer more specific questions on the topic but I am in 
> India for a physics conference and have limited connectivity. I have to be 
> concise and canno check emails often until Monday. You may want to consider 
> asking for some user experience on the web2py list 
> http://groups.google.com/group/web2py.
>
> Massimo
>

Hi Massimo --

Thank you for jumping in here.

I've seen a web2py demo (by yourself) at a Pycon, impressive.

Note that I'm not involved in this particular GAE project, am only
commenting from a distance.

I don't think the Python community is at a disadvantage just because
there's nothing quite as dominant as Rails has been in Ruby world.

RUBY
=

I did a quick scan for Ruby web frameworks that are *not* Rails and
came up with Sinatra, Ramaze and Merb.

I'm sure I missed some.

SCHEME
===

In Scheme world we have Flapjax (client side), Lylux (pipeline,
controller), Snooze (DBI)

http://www.flapjax-lang.org/

http://blog.plt-scheme.org/2007/08/experience-report-scheme-in-commercial.html

I mentioned Scheme in particular because I've been hanging out with
functional programmers on math-thinking-l recently.

Some of those folks have been reminding me of their low opinion of
anything object oriented, whereas I've been exulting about Python as a
math-learning tool, in part because of its strong concept of types
(dynamic, but not weak):

http://controlroom.blogspot.com/2010/02/new-essays.html
(see essay (b) linked from this blog post if keen to read more)

Scheme and LISP are famously typeless.

Hey, I didn't realize GIMP came with a dialect of Scheme for
scripting, called Script-Fu.

http://docs.gimp.org/en/gimp-concepts-script-fu.html

That's like using LISP to control emacs...

...or like using Ruby to control Google Sketchup.

http://sketchup.google.com/download/rubyscripts.html

AND SO ON...
===

PHP and J2EE still dominate don't they?  I don't have any numbers handy.

Then there's .NET, which might include Python again

On and on it goes, eh?

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] barbie's next career: computer engineer

2010-02-25 Thread kirby urner
http://www.barbiemedia.com/admin/uploads/ComputerEngineerBarbie.pdf

No comment.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Django or Web2Py for PyWhip

2010-02-25 Thread kirby urner
On Thu, Feb 25, 2010 at 4:23 PM, David MacQuigg
 wrote:
> kirby urner wrote:
>>
>> At issue is whether try-over-the-web is a way you need to go, granted
>> other language communities are trying it.
>>
>> You've got Python out of the box if you're a Linux user, and so the
>> question is, if you're not a Linux user, do you even matter?  When it
>> comes to server side architectures, probably not.
>>
>
> The big difference between doing it "in the cloud" and doing it with a
> downloadable app on the student's computer is teacher interaction.  Sure,
> you could do even that with the right kind of networking, but we will still
> need a central server if we want instructors to have a "wide and deep" view
> of the students work in progress, not just a clipping sent in an email.  The
> immediate problem might be difficulties with recursion, but if the teacher
> drills down into the lesson on for-loops and sees some misunderstanding
> there, she might suggest that the student do a few more problems in that
> area first.
>

No argument there, that having a centralized study center will provide
better overview stats.

I'm just skeptical that a web site with the premise "we think you
don't have Python installed, so try it here first" is getting off on
the right foot.



If you're a Morlock, working server-side, you've got Python installed.

If you're Eloi, wallowing in Windows, it's easy enough to get it, and
if you aspire to get into programming, that's a worthwhile first step.



I consider OS X a server side technology even if many OS X users know
next to nothing about programming.

In other words, lets not assume that people come to FlyPy or PyJet
because they don't have a running Python, as that's likely not your
demographic.  They'll have it.

On the other hand, if the message is more like:  "do it here on our
cloud or you won't get academic credit for your work", well, that's
something else and might represent a reasonable instructor demand
(getting everything as email snippets for checking is too much work).

Based on my experiences helping international students, like this guy
in Indonesia (a Facebook friend), it's not that easy sharing source
code, especially when all the variable names are in Indonesian (for
me, that's hard to read).

There's this shared whiteboard we can use, with built in chat, but we
each run our Pythons locally.  Having a shared server in the cloud
that we could both observe and work with, might be just the ticket.

> Here's another scenario.  Imagine a diverse set of students, with an equally
> diverse collection of laptops, desktops, OS's, whatever.  When a student has
> some difficulty with his homework, he presses the HELP button, and within
> minutes a "black belt" PyKata instructor is looking at the student's work,
> and offering advice.  These instructors could be former students making a
> little money as tutors, or just doing it as a favor for their younger
> classmates, or maybe helping the sophomore team get ready for a competition.
>

Finding someone to pair up with so that you don't get lost in some
solo project that no one understands but you is a worthy goal.

If doing your Python in the cloud helps you get expert attention, so
much the better.

> I'm not seeing much downside to doing this as a web app, so I haven't given
> much thought to making it a self-contained downloadable app.
>
> -- Dave
>

>From a student centric point of view, if I'm having trouble with my
Python, where will I go?

Newgroups, user groups, Youtubes, Showmedo, a ton of other places.
Friends.  Associates...

However, if I'm in a class with my peers and we share some
over-the-web infrastructure, maybe that's another good way to get some
help.

Having classmates help one another, not just compete, seems very XP
(extreme programming compatible) and should be encouraged.

If they're already paying tuition, so that your Kata black belt has
somewhere to collect, that's different from anonymous over-the-web
students who've not signed up for any specific course.  Right?

I'm sure you've already considered the angles.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Feb 24 cs-in-math Elluminate meeting (Math 2.0)

2010-02-25 Thread kirby urner
I briefly blogged about our meeting last night.

http://mybizmo.blogspot.com/2010/02/learning-on-line.html

I posted Ed Cherlin's Chinese + Arabic sig as a test of the unicode
interface, even though he couldn't find Elluminate for his distro, so
had to bail.

Maria D. did a good job of hosting, and we were graced with the
presence of one of the Great Lambda heavyweights, Peter Henderson.

http://www.math-in-cs.org/

The Great Lambda worshipers are a tribe to our north, inherit through
LISP, LOGO and Scheme, although that middle language donated its
turtle to the OO camp, also working in Ruby right?

http://www.rubyquiz.com/quiz104.html
http://blog.notahat.com/posts/4

Re:  "Great Lambda worshipers":  talking about the functional
programming camp, not wanting to pollute thinking like a mathematician
with the "mutable variables" of the computer scientists.

Python has "little lambda" (a token lambda).

We seemed pretty much in agreement during this meeting that Computer
Science is going away as a high school discipline, leaving only
Mathematics (cite:  death of CS AP test, only a pale shadow of its
former self).

The only question seems to be whether folding CS into Math means
keeping some programming, or going with the New Zealand unplugged
route (CS on paper).

I'm not sure even New Zealand is going the NZ unplugged route.  Nat
Torkington has a say:

http://nathan.torkington.com/

Lets see how students "vote with their feet" on that one, i.e. it's
not entirely up to the teachers.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Django or Web2Py for PyWhip

2010-02-25 Thread kirby urner
On Thu, Feb 25, 2010 at 12:17 PM, David MacQuigg
 wrote:
> Since we are changing the name of the project from PyWhip to (PyKata,
> PyPractice, PyJet, ???), now might be a good time to reconsider some other
> basic choices.  App Engine seems to be the right choice for the server
> foundation.  Anyone who has tried to develop a web app with modpython will
> appreciate not having to worry about details like keeping track of user
> logins.
>

Word on the street is mod_wsgi is superior to mod_python.  Just
reporting what I hear.

> The one major choice I'm still not comfortable with is the framework Django
> vs. Web2Py.  We are currently using Django, because that was the default
> providcd by App Engine.  Web2Py is also supported by App Engine, but perhaps
> not yet as well integrated (I don't know).  The main issue seems to be
> versatility vs simplicity.  My initial impression is that Django is more
> versatile and Web2Py is simpler.  Django has the bigger community of users,
> more published books, etc., but Web2Py is still early in its growth.
>

App Engine is what's obscure in this picture.  Google didn't take the
world by storm with it, adding Java not helping that much.

Not saying it's not a good product, have written an appengine myself
(osgarden.appspot.com), plus was a tech reviewer for the book by Dr.
Chuck.

> We need a framework which will provide all the features needed for a website
> like JavaBat.com, but will be simple enough that we have no trouble finding
> web programmers to take over when our current developers move on.  I'll let
> the folks who are ready to step up and do the work make the decision, but if
> anyone has any experience, comments or suggestions, now is the time.
>
> -- Dave

At issue is whether try-over-the-web is a way you need to go, granted
other language communities are trying it.

You've got Python out of the box if you're a Linux user, and so the
question is, if you're not a Linux user, do you even matter?  When it
comes to server side architectures, probably not.

That being said, Google Appengine is still a contender, so best wishes
with PyKata or whatever you elect.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Renaming PyWhip

2010-02-24 Thread kirby urner
On Wed, Feb 24, 2010 at 5:52 PM, David MacQuigg wrote:

> PyKata ... YES!! Please don't tell me this means something awful in Korean.
> :>) According to Wikipedia:
>
>   A kata can refer to any basic form, routine, or pattern of behavior
>   that is practiced to various levels of mastery. In Japanese
>   language, kata is a frequently-used word meaning “way of doing
>   things,” with emphasis on the form and order of the process. Other
>   meanings are “training method” and “formal exercise.” The goal of a
>   painter’s practicing, for example, is to merge his consciousness
>   with his brush; the potter’s with his clay; the garden designer’s
>   with the materials of the garden. Once such mastery is achieved, the
>   theory goes, the doing of a thing perfectly is as easy as thinking it.
>
> Practice these problems until you can do them without thinking, at least
> not thinking about syntax. I used to practice Karate, and this fits
> perfectly.
>
> Comments?
>
> -- Dave
>
>
Seems creative and multi-cultural to boot.

Such a name might get the attention of Sara Ford of Microsoft Codeplex (aka
"open source DNA") -- she's really big into Karate.
http://blogs.msdn.com/saraford/default.aspx

Python has always been about bridging multiple ethnicities.  Snake charmers
+ [ fill in the blank ] = coolness.

Kirby
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


<    4   5   6   7   8   9   10   11   12   13   >