syngular


Namesyngular JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/GDeLaurentis/syngular
SummaryAn Object-Oriented Python Interface and Extension to Singular
upload_time2024-06-05 23:34:55
maintainerNone
docs_urlNone
authorGiuseppe De Laurentis
requires_pythonNone
licenseGNU General Public License v3.0
keywords syngular singular algebraic geometry
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A Python Interface \& Extension to [Singular](https://www.singular.uni-kl.de/)

[![CI Lint](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_lint.yml/badge.svg)](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_lint.yml)
[![CI Test](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_test.yml/badge.svg)](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_test.yml)
[![Coverage](https://img.shields.io/badge/Coverage-87%25-greenyellow?labelColor=2a2f35)](https://github.com/GDeLaurentis/syngular/actions)
[![Docs](https://github.com/GDeLaurentis/syngular/actions/workflows/cd_docs.yml/badge.svg?label=Docs)](https://gdelaurentis.github.io/syngular/)
[![PyPI](https://img.shields.io/pypi/v/syngular.svg?label=PyPI)](https://pypi.org/project/syngular/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/syngular.svg?label=PyPI%20downloads)](https://pypistats.org/packages/syngular)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/GDeLaurentis/syngular/HEAD)
[![DOI](https://zenodo.org/badge/378157462.svg)](https://zenodo.org/doi/10.5281/zenodo.11113680)
[![Python](https://img.shields.io/pypi/pyversions/syngular?label=Python)](https://pypi.org/project/syngular/)

The `syngular` library is a Python 3 package for algebraic geometry computations. It provides an intuitive and object-oriented interface to [Singular](https://www.singular.uni-kl.de/). Furthermore, it extends the numerical capabilities of Singular, providing a numerical solver for arbitrary systems of polynomial equations in tandem with [pyadic](https://github.com/GDeLaurentis/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](https://arxiv.org/pdf/2207.10125) Fig. 1 for a graphical depiction.

## Citation

If you found this library useful, please consider citing it and [Singular](https://www.singular.uni-kl.de/)


```bibtex
@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"
}
```

```bibtex
@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}},
}
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/GDeLaurentis/syngular",
    "name": "syngular",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "syngular, singular, algebraic geometry",
    "author": "Giuseppe De Laurentis",
    "author_email": "g.dl@hotmail.it",
    "download_url": "https://files.pythonhosted.org/packages/0a/68/c236ae891bc1b9ff144556412fe3dba7f240f74e5f0700d416d20bb03aea/syngular-0.2.2.tar.gz",
    "platform": null,
    "description": "# A Python Interface \\& Extension to [Singular](https://www.singular.uni-kl.de/)\n\n[![CI Lint](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_lint.yml/badge.svg)](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_lint.yml)\n[![CI Test](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_test.yml/badge.svg)](https://github.com/GDeLaurentis/syngular/actions/workflows/ci_test.yml)\n[![Coverage](https://img.shields.io/badge/Coverage-87%25-greenyellow?labelColor=2a2f35)](https://github.com/GDeLaurentis/syngular/actions)\n[![Docs](https://github.com/GDeLaurentis/syngular/actions/workflows/cd_docs.yml/badge.svg?label=Docs)](https://gdelaurentis.github.io/syngular/)\n[![PyPI](https://img.shields.io/pypi/v/syngular.svg?label=PyPI)](https://pypi.org/project/syngular/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/syngular.svg?label=PyPI%20downloads)](https://pypistats.org/packages/syngular)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/GDeLaurentis/syngular/HEAD)\n[![DOI](https://zenodo.org/badge/378157462.svg)](https://zenodo.org/doi/10.5281/zenodo.11113680)\n[![Python](https://img.shields.io/pypi/pyversions/syngular?label=Python)](https://pypi.org/project/syngular/)\n\nThe `syngular` library is a Python 3 package for algebraic geometry computations. It provides an intuitive and object-oriented interface to [Singular](https://www.singular.uni-kl.de/). Furthermore, it extends the numerical capabilities of Singular, providing a numerical solver for arbitrary systems of polynomial equations in tandem with [pyadic](https://github.com/GDeLaurentis/pyadic), and its applicaibility to physics computations, where generic algorithms may be insufficient.\n\n## Interface\n\nPython 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 '&'.\n\n## Extension\n\n### Points on varieties over $\\mathbb{F}_p$, $\\mathbb{Q}_p$ and $\\mathbb{C}$.\n\nThe 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.\n\n### Primality test (lighter than a primary decomposition).\n\nThe 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.\n\n\n## Requirements\n```\nnumpy, sympy, Singular\n```\n\n\n## Installation\n```\npip install -e path/to/repo\n```\n\n## Testing\n\n```\npytest --cov syngular/ --cov-report html tests/ --verbose\n```\n\n## Quick Start\n\nDefine an ideal over a ring in two variables\n```\nfrom syngular import Ideal, Ring\nI = Ideal(Ring('0', ('x1', 'x2'), 'dp'), ['x1*x2'])\n```\nYou can now inspect `I` to see what methods and attributes are available.\n\n## Solving arbitrary systems of polynomial equations\n\nGenerate a $p$-adic solution to a system of 2 polynomial equations in 3 variables, controlling the precision to which they are solved.\n```\nfield = Field(\"padic\", 2 ** 31 - 1, 8)\nring = Ring('0', ('x', 'y', 'z', ), 'dp')\nI = Ideal(ring, ['x*y^2+y^3-z^2, x^3+y^3-z^2', ])\n```\n\nThe variety associated to `I` has 3 branches. In other words, the system of equations has 3 types of solutions.\n```\n(Q1, P1), (Q2, P2), (Q3, P3) = I.primary_decomposition\n```\n\nGenerate a solution on the first branch\n```\nnumerical_point = Q1.point_on_variety(field=field, directions=I.generators, valuations=(1, 1, ), ) \n```\nis a dictionary of numerical values for each variable in the ring.\n\nThese are small with valuations (1, 1)\n```\nlist(map(lambda string: Polynomial(string, field).subs(numerical_point), Q1.generators))\n```\n\nwhile these are O(1) with valuations (0, 0)\n```\nlist(map(lambda string: Polynomial(string, field).subs(numerical_point), Q2.generators))\n```\n\nSee [arXiv:2207.10125](https://arxiv.org/pdf/2207.10125) Fig. 1 for a graphical depiction.\n\n## Citation\n\nIf you found this library useful, please consider citing it and [Singular](https://www.singular.uni-kl.de/)\n\n\n```bibtex\n@inproceedings{DeLaurentis:2023qhd,\n    author = \"De Laurentis, Giuseppe\",\n    title = \"{Lips: $p$-adic and singular phase space}\",\n    booktitle = \"{21th International Workshop on Advanced Computing and Analysis Techniques in Physics Research}: {AI meets Reality}\",\n    eprint = \"2305.14075\",\n    archivePrefix = \"arXiv\",\n    primaryClass = \"hep-th\",\n    reportNumber = \"PSI-PR-23-14\",\n    month = \"5\",\n    year = \"2023\"\n}\n```\n\n```bibtex\n@misc {DGPS,\n title = {{\\sc Singular} {4-3-0} --- {A} computer algebra system for polynomial computations},\n author = {Decker, Wolfram and Greuel, Gert-Martin and Pfister, Gerhard and Sch\\\"onemann, Hans},\n year = {2022},\n howpublished = {\\url{http://www.singular.uni-kl.de}},\n}\n```\n\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3.0",
    "summary": "An Object-Oriented Python Interface and Extension to Singular",
    "version": "0.2.2",
    "project_urls": {
        "Download": "https://github.com/GDeLaurentis/syngular/archive/0.2.2.tar.gz",
        "Homepage": "https://github.com/GDeLaurentis/syngular"
    },
    "split_keywords": [
        "syngular",
        " singular",
        " algebraic geometry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c56768c7d56bbb2764a1db258fadca7e17c1c3c04995c49151c830b1766430f",
                "md5": "8db4c89976924c85d83a87b4fc720d62",
                "sha256": "705f4d87afbb72dd9cab53f0ae666377887726948b5463425bdb92b6d00fdd40"
            },
            "downloads": -1,
            "filename": "syngular-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8db4c89976924c85d83a87b4fc720d62",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 34533,
            "upload_time": "2024-06-05T23:34:53",
            "upload_time_iso_8601": "2024-06-05T23:34:53.491781Z",
            "url": "https://files.pythonhosted.org/packages/0c/56/768c7d56bbb2764a1db258fadca7e17c1c3c04995c49151c830b1766430f/syngular-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a68c236ae891bc1b9ff144556412fe3dba7f240f74e5f0700d416d20bb03aea",
                "md5": "ed710e19e38be486404b3df49d267c69",
                "sha256": "268bf7c8f3964dc888d8c7ef8604647dbf8f1f804576fdee486bcdc808fdd39f"
            },
            "downloads": -1,
            "filename": "syngular-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ed710e19e38be486404b3df49d267c69",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34479,
            "upload_time": "2024-06-05T23:34:55",
            "upload_time_iso_8601": "2024-06-05T23:34:55.219448Z",
            "url": "https://files.pythonhosted.org/packages/0a/68/c236ae891bc1b9ff144556412fe3dba7f240f74e5f0700d416d20bb03aea/syngular-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-05 23:34:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "GDeLaurentis",
    "github_project": "syngular",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "syngular"
}
        
Elapsed time: 0.77648s