tags:

views:

94

answers:

2

Pari/GP is an excellent library for functions relating to number theory. The problem is that there doesn't seem to be an up to date wrapper for python anywhere around, (pari-python uses an old version of pari) and I'm wondering if anyone knows of some other library/wrapper that is similar to pari or one that uses pari.

I'm aware of SAGE, but it's far too large for my needs. GMPY is excellent as well, but there are some intrinsic pari functions that I miss, and I'd much rather use python than the provided GP environment. NZMATH, mpmath, scipy and sympy were all taken into consideration as well.

On a related note, does anyone have any suggestions on loading the pari dll itself and using the functions contained in it? I've tried to very little success, other than loading it and learning about function pointers.

+1  A: 

Cython is the way to go if you want to wrap a C library with any sort of not being awful. ctypes is too primitive, and SWIG makes messy code.

Ignacio Vazquez-Abrams
A: 

Actually, pari-python works with the latest stable release of PARI. And it is very easy to use:

>>> from pari import *
>>> fibonacci(100)
354224848179261915075
>>> intnum(0,1,lambda x:x**2)
0.3333333333333333333333333333
>>> 
mellit