Skip to content

Releases: diofant/diofant

Diofant 0.14.0

12 Apr 05:15
v0.14.0
f4cc0e4
Compare
Choose a tag to compare

Construction of Poly's from expressions is now significantly faster with using recursive algorithm (former poly() function):

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

while on the v0.13:

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:

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:

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

In [1]: Piecewise((x**2/2, x <= 1/2), (x/2 - 1/8, True))
Out[1]:
⎧  2x
⎪ ──    for x1/22
⎨
⎪x   1
⎪─ -otherwise2   8In [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 -m diofant --no-ipython --unicode-identifiers
>>> Naturals

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

DOI

See release notes.

Diofant 0.13.0

07 Nov 07:48
v0.13.0
92766cf
Compare
Choose a tag to compare

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's:

$ python -m diofant --no-ipython
>>> series(sin(x), x)
     3     5        
    x     x6x - ── + ─── + Ox6    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 -m diofant

In [1]: series(sin(x), x)
Out[1]: 
     3     5        
    x     x6x - ── + ─── + Ox6    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:

In [4]: sqf_list(x**8*y**8 + 1, modulus=8)
Out[4]: (1, [(xy + 1, 8)])

Please note, that this version require CPython >= 3.9 (latest 3.10 is supported too).
DOI
See release notes.

Diofant 0.12.0

18 Jan 13:57
ad00f7f
Compare
Choose a tag to compare

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:

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:

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:

In [2]: reduce_inequalities([x >= 0, 2*x + 4*y <= 14, x - 2*y <= 1])
Out[2]: 
            x   1                 x   7
x0y ≥ ─ - ─ ∧ x4y-+2   2                 2   2

Please notice, that inequalities are solved now (per default) over extended reals.
DOI
See release notes.

Diofant 0.11.0

22 Apr 06:55
v0.11.0
Compare
Choose a tag to compare

The major part of changes in this release are not visible directly via public API. For example, the Poly class now uses the sparse polynomial representation (via PolyElement):

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:

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:

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:

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 + 4RootOfa+ 4a+ 4a- 1, 3+ RootOfa+ 4a+ 4a- 1,

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

         4                                      2                             
        ⎞            ⎛  5       3              ⎞            ⎛  5       3- 1, 4+ 4RootOfa+ 4a+ 4a- 1, 4⎠ , y: RootOfa+ 4a+ 4a

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

DOI
See release notes.

Diofant 0.10.0

27 Jan 07:24
v0.10.0
Compare
Choose a tag to compare

The version adds the new representation for elements of the 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:

In [1]: RootOf(x**5 - sqrt(2)*x + I, 4)
Out[1]: 
      ⎛ 5     ___RootOfx  - ╲╱ 2x + , 4In [2]: _.evalf()
Out[2]: 1.14104809461863 - 0.147518181586635

DOI
See release notes.

Diofant 0.9.0

23 Feb 12:07
v0.9.0
501e687
Compare
Choose a tag to compare

Diofant 0.8.0

07 Nov 16:44
v0.8.0
Compare
Choose a tag to compare