Teaching numerics with Python
Fernando Pérez
fperez528 at yahoo.com
Thu Nov 21 12:41:16 EST 2002
Antti Rasila wrote:
> 2) ..if some course material and ready program files are available,
> which we could use as building blocks of our course?
>
You may want to look at IPython: http://www-hep.colorado.edu/~fperez/ipython
I wrote it specifically to do interactive python work for scientific computing
and data analysis. It's a drop-in replacement for the interactive python
shell, but adds a bunch of features inspired by Mathematica, IDL and the
like.
It also wraps and enhances the Gnuplot.py interface. Here's a 'screenshot' of
the steps to make a simple plot:
[~]> ipython -profile numeric
Python 2.2 (#1, Feb 24 2002, 16:21:58)
Type "copyright", "credits" or "license" for more information.
IPython 0.2.14pre48 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
@magic -> Information about IPython's 'magic' @ functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
IPython profile: numeric
*** Type `gphelp` for help on the Gnuplot integration features.
In [1]: x=frange(0,2*pi,npts=100)
In [2]: y=sin(x)
# this plots y vs an integer index through gnuplot. Note the parentheses get
# automatically added to function calls:
In [3]: plot y
------> plot(y)
# this plots y vs x:
In [4]: plot x,y
------> plot(x,y)
# this makes an eps file of the same y vs x plot:
In [5]: plot x,y,filename='test.eps'
------> plot(x,y,filename='test.eps')
Feel free to contact me at fperez[AT]colorado.edu if you have any questions.
Cheers,
f.
More information about the Python-list
mailing list