Bill Allombert on Fri, 13 Dec 2002 15:59:32 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: MathLink and PARI, part II


On Thu, Dec 12, 2002 at 05:52:26PM -0800, Jeffrey Stopple wrote:
> Hello,
> 
> With advice from David Withoff at Wolfram and Bill Allombert,  I've 
> figured out how to use Mathematica's MathLink capability to install 
> PARI functions in a Mathematica session.   This is a summary with 
> some examples which you can modify.

Thanks a lot for let us know about your success!

> Although error checking is done, the big drawback is that while 
> Mathematica and PARI deal in arbitrary precision reals and 
> arbitrarily long integers, C does not.  The link will crash if some 
> parameter does not fit in a C long.  This could be dealt with by more 
> preprocessing, at the cost of speed.

You can tell gp2c to produce function that take C long instead of pari
integer with the :small tag, e.g.

mykronecker(x:small,y:small)=
{
  kronecker(x,y);
}

Also you should probably write a function that convert PARI integer to
Mathematica integer. You may want to convert them to strings and then evaluate
them.

For example lisexpr("123456789123344679") will build a PARI integer for you.

Cheers,
Bill.