A software interface for the GiNaC symbolic manipulation system, allowing for efficient manipulation of mathematical expressions and calculations.
To the best of our knowledge, PyGiNaC has two predecessors - one written by Pearu Peterson a few years back and another by Ondrej Certik. Despite not being complete, PyGiNaC can perform some impressive computations. For instance, solving a linear system of equations using the Python interpreter is straightforward, as seen in this example -
>>> 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']
>>>
PyGiNaC also handles power series of functions, as demonstrated below -
>>> 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)
>>>
Moreover, PyGiNaC lets you try out a modified version of one of Ramanujan's identities. As shown below, the example has been ripped off from the 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
>>>
Here, the numeric(3,5) refers to a fraction 3/5.