QiPy is a Python library to work with quadratic integers. Well-known examples are Gaussian integers and Eisenstein integers. Besides, QiPy implements ideals, ideal classes and class groups of quadratic integer rings.
This library has been exhaustively tested with unit tests and property testing.
A complete documentation of QiPy, including examples of all its funcionalities, can be found in the GitHub Page of the repository.
QiPy is written in Python 3 and uses the Python library SymPy. Therefore, Python 3 and SymPy must be installed in your computer.
The easiest way to install QiPy is with pip :
pip3 install qipy
>>> Zi = QuadraticIntegerRing(-1) >>> Zi("1 + I") / Zi("1 - I") I
>>> Zi = QuadraticIntegerRing(-1) >>> Zi(2).factor() [1 + I, 1 - I]
Testing whether the ideal in
is principal:
>>> O = QuadraticIntegerRing(-5) >>> Ideal(O(3), O("1 + sqrt(-5)")).is_principal() False
>>> Zi = QuadraticIntegerRing(-1) >>> Ideal(Zi(2)).factor() [<1 + I,2*I>, <1 + I,2*I>]
Computing the order of the ideal class with representative in
:
>>> O = QuadraticIntegerRing(-5) >>> a = IdealClass(Ideal(O(3), O("1 + sqrt(-5)"))) >>> a.order 2
Computing the class number of :
>>> G = ClassGroup(-5) >>> G.class_number 2