Python

Páginas: 22 (5446 palabras) Publicado: 18 de diciembre de 2012
Scientific Computing in Python
Konrad Hinsen Laboratoire de Dynamique Mol´ culaire e Institut de Biologie Structurale – Jean-Pierre Ebel 41, av. des Martyrs 38027 Grenoble Cedex 1, France hinsen@ibs.fr 14 October 1997

1

Contents
Packages and programs used in this tutorial Interactive Python: the ultimate desk calculator Scientific data types and functions Numbers . . . . . . . . . . . .Geometry . . . . . . . . . . . Arrays . . . . . . . . . . . . . Linear Algebra . . . . . . . . Fourier Transforms . . . . . . Statistics . . . . . . . . . . . . Parameter fitting . . . . . . . . Interpolation . . . . . . . . . . Define your own data types . . Getting data into and out of files Output formatting . . . . . . . Parsing input files . . . . . . . Fortran-style fixed-format files Binary files .. . . . . . . . . Standard file formats . . . . . netCDF files . . . . . . . . . . 2 3 3 4 5 8 9 10 11 11 12 14 15 17 17 19 19 21 21

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

.. . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

Plotting and visualization 23 Plottingvia Gnuplot . . . . . . . . . . . . . . . . . . . . . . . . . 23 Visualization with VRML . . . . . . . . . . . . . . . . . . . . . . 23 Interfacing to external programs and subroutine libraries 26 Wrapping external programs . . . . . . . . . . . . . . . . . . . . 26 Wrapping libraries by C extension modules . . . . . . . . . . . . 28 Writing C modules for efficiency . . . . . . . . . . . . . . . .. . 31 Scientific libraries and applications 32

2

Packages and programs used in this tutorial
This tutorial uses the following packages in addition to the standard Python library: The Python numerics extension (aka NumPy) was written by Jim Hugunin and is available from http://www.sls.lcs.mit.edu/jjh/numpy/. It contains the modules Numeric, LinearAlgebra, and FFT. The module real thatimplements unlimited-precision real number was written by Jurjen N.E. Bos and is available from http://www.python.org/ftp/python/contrib/Math/real-accurate.pyar. The netCDF interface module is available http://starship.skyport.net/crew/hinsen/netcdf.html from

A collection of scientific modules is available from http://starship.skyport.net/crew/hinsen/. It contains all the other non-standard modulesused in this tutorial. The utility programs mentioned are The Simplified Wrapper and Interface Generator (SWIG), written by David Beazly, is available at http://www.cs.utah.edu/˜beazley/SWIG/swig.html.

Interactive Python: the ultimate desk calculator
Interactive use is very important in scientific computing. Recommendations: For Emacs users: use the special Python mode for convenient interactivework. The graphical user interface PTUI provides similar services without Emacs. Prepare an “interactive” module which imports everything you typically need (e.g. “from Numeric import *”) and have it loaded automatically for interactive sessions.

3

Scientific data types and functions
Scientists work with descriptions of real-life objects and with mathematical abstractions. Both can berepresented by special data types. Real-life objects: Physics: electrons, atoms, crystals, wave functions Chemistry: molecules, orbitals Biology: proteins, cells, plants, animals Meteorology: atmosphere General: experimental setups, lab equipment Mathematical abstractions: Numbers: integers, quaternions, intervals Geometric: lines, vectors, transformations Algebraic: matrices, groups Mappings:...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Python
  • Por Qué Python?
  • PYTHON
  • python sonido
  • python
  • python
  • Python
  • Python

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS