Pari Python

Anton Mellit mellit at gmail.com
Sun Oct 28 19:19:10 EDT 2007


> Have you looked at SAGE at all? They already have wrappers for Pari.

Well :) I expected that question. I tried. But the distribution for
windows is so big :( (2GB) and I could not build it on cygwin, where
it is also pretty big. And I so much like pari - it is so light and
simple and still can do almost everything. So my idea is to make
simple module for python so that you don't need to install 2GB program
with 2000 functions where it is difficult to find the one you need,
but just type 'import pari', and then help(pari), and then find a
function like 'ellinit' and create an elliptic curve, or type some
polynomial and factor, or expand some function into power series, or
integrate numerically...

I heard from some people that SAGE is good but i somehow don't
appreciate the approach.

> I don't recommend continuing to modify core parts of Python just for your
> module. It means that you will break other Python modules. If you can't use
> other Python modules with your module, what's the point of using Python at all?

Of course you don't have to replace ** with ^ or making that hack with
division. The module would work with or without these changes. But I
think every mathematician agrees that x**2 is really ugly. It is so
often I have to type something like
(1+x)*(1+x^2)*(1+x^3), compare with (1+x)*(1+x**2)*(1+x**3)
or some polynomial (compare 1+x+x^2+x^3 and 1+x+x**2+x**3)
The same thing about the division. Having to write R*1/2 (where R
equals to one, but the type of R is the new number type) is also ugly.
If you write a program you don't have to do it too often, but if you
work 'interactively' then you have to type it more often, then read
the result from screen, or copy-paste a formula from somewhere.

And I think (correct me if I am wrong) that the ^ operator (xor) is
used very very infrequently. And it is not difficult to replace all ^
with say ^^. The division is probably used more often, but python has
this trend anyway - to replace division with 'true' division, so
people should use // when they divide integers and expect an integer.

Other than these two things (the second one does not require
recompilation, so it is not so bad probably) I don't need any changes
to python core. I agree that a standard must be standard.

Anton



More information about the Python-list mailing list