• Stars
    star
    272
  • Rank 151,235 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Algebraic Number Theory package

travis

Algebraic Number Theory package

Louis Abraham and Yassir Akram

Installation

pip install --upgrade algnuth

or get the development version with:

pip install --upgrade git+https://github.com/louisabraham/algnuth

Features

Jacobi symbol

>>> from algnuth.jacobi import jacobi
>>> jacobi(3763, 20353)
-1

Solovay-Strassen primality test

>>> from algnuth.jacobi import solovay_strassen
>>> p = 12779877140635552275193974526927174906313992988726945426212616053383820179306398832891367199026816638983953765799977121840616466620283861630627224899026453
>>> q = 12779877140635552275193974526927174906313992988726945426212616053383820179306398832891367199026816638983953765799977121840616466620283861630627224899027521
>>> n = p * q
>>> solovay_strassen(p)
True
>>> solovay_strassen(q)
True
>>> solovay_strassen(n)
False

Quadratic forms

>>> from algnuth.quadratic import *
>>> display_classes(-44)
x^2 + 11β‹…y^2
2β‹…x^2 + 2β‹…xy + 6β‹…y^2
3β‹…x^2 - 2β‹…xy + 4β‹…y^2
3β‹…x^2 + 2β‹…xy + 4β‹…y^2
>>> display_primitive_forms(-44)
x^2 + 11β‹…y^2
3β‹…x^2 - 2β‹…xy + 4β‹…y^2
3β‹…x^2 + 2β‹…xy + 4β‹…y^2
>>> display_ambiguous_classes(-44)
x^2 + 11β‹…y^2
2β‹…x^2 + 2β‹…xy + 6β‹…y^2
>>> display(*reduced(18, -10, 2))
2β‹…x^2 + 2β‹…xy + 6β‹…y^2

Real polynomials

>>> from algnuth.polynom import Polynomial
>>> P = Polynomial([0] * 10 + [-1, 0, 1])
>>> print(P)
X^12-X^10
>>> P(2)
3072
>>> P.disc
0
>>> P.sturm() # Number of distinct real roots
3
>>> P.r1 # Number of real roots with multiplicity
12

Modular arithmetic

>>> P = Polynomial([1, 2, 3])
>>> Pmodp = P % 41
>>> print(Pmodp ** 3)
27β‹…X^6+13β‹…X^5+22β‹…X^4+3β‹…X^3+21β‹…X^2+6β‹…X+1
>>> print((P ** 3) % 41)
27β‹…X^6+13β‹…X^5+22β‹…X^4+3β‹…X^3+21β‹…X^2+6β‹…X+1

Polynomial division

