Python codes

Herman J. C. Berendsen · Cambridge University Press eBooks · 2011

This appendix contains programs, functions or code fragments written in Python. Each code is referred to in the text; the page where the reference is made is given in the header. First some general instructions are given on how to work with these codes. Python is a general-purpose interpretative language, for which interpreters are available for most platforms, including Windows. Python is in the public domain and interpreters are freely available. Most applications in this book use a powerful numerical array extension NumPy , which also provides basic tools in linear algebra, Fourier transforms and random numbers. Although Python version 3 is available, at the time of writing NumPy requires Python version 2, the latest being 2.6. In addition, applications may require the scientific tools library SciPy , which relies on NumPy . Importing SciPy automatically implies the import of NumPy . Users are advised first to download Python 2.6, then the most recent stable version of NumPy , and then SciPy . Further instructions for Windows users can be found at www.hjcb.nl/python. There are several options to produce plots, for example Gnuplot.py , based on the gnuplot package or rpy based on the statistical package “R.” But there are many more. Since the user may find it difficult to make a choice, we have added yet another, but very simple to use, plotting module called plotsvg.py. It can be downloaded from the author's website.

Read the paper · More papers on PaperTik