Kirby Urner writes:
My approach has been to look at Python as one more useful tool when it comes to teaching mathematics. Computers, not just calculators, deserve a place in our average math class. Students need better graphing capability and more exposure to symbolic operations than today's calculators provide.
It's a mark of serious over-specialization that we draw such an artificial line between "numeracy" and "computer literacy".
Just because I want to program a computer, doesn't mean I want to be a computer programmer (speaking generally -- in actual fact I pay some of my bills by writing Xbase). For me, CP4E means using Python in a non-CS context.
I strongly agree. CS curricula work is important and probably will give the most benefit in the shortest time but the long term goal articulated by Guido in his CP4E proposal was to enable the routine use of programming as a tool for people who would otherwise be non programmers. The "Everyone" in CP4E doesn't mean that everyone should go into programming as a career. Instead Guido was suggesting that programming should be a basic tool like language and math available to most people. Here is my cut on a possibly worthwhile project: Math and science curricula are obvious starting points and several people here have talked about existing efforts. Simulation models are probably the most fruitful area to consider for basic physics and give a good example of the kind of thing I am suggesting. By this I mean the students define initial conditions of objects and watch what happens to them. They then change initial conditions and try again, observing the differences. I have seen static programs which simulate a predetermined set of behaviors over a small set of parameters selected with sliders and the like. Adding a programming language to expand the range of experimentation would increase the learning opportunities by allowing more arbitrary specification of time varying parameters or parameters that change based on various conditions. In an ideal world the student would be able to set up conditions and conduct experiments that the teacher never though of. In case I am be too abstract let me describe an explicit example: Consider a programming simulation world that follows simple newtonion laws of motion. Include gravity as an option for interest. Throw in elastic and inelastic collisions for good measure. This world would allow simulation of air table experiments, simple parabolic motion and orbital dynamics. Throw in the Bernoulli principal and kids could simulate the behavior of various pitching techniques (sliders etc.) and perhaps even simulate an airplane wing. The initial package would be a general computer simulation environment with basic behaviors built in and various output techniques (3D displays, tables of coordinates for further processing etc.) On top of the basic simulation model (which is written once) would be various predefined worlds aimed at specific lesson plans. These world would be defined by python programs and packages. Once the simulator is written (that's the hard part) the process of generating a specific set of interesting objects (in python) would be relatively simple. Basic sets would be packaged with the system. Others would develop and share interesting packages and advanced students would create their own. The point is to do the hard part (simulation and 3D representation) once and let the users (students AND educators) experiment and play. Now I could just as well have specified a similar system for investigating wave dynamics or simple machines or optics. This suggests to my thrifty programming soul that there might be another more basic layer, i.e. a generalized simulation engine packaged with a 3D viewer. The first 4 layers of implementation would look something like: python + simulation engine + mechanics + orbital dynamics + 3D representation | | | + air table | | | + parabolic motion of projectiles | + optics + refraction | | | + reflection | + other simulation worlds The 5th layer is the code written by the student. In my diagram each layer is built on top of and uses the facilities of the one to the left. Python would be the implementation language of choice at each layer (including the student layer) unless performance issues drive a different choice. The point is to factor the problem space of things wanting to be taught using software to reduce duplication of effort. It is easier to recruit help to create a simulation engine if many people stand to gain for many end uses. It is then easier to solve a particular curriculum problem if most of the basic compunents already exist. It is the sharability that I am trying to suggest. Maybe it should be broken down differently. Lots of people have solved parts of this problem for specific classroom applications. I think it is time to generate common tools that are easier to port/steal for other problems. I know I am talking about a moderately big project (although not as big as you might think, and much of it might already be available) with a longer payback cycle and will likely get snide comments about vaporware, however I think it is worth some thought. It will certainly never happen if it doesn't get discussed. If it gets beyond discussion into some specific proposals I am willing to help.
Steve Morris writes:
I know I am talking about a moderately big project (although not as big as you might think, and much of it might already be available) with a longer payback cycle and will likely get snide comments about vaporware, however I think it is worth some thought. It will certainly never happen if it doesn't get discussed. If it gets beyond discussion into some specific proposals I am willing to help.
I don't have any problem with such brainstorming myself -- sounds like you'd be able to make a serious dent in such a project. Another approach is to use Python code to dissect this whole notion of object-based simulations. Write some simple "cave paintings" that give the _idea_ of how a simulation is designed and built, one that actually runs somehow -- but doesn't do anything super fancy. Then turn to other off-the-shelf software for the jazzier simulations, including even SimCity and SimAnt. Maybe view a documentary on airplane design and see how real engineers use a combination of computer models, wind tunnel experiments or whatever it is they do. After all, we're just physics students here, not airplane engineers. Bernoulli's principle is what's important to us, not the nitty gritty of real world wing design. In this scenario, the role of Python is to "sketch" ideas about simulations, about objects, to provide clear windows into a world of much greater complexity. But you maybe don't actually need to write any new "bouncing molecules" application -- because maybe you find Java applet that does this already and play with that. On the other hand, I think what students _really_ need to understand (and don't, for the most part) is that "collision detection" is a generic problem which many have tackled. So learn enough relevant concepts to be able to poke around in a website like: http://www.win.tue.nl/cs/tt/gino/solid/ Get the flavor of that world, the fact that we have all these algorithms already out there. The goal is really _reading comprehension_: the ability to scan websites such as the above and not disconnect, not throw up your hands and say "oh god, I'll _never_ understand _any_ of this". On the contrary, you're getting more confidant around this kind of stuff by the day (our curriculum is working). My sense is that we're already awash in exciting, usable software. There's just a ton of stuff out there. What's missing is a graduated, user-friendly on-ramp that makes a lot of this stuff clear _conceptually_. The bottleneck is not in the raw materials department, but in the lack of good, clear curriculum materials which take advantage of our embarrassment of riches. We're awash in goodies, but at a loss about how to integrate them _conceptually_ -- because over-specialized approaches have such a strangle-hold these days. I think Python has the potential to help us elucidate what's going on in the guts of our simulations, whether or not those simulations are actually written in Python or not. Plus, as a kind of algorithm-specifying notation, we can write very simple executables to spell out a lot of basic math ideas. For example, below is something I wrote just now to generate a list of prime numbers. It's the age-old Sieve of Eratosthenes (circa 200 BC). We teach this stuff anyway. I'm sure others posting to this list have done lots of similar experiments. It'd be good to start building a library of modules that classroom teachers and/or home-schoolers (of any age group) could use (in part simply as examples to get them going -- as more teachers warm to the idea of Python in the classroom, they'll start "rolling their own"). I'm looking for ways to get the snowball rolling. Then it'll just get bigger as it gathers momentum. Kirby MODULE: seive.py primes = [2] # dynamic list of primes def get2nb(nbprimes): # return list of primes # nbprimes = number of primes to list global primes # keep at module level for re-use # chop the list if already longer than we need if len(primes)>nbprimes: primes = primes[:nbprimes] # start with highest prime so far i = primes[-1] while len(primes)<nbprimes: if addprime(i): primes.append(i) # skip even numbers (only 2 is prime) if i==2: i=i+1 else: i=i+1 return primes def addprime(n): # internal seive to check whether a number is prime verdict = 1 # default is "yes, add to list" for i in primes: if (i==n) | (n%i == 0): # is prime or no remainder verdict = 0 # so we _don't_ want to add break if i**2 > n: # stop trying to divide by break # lower primes when p**2 > n return verdict In action:
reload(seive) <module 'seive' from 'G:\Python\seive.py'> seive.get2nb(10) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] seive.get2nb(5) [2, 3, 5, 7, 11] seive.get2nb(30) [2, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109]
At 04:59 PM 02/11/2000 -0800, Kirby Urner wrote: Kirby -- your program worked nicely on my Red Hat box. I'd like to try writing a program that outputs music through the computer case's built in speaker. Does anyone know of a python command to output a frequency to the built in speaker, or do you know an OS call to do it? Thanks Steve Steve Litt Webmaster, Troubleshooters.Com http://www.troubleshooters.com slitt@troubleshooters.com
MODULE: seive.py
primes = [2] # dynamic list of primes
def get2nb(nbprimes): # return list of primes # nbprimes = number of primes to list
global primes # keep at module level for re-use
# chop the list if already longer than we need if len(primes)>nbprimes: primes = primes[:nbprimes]
# start with highest prime so far i = primes[-1]
while len(primes)<nbprimes: if addprime(i): primes.append(i) # skip even numbers (only 2 is prime) if i==2: i=i+1 else: i=i+1
return primes
def addprime(n): # internal seive to check whether a number is prime
verdict = 1 # default is "yes, add to list"
for i in primes: if (i==n) | (n%i == 0): # is prime or no remainder verdict = 0 # so we _don't_ want to add break if i**2 > n: # stop trying to divide by break # lower primes when p**2 > n
return verdict
In action:
reload(seive) <module 'seive' from 'G:\Python\seive.py'> seive.get2nb(10) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] seive.get2nb(5) [2, 3, 5, 7, 11] seive.get2nb(30) [2, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109]
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://www.python.org/mailman/listinfo/edu-sig
Here's a new web page with some embedded Python. Mostly math, with Python used in that context (as an alternative notation). The page isn't about teaching Python per se, but the examples given are syntactically simple enough to promote learning. See: http://www.inetarena.com/~pdx4d/ocn/numeracy0.html Kirby
Hello all! I've been following this list for a while now, but must admit I've been a bit happy with the D-key in pine :-) So this might have come up already, altough I didn't find any references in the archives. If this is the case, kick me! I'm using Python as the programming language when introducing our university students to make small chemistry-related proggies. Most of them have never programmed before, and I must say the reception of Python has been good; seems quite easy to get into it, even if there is no separate programming course. The excersises are just part of ordinary (physical) chemistry courses and the students have to learn the basics of programming in about 2 hours. Which they apparently do! Anyway, the biggest problem the students seem to have when programming on their own, is to find their programming errors (bugs). And almost everyone has said that the error messages Python produces are cryptic. And I must agree, they are not that descriptive. So better error messages would be a very good way to make the learning process even easier, without compromising any compatibility with earlier code. For the interested, the excersises and solutions can be found at http://www.helsinki.fi/~mpjohans A word of warning though, they are in swedish :-) Have a nice day, Mikael Johansson University of Helsinki Department of Chemistry mikael.johansson@helsinki.fi
Anyway, the biggest problem the students seem to have when programming on their own, is to find their programming errors (bugs). And almost everyone has said that the error messages Python produces are cryptic. And I must agree, they are not that descriptive. So better error messages would be a very good way to make the learning process even easier, without compromising any compatibility with earlier code.
Mikael, This is good information. It would be even better if you could recall and post some examples of code written by students that elicited cryptic (in their eyes) error messages. Do you have any examples? Even if you have to reconstruct samples from memory it would be helpful! Others too -- if you see a poorly worded or otherwise undecipherable (for a beginner) error coming from Python, let me know! --Guido van Rossum (home page: http://www.python.org/~guido/) (Yes, I'm back. Glad we're all still on speaking terms. :-)
On Tue, 15 Feb 2000, Guido van Rossum wrote in a reply to me:
Anyway, the biggest problem the students seem to have when programming on their own, is to find their programming errors (bugs). And almost everyone has said that the error messages Python produces are cryptic. And I must agree, they are not that descriptive. So better error messages would be a very good way to make the learning process even easier, without compromising any compatibility with earlier code.
Mikael,
This is good information. It would be even better if you could recall and post some examples of code written by students that elicited cryptic (in their eyes) error messages. Do you have any examples? Even if you have to reconstruct samples from memory it would be helpful!
Well, this is fresh in mind from yesterday: T=500 # Temperature (K) l=350 # Wavelength (nm) ro=(8*pi*h*c)/(l**5)*(1/(exp(h*c/(l*k*T))-1)) in the above example h, c and k have their normal SI-values. Anyway, this produces a "OverflowError: integer pow()" which can be quite misleading when there is no pow() on the line (** instead). Other overflow errors like "math range error" can also be hard to get. (For the interested: The error in the above code was to give the wavelength in nm, instead of m, and the code calulates the energy density at a given temp and wavelength for black-body radiation according to the Planck distribution function) The "best" example from yesterday was however "number coercion failed" which I was unable to reproduce right now, don't remember what needed to be fixed. Other common comfusing error messages state that there is something wrong with a line of code when in fact the error is somewhere else, like on the preceding line. There are more (and even better) examples, but my memory is, sad enough, exactly what it used to be :-) I'll post more when I have something to say. Have a nice day, Mikael J.
On 15 February 2000, Guido van Rossum said:
Others too -- if you see a poorly worded or otherwise undecipherable (for a beginner) error coming from Python, let me know!
At the risk of contributing to another geek-oriented thread (as opposed to educator-oriented), let me just say that my least-favourite Python error message is "SyntaxError: invalid syntax", which somehow manages to be both overly terse and redundant at the same time. As long as I'm picking nits without making any constructive contribution, how about:
4 + "foo" Traceback (innermost last): File "<stdin>", line 1, in ? TypeError: number coercion failed
...wouldn't it be nicer to say "can't add string and number"? (I'm coming at this from a usability perspective, not from an implementation perspective -- which means I'm allowed to make unrealistic requests!) And when I reverse the arguments, I get a somewhat more useful message:
"foo" + 4 Traceback (innermost last): File "<stdin>", line 1, in ? TypeError: illegal argument type for built-in operation
...but it would be nice to know *which* built-in operation is causing the problem, e.g. "illegal argument type for addition operation". Come to think of it, shouldn't that be "illegal argument types"? After all, both string and integer are legal argument types for addition -- it's just the combination that's illegal. It might be a useful exercise for someone to hang onto "first pass" Python programs written by novices to see what kind of errors happen most frequently, which error messages are most confusing, and work on those. Greg
participants (6)
-
Greg Ward -
Guido van Rossum -
Kirby Urner -
Mikael Johansson -
Steve Litt -
Steve Morris