>>> A = Polynomial([1, 2, 3, 4]) % 7
>>> B = Polynomial([0, 1, 2]) % 7
>>> print(A)
4β‹…X^3+3β‹…X^2+2β‹…X+1
>>> print(B)
2β‹…X^2+X
>>> print(A % B)
5β‹…X+1
>>> print(A // B)
2β‹…X+4
>>> print((A // B) * B + A % B)
4β‹…X^3+3β‹…X^2+2β‹…X+1

Berlekamp's factorization algorithm

>>> P = Polynomial([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
>>> Pmodp = P % 41
>>> print(Polynomial.ppfactors(Pmodp.factor()))
12β‹…(X+31)β‹…Xβ‹…(X^2+40β‹…X+24)β‹…(X^2+36β‹…X+13)β‹…(X^6+34β‹…X^5+26β‹…X^4+13β‹…X^3+25β‹…X^2+26β‹…X+35)

Unique Factorization of Ideals

>>> from algnuth.ideals import factorIdeals
>>> factorIdeals(Polynomial([4, 0, 0, 1]))
X^3+4 mod 2 = X^3
(2) = (2, Ξ±)^3
X^3+4 mod 3 = (X+1)^3
(3) = (3, Ξ±+1)^3
X^3+4 mod 5 = (X+4)β‹…(X^2+X+1)
(5) = (5, Ξ±+4)β‹…(5, Ξ±^2+Ξ±+1)

More Repositories

1

ffpass

Import and Export passwords for Firefox Quantum πŸ”‘
Python
381
star
2

har2requests

Generate Python Requests code from your browser activity πŸ€–
Python
100
star
3

fastnode2vec

Fast and scalable node2vec implementation
Python
86
star
4

LaBot

Bot Dofus 2 en Python 3
Python
79
star
5

copypasta-data

For anyone who would need copypasta data.
Python
69
star
6

pydivsufsort

Python package for string algorithms ➰
Python
32
star
7

tqdm_joblib

Python
26
star
8

domical

In-browser OCaml notebooks πŸͺ
OCaml
25
star
9

fritm

Cross-platform network reverse engineering framework written in Python 🌐
Python
25
star
10

llama-runpod

Run llama.cpp on RunPod
Dockerfile
20
star
11

mcSATan

A diabolic implementation of mcSAT 😈
Python
11
star
12

litterboxed

Open-source implementation of Letter Boxed
Svelte
10
star
13

my_markdown_resume

Write a decent-looking resume in 5 minutes without knowing LaTeX!
TeX
10
star
14

geopt

Generic Optimization by Genetically Evolved Operation Trees
Python
9
star
15

beep

A cross-platform (Windows, MacOS, Linux) implementation of beep
C
9
star
16

MarsRover

AI controlling a Mars Rover
Python
8
star
17

tomaster

Topological Mode Analysis on Steroids
Python
8
star
18

hash-crypto

Hash-based signatures
Python
6
star
19

DofLog

Python
5
star
20

ubuf

Generate protocols for C++ and JS
Python
5
star
21

matchmaker

Iterate over the solutions to a linear sum assignment problem πŸ‘₯
Python
5
star
22

cfrgame

TeX
4
star
23

kakuro.py

Python
4
star
24

paybybot

Notifications for https://www.paybyphone.fr/
Python
3
star
25

licheat

No more blunders on Lichess
JavaScript
3
star
26

mdp-numba

Simple JIT-compiled implementation of Markov Decision Processes
Python
3
star
27

paybybot2

CLI interface for https://www.paybyphone.fr/
Python
3
star
28

cabret

Various utilities for making bots.
Python
3
star
29

cage

C++ Algorithms for Genetic Evolution
C++
2
star
30

secret-nft

Verifiable encryption in Python and Solidity, using ECC and ZKP
Python
2
star
31

what-the-midi

Work in progress
Python
2
star
32

gpufactor

Factorization algorithms running on GPU
2
star
33

penta.py

Python
2
star
34

chessviz

Visualize chess games β™ŸοΈ
HTML
2
star
35

INF421-project

Group project for the class "Design and Analysis of Algorithms"
Python
2
star
36

docsend-dl

JavaScript
2
star
37

eloh

Send files via hole-punching
Python
2
star
38

duval

Lyndon factorization and smallest rotation πŸͺ’
C++
2
star
39

5BX

Simple app for 5BX
HTML
2
star
40

robot-judge

HTML
1
star
41

e-HealthWorld-2019

talk given on March 26th
PostScript
1
star
42

meingag

Display 9gag posts
Python
1
star
43

pytorch-aarch64

1
star
44

SlitherBot

Bot for slither.io
JavaScript
1
star
45

test

1
star
46

nbconvert_jekyll

Cool features for Jupyter Notebooks with Jekyll
Smarty
1
star
47

ESC-2019

talk given on September 1st at ESC Congress
PostScript
1
star
48

feaml

Jupyter Notebook
1
star
49

pyTIon

Some Python programs to interact with "old" Texas Instrument calculators.
Python
1
star
50

bm2html.py

Export your bookmarks to a html page with a CSS-free treeview.
Python
1
star
51

interval_map.hpp

C++
1
star
52

seguid

SEGUID checksum calculator for biological sequences
HTML
1
star
53

malib

Python
1
star