Numerical Methods in Python
Chris.Barker at noaa.gov
Mon Jun 24 22:39:55 CEST 2002
Russ Dilley wrote:
> My dilemma is that I also have responsibilities in UNIX system
> administration and it seems to me that I might be able to "kill two birds
> with one stone" by learning the Python language. I currently use Perl and
> Shell scripts for system admin tasks and a mixture of FORTRAN, C, MathCAD,
> Matlab, and Excel for numerical work. As you might guess, it tends to get
> confusing constantly jumping from one to another. The syntax and application
> tends to blur and it is somewhat inefficient to "relearn" each to some
> extent whenever I have a new task to address.
> I would like to focus more attention to become proficient with a single
> language and, based on what I've seen, it seems that Python might be
> appropriate for use in system administration AND numerical programming.
Yes, it it good for these tasks. I, and many others, judging by posts to
newsgroups, am using Python for most of the things I used to use MATLAB
for, and also for sys-admin stuff, text file crunching, and developing
GUI programs. One reason I use Python is just what yu stated: I get
confused using too many different languages, I keep getting their syntax confused.
Python with NumPy has many of the advantages and capabilities as MATLAB.
It is weaker in that there are a whole lot fewer bundles libraries of
handy functions, though you can probably fnd much of what you need by
looking around on the web. The performance is similar, if used
similarly, i.e. vectorize!! The other weakness is the lack of well
integrated plotting, but there are a number of packages that will fill
most of your plotting needs, including various GL based 3-d
visualization tools. The primary advantages of Python over MATLAB are:
Much better facilities for non-number chrunching: text file crunching,
GUI development, web development, etc. etc. Python really is a
fabulously general purpose language.
Easier extending with C and Fortran, and with Weave, Pyrex, and
Py_inline, you may not need to.
Cheaper an re-distributable
More platforms supported
NumPy arrays have more data types: sometimes you don't what you use
doubles for everything!
NumPy arrays are N-dimensional, and have "array broadcasting". What this
means is that you can have a (m,1) array for x, and a (1,n) array for y,
and develop functions of x and y that produce an (m,n) array result.
This is a whole lot cleaner an more efficient than all those meshgrid()
cals I used with MATLAB.
Be sure to check out www.scipy.org and good luck!
Christopher Barker, Ph.D.
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Python-list