Swiginac Homepage

Swiginac

Latest news

April 15, 2009
Version 1.5.1 of swiginac released. From now on, the version number corresponds to the GiNaC version it is made for.
December 3, 2007
Version 1.0.0 of swiginac released. This version works with GiNaC version 1.4 or later.
February 13, 2007
Version 0.9.5 of swiginac released. Exceptions are now caught to prevent user errors from terminating Python sessions. Also, matrices are automatically evaluated, and the swiginac tutorial is included.
February 9, 2007
Added Günter Milde's swiginac tutorial.
November 28, 2005
Version 0.9.4 of swiginac released. Bug fixes in swiginac, new features in Symbolic.
November 17, 2005
Version 0.9.3 of swiginac released. New features added to both swiginac and Symbolic.
November 13, 2005
Version 0.9.2 of swiginac released.
November 9, 2005
Version 0.9.1 of swiginac released.
September 25, 2005
Version 0.9.0 of swiginac released.
September 21, 2005
Project registered at BerliOS, home page created.

About

Swiginac is a Python interface to GiNaC, built with SWIG. The aim of swiginac is to make all the functionality of GiNaC accessible from Python as an extension module.

Current status is beta; a lot (but not all yet) of the GiNaC classes are exposed, virtually all of the GiNaC tests pass.

For more information, documentation and software downloads, visit our group pages on BerliOS.

Examples

Just a few illustrations from the Python interpreter:

>>> x=symbol("x")
>>> sin(x).series(x==0, 8)
1*x+(-1/6)*x**3+1/120*x**5+(-1/5040)*x**7+Order(x**8)

or

>>> y = symbol('y')
>>> lsolve([3*x + 5*y == 2, 5*x+y == -3], [x,y])
[x==-17/22, y==19/22]

Other Python bindings to GiNaC

According to our knowledge:

  • The first Python binding was pyginac by Pearu Peterson in 2001, done in Boost.Python. There has been no activity in this project since 2001, so we consider it dead.
  • It's successor, also called pyginac, was developed by Jonathan Brandmeyer and later co-authored by Matti Peltom?ki. This version is in alpha stage, still active, also done in Boost.Python.

Why another bindings? Because we found out that it was easier to implement new features using SWIG than using Boost.Python, at least for the authors (one of the authors tried both SWIG and Boost.Python). Instead of implementing new features in pyginac, we found it easier to write the bindings from scratch using SWIG.

The problem with SWIG was, that it didn't used to handle C++ much, but this changed rapidly recently (late 2004 and 2005), so now it is a working alternative to Boost.Python and sip. And honestly, we think the SWIG approach of wrapper code generation is great.

Download

Visit our group pages for software downloads. Additionally, the development code is in the svn repository. You can check it out using this command:

$ svn checkout svn://svn.berlios.de/swiginac/trunk swiginac

You can also browse the SVN online.

Documentation

Günter Milde has made a swiginac tutorial and some basic documentation in the doc/ folder of the SVN repository. Except from this, swiginac is mostly undocumented. To get started, download the latest release and browse the unit tests in tests/swiginac. Also, this presentation of swiginac given at the Fenics'05 meeting in Chicago may be useful.

Authors

Ola Skavhaug, Simula Research Laboratory, Oslo, Norway
Ondrej Certik, Faculty of Mathematics and Physics, Charles University in Prague, the Czech Republic

Help wanted

We could really need a few more developers in the project. If you are using swiginac or GiNaC, know swig, and like hacking, let me know at skavhaug at simula.no.

BerliOS Developer Logo Simula Research Laboratory