Skip to main content

A Python Interface & Extension to Singular

CI Lint CI Test Coverage Docs PyPI PyPI Downloads Binder DOI Python

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

Multivariate solver - i.e. 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, meaning 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 when using exact solutions. The limitation is that Singular must be able to compute an indepednent set for the semi-numerical ideals of low dimension.

Primality test (lighter than a primary decomposition).

The function ideal.test_primality allows to test whether an ideal is prime, primary or neither, 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. If astuple is True, then it will return two booleans: (is_primary, is_prime). Inconclusive cases should now only happen with a Timeout on the computation.

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}},
}

Metadata

Release files for syngular 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for syngular 0.6.1
File Size Uploaded Provenance Actions
syngular-0.6.1.tar.gz 53.5 kB Without provenance Details for syngular-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for syngular 0.6.1
File Interpreter ABI Platform Actions
syngular-0.6.1-py3-none-any.whl Python 3 none any Details for syngular-0.6.1-py3-none-any.whl

Total release size: 102.1 kB

Release files / syngular-0.6.1.tar.gz

Download URL syngular-0.6.1.tar.gz
Size 53.5 kB
Tags Source
SHA-256 checksum
How to use checksums
66c11f1fc2b10414b04cbdf97d1b857c8d9d1674a16e9ac2edcfa6c128c23611
BLAKE2b-256 checksum
How to use checksums
c03002c6a61a8dcdbe5d5796e95831c0d5ff4202f5742a0ca509e4262c98ae50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.3

Release files / syngular-0.6.1-py3-none-any.whl

Download URL syngular-0.6.1-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c144dd532ee5c232e59cb3f05d5f199070d64f53f6e3f134200418d9a1b58f03
BLAKE2b-256 checksum
How to use checksums
0734902410a96bd0e4257cb1a69b7fd251acfa9f18750794c9baa44314eec096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.3

Security for syngular 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page