Diofant

Latest version: v0.15.0

Safety actively analyzes 723217 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 2

0.12.0

This release finishes porting all algorithms in the polys module to use the sparse polynomial representation. While that change is mostly hidden from the end user - the codebase volume was reduced drastically:

$ wc -lc sympy/polys/*.py|tail -1 on SymPy 0.7.6
37942 1088668 total
$ wc -lc diofant/polys/*.py|tail -1
20960 672333 total

The implementation is not optimal and there are some speed regressions, which hopefully will be fixed in following releases.

The notable user-visible change is the new factorization algorithm for mutivariate polynomials over algebraic number fields. For example:
python
In [1]: R, x, y, z = ring('x, y, z', A)
...: f1, f2 = x**2 + 2*y + sqrt(2), root(3, 3)*x - z
...: f = f1*f2
...: %time r = f.factor_list()
CPU times: user 22.9 s, sys: 99.9 ms, total: 23 s
Wall time: 23.3 s

while on the current SymPy master (despite more optimized implementation of low-level operations) timings are:
python
CPU times: user 32.4 s, sys: 309 ms, total: 32.7 s
Wall time: 32.9 s

The difference is bigger for extensions of high degrees.

Also, this version supports solving linear inequalities with the classical Fourier-Motzkin elimination algorithm:
python
In [2]: reduce_inequalities([x >= 0, 2*x + 4*y <= 14, x - 2*y <= 1])
Out[2]:
x 1 x 7
x ≥ 0 ∧ y ≥ ─ - ─ ∧ x ≤ 4 ∧ y ≤ - ─ + ─
2 2 2 2

Please notice, that inequalities are solved now (per default) over extended reals.
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4447168.svg)](https://doi.org/10.5281/zenodo.4447168)
See [release notes](https://diofant.readthedocs.io/en/latest/release/notes-0.12.html).

0.11.0

The major part of changes in this release are not visible directly via public API. For example, the [Poly](https://diofant.readthedocs.io/en/v0.11.0/modules/polys.html#diofant.polys.polytools.Poly) class now uses the sparse polynomial representation (via [PolyElement](https://diofant.readthedocs.io/en/v0.11.0/internals/polys.html#diofant.polys.rings.PolyElement)):
python
In [1]: Poly(x**2 + x*y)
Out[1]: Poly(x**2 + x*y, x, y, domain='ZZ')

In [2]: type(_1.rep)
Out[2]: abc.PolyElement

A noticiable exception is finite fields of prime powers. Now it's possible to represent ones:
python
In [3]: F4 = FF(4)

In [4]: F4(2)
Out[4]: GF(2, [1, 1, 1])(2)

In [5]: _ + F4(1)
Out[5]: GF(2, [1, 1, 1])(3)

and univariate polynomial algorithms are ported to support such fields:
python
In [6]: factor(x**3 + 3*x + 2, modulus=4)
Out[6]:
⎛ 2 ⎞
(x + 1)⋅⎝x + x + 2⎠

This release also continues to improve solvers, now multivariate equations with surds are solved correctly:
python
In [7]: %time solve([sqrt(x) + y + 2, sqrt(y)*x - 1], x, y)
CPU times: user 1min 22s, sys: 496 ms, total: 1min 22s
Wall time: 1min 37s
Out[7]:
⎡⎧ 2
⎢⎨ ⎛ 5 3 ⎞ ⎛ 5 3
⎣⎩x: 4 + 4⋅RootOf⎝a₁ + 4⋅a₁ + 4⋅a₁ - 1, 3⎠ + RootOf⎝a₁ + 4⋅a₁ + 4⋅a₁ - 1,

4 2⎫ ⎧
⎞ ⎛ 5 3 ⎞ ⎬ ⎨ ⎛ 5 3
3⎠ , y: RootOf⎝a₁ + 4⋅a₁ + 4⋅a₁ - 1, 3⎠ ⎭, ⎩x: 4 + RootOf⎝a₁ + 4⋅a₁ + 4⋅a

4 2
⎞ ⎛ 5 3 ⎞ ⎛ 5 3
₁ - 1, 4⎠ + 4⋅RootOf⎝a₁ + 4⋅a₁ + 4⋅a₁ - 1, 4⎠ , y: RootOf⎝a₁ + 4⋅a₁ + 4⋅a

2⎫⎤
⎞ ⎬⎥
₁ - 1, 4⎠ ⎭⎦

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3760329.svg)](https://doi.org/10.5281/zenodo.3760329)
See [release notes](https://diofant.readthedocs.io/en/latest/release/notes-0.11.html).

0.10.0

The version adds the new representation for elements of the [AlgebraicField](https://diofant.readthedocs.io/en/v0.10.0/modules/domains.html#diofant.domains.AlgebraicField) domain, which enables exact roots isolation (by the Collins-Krandick algorithm, which was trivially extended to support real algebraic fields and their gaussian extensions) in case of polynomials with algebraic coefficients:
python
In [1]: RootOf(x**5 - sqrt(2)*x + I, 4)
Out[1]:
⎛ 5 ___ ⎞
RootOf⎝x - ╲╱ 2 ⋅x + ⅈ, 4⎠

In [2]: _.evalf()

0.9.0

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1183537.svg)](https://doi.org/10.5281/zenodo.1183537)

See [release notes](https://diofant.readthedocs.io/en/latest/release/notes-0.9.html).

[Diofant-0.9.0.tar.gz](https://github.com/diofant/diofant/files/1751502/Diofant-0.9.0.tar.gz)
[diofant-docs-html-0.9.0.zip](https://github.com/diofant/diofant/files/1751568/diofant-docs-html-0.9.0.zip)
[diofant-docs-0.9.0.pdf](https://github.com/diofant/diofant/files/1751532/diofant-docs-0.9.0.pdf)

0.8.0

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.165163.svg)](https://doi.org/10.5281/zenodo.165163)

This is the first public release of Diofant. See [release notes](https://diofant.readthedocs.io/en/latest/release/notes-0.8.html).

[Diofant-0.8.0.tar.gz](https://github.com/diofant/diofant/files/576007/Diofant-0.8.0.tar.gz)
[diofant-docs-html-0.8.0.zip](https://github.com/diofant/diofant/files/575730/diofant-docs-html-0.8.0.zip)
[diofant-docs-0.8.0.pdf](https://github.com/diofant/diofant/files/575732/diofant-docs-0.8.0.pdf)

Page 2 of 2

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.