We're considering this book for adoption in a second year programming course for Engineers:
Numerical Methods in Engineering with Python by Jaan Kiusalaas http://www.amazon.com/Numerical-Methods-Engineering-Python-Kiusalaas/dp/0521852870 Steven Bird http://www.csse.unimelb.edu.au/~sb/ On 3/11/08, Warren Sande <[EMAIL PROTECTED]> wrote: > > David, > > For output graphics, you might want to have a look at Pygame. It is a > wrapper for the SDL library. It has functionality for creating graphics > windows, drawing, sprites, etc. But what might be of interest for you is > the simple set_at(x,y) method, to set the color of individual pixels in a > window. > > I have found the Pygame documentation to be pretty good. > > Here is a simple example of plotting a sinewave using set_at() > > #----------------------------- > import pygame, sys, math > screen = pygame.display.set_mode([640,480]) > for x in range(0, 640): > y = int(math.sin(x/640.0 * 4 * math.pi) * 200 + 240) > screen.set_at([x, y],[255,0,0]) > pygame.display.flip() > while True: > for event in pygame.event.get(): > if event.type == pygame.QUIT: > sys.exit() > #------------------------------ > > Warren Sande > > > ----- Original Message ---- > From: David MacQuigg <[EMAIL PROTECTED]> > To: edu-sig@python.org > Sent: Monday, March 10, 2008 10:28:21 PM > Subject: [Edu-sig] Introducing Python to Engineering Students > > I've been asked to give an intro to Python for a freshman class with 150 > students at University of Arizona. The class is taught in the Electrical > and Computer Engineering Department, and is titled Computer Programming for > Engineering Applications. The language is C (Hanly & Koffman, Problem > Solving and Program Design in C). > > I think a nice way to do this will be an application where we can show the > advantages of both languages - the computation of Mandelbrot images > http://en.wikipedia.org/wiki/Mandelbrot_set. Python will > provide the high-level "glue" which brings everything together in a nice > programming environment, and C will provide the raw power for the loop that > actually computes the pixels. My initial tests show this loop running about > 100 times faster in C than in Python. > > The challenge is to do this without overwhelming the students. The plan is > to make everything as simple as possible, just follow the instructions, > except the loop itself, which the students will write in C, based on what I > have written in Python. See > http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mbrotHW.html. > > Suggestions are welcome. Has anyone done something like this before? Can > you improve on my code (I'm not a Python expert), or even suggest something > entirely different? > > There is one major piece I would like to add to what I have so far - output > graphics. This demo would really be cool if the students could see these > glorious images appear on their screen instead of an array of numbers. I > looked at the Python Imaging Library > http://www.pythonware.com/products/pil/index.htm, and I > don't see any examples that I can work from in converting an array of > numbers into an image, just a lot of dense reference material that assumes I > already know these image data formats. Maybe there is a simpler way. Help > from someone with experience in Python graphics would be most appreciated. > > -- Dave > > > > _______________________________________________ > 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 mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig