# PyGiNaC

An interface to GiNaC

PyGiNaC is a Python module that provides an interface to the C++ library GiNaC, which is an open framework for symbolic computation within C++. PyGiNaC is implemented with the help of the Boost.Python library. At the moment, the package is more or less in an "alpha" state, i.e. the GiNaC classes are only partially exposed, parts of regression test suite are unconverted and no actual documentation exists. However, all of this is supposed to change in the future.

The current implementation of PyGiNaC has, up to our knowledge, two predecessors: a version written by Pearu Peterson some years ago, and another one by Ondrej Certik.

Despite of being not-so-complete, PyGiNaC can do some fancy stuff for you. For example, solving a linear system of equations in the Python intepreter can be as simple as

Power series of functions are also handled

Or try a modified version of one of Ramanujan's identities (this example is ripped off from GiNaC's regression test suite)

Above numeric(3,5) is a fraction 3/5.

The current implementation of PyGiNaC has, up to our knowledge, two predecessors: a version written by Pearu Peterson some years ago, and another one by Ondrej Certik.

Despite of being not-so-complete, PyGiNaC can do some fancy stuff for you. For example, solving a linear system of equations in the Python intepreter can be as simple as

*>>> x = symbol('x')*

>>> y = symbol('y')

>>> lsolve([3*x + 5*y == 2, 5*x+y == -3], [x,y])

[, ]

>>> [str(x) for x in lsolve([3*x + 5*y == 2, 5*x+y == -3], [x,y])]

['x==-17/22', 'y==19/22']

>>>>>> y = symbol('y')

>>> lsolve([3*x + 5*y == 2, 5*x+y == -3], [x,y])

[, ]

>>> [str(x) for x in lsolve([3*x + 5*y == 2, 5*x+y == -3], [x,y])]

['x==-17/22', 'y==19/22']

>>>

Power series of functions are also handled

*>>> x = symbol('x')*

>>> print sin(x).series(x==0, 8)

1*x+(-1/6)*x**3+1/120*x**5+(-1/5040)*x**7+Order(x**8)

>>>>>> print sin(x).series(x==0, 8)

1*x+(-1/6)*x**3+1/120*x**5+(-1/5040)*x**7+Order(x**8)

>>>

Or try a modified version of one of Ramanujan's identities (this example is ripped off from GiNaC's regression test suite)

*>>> e1 = pow(1 + pow(3,numeric(1,5)) - pow(3,numeric(2,5)),3)*

>>> e2 = expand(e1 - 10 + 5*pow(3,numeric(3,5)))

>>> print e2.expand()

0

>>>>>> e2 = expand(e1 - 10 + 5*pow(3,numeric(3,5)))

>>> print e2.expand()

0

>>>

Above numeric(3,5) is a fraction 3/5.

- last updated on:
- March 26th, 2009, 14:54 GMT
- price:
- FREE!
- developed by:
**Jonathan Brandmeyer**- homepage:
- pyginac.sourceforge.net
- license type:
- GPL (GNU General Public License)
- category:
- ROOT \ Science and Engineering \ Mathematics

#### Add your review!

SUBMIT