Python libraries for number theory

In this forum members can discuss topics about specific programming languages.
Post Reply
eliben
Posts: 1
Joined: Wed Feb 18, 2009 6:40 pm

Python libraries for number theory

Post by eliben »

Hello,

I see that many people use Python for PE. Can you recommend some libraries for number theory, i.e. fast implementations of factorization, primality test, etc?

quilan
Posts: 182
Joined: Fri Aug 03, 2007 11:08 pm

Re: Python libraries for number theory

Post by quilan »

By this point in time, I've just implemented those functions all by hand in a global file I can include as needed. I think this is as well what many other higher members of PE have done as well. It was quite an exercise in learning to work through the theory to come up with a fast implementations for these. I don't believe any of the problems necessitates the use of a compiled library for functions.
ex ~100%'er... until the gf came along.
Image

Ted
Posts: 20
Joined: Sun Apr 02, 2006 10:46 pm

Re: Python libraries for number theory

Post by Ted »

Do a search for ent.py (ent = elementary number theory), SAGE (free math system that you can download or use on-line, created by Dr. William Stein, who earlier developed ent.py routines.) You can also search for Python cookbook. Kirby Urner wrote some useful routines that can be found on-line.

One I haven't used, numpy, is probably useful; it may be accessible via SAGE.

Source code is included, so you can learn from it!

Some wikipedia articles on math contain python snippets.

Caveat: I am not so good at Python or these problems, and just search a lot when I get stuck, more persistence than skil in other words. So experts may improve or disagree with these suggestions.

mastro
Posts: 5
Joined: Fri Mar 27, 2009 6:35 pm

Re: Python libraries for number theory

Post by mastro »

I think NZMATH is pretty good.

http://tnt.math.metro-u.ac.jp/nzmath/

Post Reply