An Object-Oriented Python Interface and Extension to Singular
Project description
A Python Interface & Extension to Singular
The syngular
library is a Python 3 package for algebraic geometry computations. It provides an intuitive and object-oriented interface to Singular. Furthermore, it extends the numerical capabilities of Singular, providing a numerical solver for arbitrary systems of polynomial equations in tandem with pyadic, and its applicaibility to physics computations, where generic algorithms may be insufficient.
Interface
Python classes for 'Ideal', 'Ring' and 'QuotientRing'. Several related functions accessible as attributes or methods. Intuitive operations through magic methods, e.g. Ideal addition '+' and intersection '&'.
Extension
Points on varieties over $\mathbb{F}_p$, $\mathbb{Q}_p$ and $\mathbb{C}$.
The function ideal.point_on_variety
allows to obtain numerical solutions to arbirary systems of polynomial equations in arbitrary polynomial quotient rings, over any of the three above mentioned fields. The system of equations may be underconstrained, i.e. the ideal may have any dimension. The $p$-adic and complex solutions can be requested as not exact. I.e. the point may lie close to but not exactly on the associated variety. This is essential for numerical computations where otherwise division-by-zero erros may occur. The limitation is that Singular must be able to compute an indepednent set for the ideal, in order to reduce it to a zero dimensional sub-variety.
Primality test (lighter than a primary decomposition).
The function ideal.test_primality
allows to test whether an ideal is prime or not, without performing a full primary decomposition. The algorithm can run also with successively looser degree bounds. It returns True if the idea is prime, False if it is not, or raises an Inconclusive
exception if it cannot decide. The latter case happens, for instance, if the ideal is not radical, since the algorithm may not be able to find a linear projection. Inconclusive cases include when the ideal is primary but not prime.
Requirements
numpy, sympy, Singular
Installation
pip install -e path/to/repo
Testing
pytest --cov syngular/ --cov-report html tests/ --verbose
Quick Start
Define an ideal over a ring in two variables
from syngular import Ideal, Ring
I = Ideal(Ring('0', ('x1', 'x2'), 'dp'), ['x1*x2'])
You can now inspect I
to see what methods and attributes are available.
Solving arbitrary systems of polynomial equations
Generate a $p$-adic solution to a system of 2 polynomial equations in 3 variables, controlling the precision to which they are solved.
field = Field("padic", 2 ** 31 - 1, 8)
ring = Ring('0', ('x', 'y', 'z', ), 'dp')
I = Ideal(ring, ['x*y^2+y^3-z^2', 'x^3+y^3-z^2', ])
The variety associated to I
has 3 branches. In other words, the system of equations has 3 types of solutions.
(Q1, P1), (Q2, P2), (Q3, P3) = I.primary_decomposition
Generate a solution on the first branch
numerical_point = Q1.point_on_variety(field=field, directions=I.generators, valuations=(1, 1, ), )
is a dictionary of numerical values for each variable in the ring.
These are small with valuations (1, 1)
list(map(lambda string: Polynomial(string, field).subs(numerical_point), Q1.generators))
while these are O(1) with valuations (0, 0)
list(map(lambda string: Polynomial(string, field).subs(numerical_point), Q2.generators))
See arXiv:2207.10125 Fig. 1 for a graphical depiction.
Citation
If you found this library useful, please consider citing it and Singular
@inproceedings{DeLaurentis:2023qhd,
author = "De Laurentis, Giuseppe",
title = "{Lips: $p$-adic and singular phase space}",
booktitle = "{21th International Workshop on Advanced Computing and Analysis Techniques in Physics Research}: {AI meets Reality}",
eprint = "2305.14075",
archivePrefix = "arXiv",
primaryClass = "hep-th",
reportNumber = "PSI-PR-23-14",
month = "5",
year = "2023"
}
@misc {DGPS,
title = {{\sc Singular} {4-3-0} --- {A} computer algebra system for polynomial computations},
author = {Decker, Wolfram and Greuel, Gert-Martin and Pfister, Gerhard and Sch\"onemann, Hans},
year = {2022},
howpublished = {\url{http://www.singular.uni-kl.de}},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file syngular-0.2.3.tar.gz
.
File metadata
- Download URL: syngular-0.2.3.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8838197d129da14077981ea1fb60ae8f9f3d8d1001d8661d98a0a64149884885 |
|
MD5 | c2cefbdf1deb60013961d9210e205adf |
|
BLAKE2b-256 | 385b810679b9c02f1ac4b188b1f115d489a2065bc97d7d6ec19006638b5577a3 |
File details
Details for the file syngular-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: syngular-0.2.3-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2b5deff99823dde664ffedbdb5a37e2d67b9e8923bfca5f69c035cf3766f0f1 |
|
MD5 | ba4c27ae97ed247d7d12d7e8a9ec4bad |
|
BLAKE2b-256 | fc8434244d2b8c78a65a5bbb42e66a1badaa3bc0de62faaf3cca050fa80fa245 |