[Edu-sig] Math in a Browser

kirby urner kirby.urner at gmail.com
Wed Apr 8 17:55:55 CEST 2009

On Wed, Apr 8, 2009 at 8:20 AM, michel paul <mpaul213 at gmail.com> wrote:
> SAGE is awesome.  I highly recommend it.  Recently I've been looking at it
> more intently with the idea of using in math classes.

We've been hoping to get the Sage folks from Seattle to present at
PPUG Portland.

One reason I encourage core Python for more elementary courses is I'm
wanting to open a window into the language itself, not an application
written in that language.  "Staying close to the metal" sounds funny
in this context, given it's a VHLL.

That being said, Sage encourages writing in core Python, then working
the API for graphics.  I recommend creating a free user account and
testing it over the web by pulling up some already published
activities e.g.:

v2 of three famous plots of chaos

In terms of selling your department on the relevance of Python to math
learning, I think Sage is a significant asset, something to show and
tell about.

Here's all you need to plot a Mandelbrot set:

#Mandelbrot set: the final plot is a subset of the complex plane;
#the color at point c is porportional to the number of iterations that
#the discrete dynamical system z->z^2+c takes to leave a circle around
#the origin when z0=0

N=int(200)        #resolution of the plot
L=int(50)        #limits the number of iterations
x0=float(-2); x1=float(1); y0=float(-1.5); y1=float(1.5)  #boundary of
the region plotted
R=float(3)        #stop after leaving the circle of radius R
zero = int(0)
for i in range(N):
   for k in range(N):
       c=complex(x0+i*(x1-x0)/N, y0+k*(y1-y0)/N)
       while (h<L) and (abs(z)<R):
matrix_plot(m, cmap='hsv')

That's a lot shorter than my implementation with PIL:


There's also Lorentz Attractor and Feigenbaum diagram, woo hoo!


More information about the Edu-sig mailing list