Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Algebraic Number Theory in Python 3 (github.com/louisabraham)
157 points by Labo333 on Feb 5, 2018 | hide | past | favorite | 26 comments



Nice! Even though this is implemented before, it is easy to read (and if you only need simple functions, downloading Sage is a bit of a overkill (there is an online version of Sage which I used a lot during my PhD though!)).

I like seeing simple implementations of things like this - inspiring for others thinking of similar things!


> (there is an online version of Sage ...)

They are http://sagecell.sagemath.org/ and https://cocalc.com


It seems like this should be a part of Sage rather than a standalone library.


I believe all this functionality is already within sage, except for the Solovay-Strassen primality test.


I don't think Sage has the Jacobi symbol (just the Legendre), but Jacobi and Solovay-Strassen are less than 20 lines.

Anyway, the goal was to provide very simple and readable implementations. Sage is far more powerful.

Also, I think Sage uses square free factorisation algorithms that run much faster than Berlekamp.

Anyway, we had much fun coding that and I really didn't expect to receive so many uovotes!


(I'm the guy who started Sage.) Sage has the Jacobi symbol as of 7 years ago (see https://trac.sagemath.org/ticket/11138 and https://github.com/sagemath/sage/blob/07d6c37d18811e2b377a96...).

Sage is pretty good at primality testing, because PARI is.

I'm really glad that the author of this library is enjoying writing Algebraic number theory that is readable and in Python3. Go for it, and have fun!


No, it's good work. Sage is hard to read, and your code is easy to read. Good job!


Indeed, Sage can be difficult to read, because our primary motivation is speed and scalable to support cutting edge research.

If you don't know about it, you might find https://pypi.python.org/pypi/NZMATH useful; it's BSD-licensed pure python number theory code.


Thanks a lot :)


Isn't Sage just a collection of standalone libraries packaged for easy distribution and that have been made to play nice together.


At the very beginning (back in 2005) it was mostly a distribution, but during the last 12 years an enormous amount of new code (over 500K SLOC) has been written, building on top of that distribution. You can get a sense of the scale and velocity of development here: https://github.com/sagemath/sage/graphs/contributors


No, it has a lot of original code too.


Is the library published on PyPI?


No but you can install any library from github with

pip install --upgrade git+[URL]


You can also publish anything to pypi in like 5 minutes. Go for it.


Yes but I don't want to manage version numbers and release a new one each time I push a commit to my repo. Also anyone can take the code s/he wants directly.

Do you have some kind of automatic pypi release system?


With a bit of twiddling you can get Travis CI to publish to pypi on successful master builds:

https://docs.travis-ci.com/user/deployment/pypi/


Oh nice!


I did it https://pypi.python.org/pypi/algnuth :)

I didn't know it was so important but I learn every day!


Not really what people/mathematicians would generally understand as "algebraic number theory". More like computational number theory or computational algebra.


I think it's OK -- the things he's computing do fall within what mathematicians call "algebraic number theory". (I wrote a book on Algebraic Number Theory: https://wstein.org/books/ant/)


There is also this wonderful collection of Sage examples: http://abstract.ups.edu/download/aata-20160809-sage-7.3.pdf


Wow the adelic point of view is totally new for me!!! I add your book to my bookmarks and will definitely read it.

It's really nice to make a chapter on elliptic curves, it's one of my domains of research (ECC).

I have codes for CRT and Pell's equation as well, maybe I will upload them.


"Origin of the name - In local class field theory, the group of units of the local field plays a central role. In global class field theory, the idele class group takes this role (see also the definition of the idele class group). The term "idele" is a variation of the term ideal. Both terms have a relation, see the theorem about the relation between the ideal class group and the idele class group. The term "idele" (French: idèle) is an invention of the French mathematician Claude Chevalley (1909–1984) and stands for "ideal element" (abbreviated: id.el.). The term "adele" (adèle) stands for additive idele."

https://en.wikipedia.org/wiki/Adele_ring

(Took me a few minutes just to get that - reminder, bring diving gear when venturing into math waters ;-)


Meaty stuff, some problem here displaying inline images of the html, e. g. https://wstein.org/books/ant/ant/img1885.png gives not found.


Indeed :)

But what did you expect when you clicked on a github link?




Consider applying for YC's first-ever Fall batch! Applications are open till Aug 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: