Diofant

Latest version: v0.15.0

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

Scan your dependencies

Page 1 of 2

0.147518181586635

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

0.16.0a2

What's Changed
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1436
* Add cli option to wrap integer literals with Integer by skirpichev in https://github.com/diofant/diofant/pull/1437
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1438
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1439
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1441
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1442
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1443
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1445
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1446
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1450
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1451
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1452
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1454
* Remove Expr.series(n=None) support by skirpichev in https://github.com/diofant/diofant/pull/1418
* Use gmp-python by skirpichev in https://github.com/diofant/diofant/pull/1455
* Misc fixes by skirpichev in https://github.com/diofant/diofant/pull/1456
* Enable new GA workflow to publish package by skirpichev in https://github.com/diofant/diofant/pull/1457


**Full Changelog**: https://github.com/diofant/diofant/compare/v0.15.0...v0.16.0a2

0.15.0

Mostly bugfixes.

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

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

0.14.0

Construction of Poly's from expressions is now significantly faster with using recursive algorithm (former ``poly()`` function):
python
In [1]: %time p = Poly((x + 1)**1000, x)
CPU times: user 178 ms, sys: 3.88 ms, total: 181 ms
Wall time: 182 ms

0.13

python
In [1]: %time p = Poly((x + 1)**1000, x)
CPU times: user 1min 4s, sys: 55.9 ms, total: 1min 4s
Wall time: 1min 4s

or in the current SymPy master:
python
In [1]: %time p = Poly((x + 1)**1000, x)
CPU times: user 4.78 s, sys: 26.9 ms, total: 4.8 s
Wall time: 5.05 s


Support for directional limits on the complex plane was added:
python
In [1]: limit(sqrt(-1 + I*x), x, 0, dir=exp(I*pi/3))
Out[1]: -ⅈ

Direction ``exp(I*theta)`` at the limit point ``x0`` indicates the direction tangent of a curve approaching the limit point. Special cases ``-1`` (former dir=``+``) and ``+1`` (former dir=``-``) correspond to ``theta=pi`` and ``theta=0`` (i.e. limit from above or from below on the real line).

This release got better support for limits of piecewise and boolean expressions
python
In [1]: Piecewise((x**2/2, x <= 1/2), (x/2 - 1/8, True))
Out[1]:
⎧ 2
⎪ x
⎪ ── for x ≤ 1/2
⎪ 2

⎪x 1
⎪─ - ─ otherwise
⎪2 8


In [2]: limit(_1, x, 0)
Out[2]: 0

In [3]: limit(_1, x, oo)
Out[3]: ∞

In [4]: limit(x > 0, x, 0)
Out[4]: true

In [5]: limit(x > 0, x, 0, dir=1)
Out[5]: false


Also, for good or bad, now you could use any unicode symbols for identifiers (python does NFKC-normalization while parsing) in the Diofant console:
python
$ python -m diofant --no-ipython --unicode-identifiers
>>> Naturals

>>> ℕ = Naturals
>>> N = 2
>>> ℕ will print 2 in plain Python



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

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

0.13.0

This release supports calling the Diofant as a module to provide more enhanced CLI interface wrt the standard Python (or IPython) shell. For instance, per default it adds default imports from the Diofant, initialises some symbols and wraps all integer divisions with [fractions.Fraction](https://docs.python.org/3/library/fractions.html#fractions.Fraction)'s:
python
$ python -m diofant --no-ipython
>>> series(sin(x), x)
3 5
x x ⎛ 6⎞
x - ── + ─── + O⎝x ⎠
6 120
>>> rsolve(f(n + 2) - f(n))
⎡⎧ n ⎫⎤
⎢⎨f: n ↦ (-1) ⋅C₁ + C₀⎬⎥
⎣⎩ ⎭⎦
>>> type(1/2)
<class 'fractions.Fraction'>

The IPython shell is used, instead of the ordinary Python shell, if available:
python
$ python -m diofant

In [1]: series(sin(x), x)
Out[1]:
3 5
x x ⎛ 6⎞
x - ── + ─── + O⎝x ⎠
6 120

In [2]: rsolve(f(n + 2) - f(n))
Out[2]:
⎡⎧ n ⎫⎤
⎢⎨f: n ↦ (-1) ⋅C₁ + C₀⎬⎥
⎣⎩ ⎭⎦

In [3]: type(1/2)
Out[3]: fractions.Fraction

Use --help switch to see available options.

Support for square-free factorization of multivariate polynomials over Galois
fields was added:
python
In [4]: sqf_list(x**8*y**8 + 1, modulus=8)
Out[4]: (1, [(x⋅y + 1, 8)])


Please note, that this version require CPython >= 3.9 (latest 3.10 is supported too).
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5651447.svg)](https://doi.org/10.5281/zenodo.5651447)
See [release notes](https://diofant.readthedocs.io/en/latest/release/notes-0.13.html).

Page 1 of 2

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.