The Azimuth Project
Python (changes)

Showing changes from revision #13 to #14: Added | Removed | Changed

Contents

Idea

Python is a modern general purpose language that has become popular in the context of climate models, which are mostly written in FORTRAN.

This page will concentrate on numerical mathematics and visualization techniques that use Python.

The “reference” Python implementation is sometimes called CPython (because it is written in C). Jython is a version of Python that runs in a Java virtual machine, see Java and Scala.

Using external Packages

In Python a package (or library) can be one of two forms:

  1. Written only in Python (a “pure Python library”),

  2. Written using both Python and low level C code.

In case 1 the library is likely to be usable with a wide range of Python implementations and versions. In contrast, in case 2 because the C code is likely to plug in to low-level details of the CPython implementation (eg, reference counting, etc) a given instance of the library will often only work with a small set of CPython versions. Unfortunately these libraries are not always easy to find, or even available, for a given version of Python. But using tools like easy_install its easier to keep track on what version you need and which ones you have installed.

IDE

Python(x,y) is a free scientific and engineering development software for numerical computations, data analysis and data visualization based on Python programming language, Qt graphical user interfaces and Spyder interactive scientific development environment.Here is a list of standard Plugins, including OpenCV, netCDF and more.

The IDE (integrated development environments) coming from the Java world support Python as well, it is easy to get Netbeans up and running with several different versions of Python for different projects, for example.

Compiling C(++), C, Fortran Modules

It is possible to compile C++ modules and add them to a Python module, which can be called from Python code just like a native Python module. This enables developers to reuse numerical code that has been written in C or C++.

The best way to simplify and also speed up performance is to use Cython instead which automates all of the steps below and is currently the preferred way of using external modules,see Fast numerical computations with Cython in Python. You can get Cython.

If you insist on doing this for yourself instead, here are several tools necessary for this:

  • A C(++) compiler. For Windows, use MinGW. This is a minimal installation of gcc for Windows, without a POSIX emulation.

  • SWIG. This is a code generator tool that will generate C(++) glue code.

  • Distutils from your Python installation. This Python module can be used to compile and add modules to the Python installation.

References

General

General

  • wikipedia: Python , Wikipediacython, pip (package manager for python), SymPy (python library for symbolic computation)

Numerical Mathematics Libraries

Google machine learning projects are mainly written in python. Much of the code now open source:

Numerical Mathematics Libraries

Which NumPy code-base is needed is very heavily dependent on the CPython version installed.

  • Fenics project. A complete library for building CFD applications both linear and non-linear like Navier-Stokes, 3d-diffusion and eg Burgers' equation. It also works with C++. Here is a tutorial and if you grok around on the book page you can download it for free. Here is one solution of Poissons 2-dimensional equation, which I just recolored the scale gradient in ParaView.
Poisson2d

The FEniCS Project is a collection of free software with an extensive list of features for automated, efficient solution of differential equations. Through this web site, you can learn more about the project and learn how to obtain and how to use our software. We’d be delighted to offer support in case you need it, and encourage contributions from our users. It is targeted at turbulence model?. Here is one more example of the nonlinear Cahn-Hilliard equation:

ch3d

SciPy (pronounced “Sigh Pie”) is open-source software for mathematics, science, and engineering. It is also the name of a very popular conference on scientific programming with Python. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation.

  • Sage. Yes you can import sage in your Python program.
  • PyQuante python-based free quantum chemistry package

category: software