Skip to content

Release Notes for 1.6

Oscar Benjamin edited this page May 24, 2020 · 282 revisions
Clone this wiki locally

These are the release notes for SymPy 1.6. You can also find release notes for previous versions.

SymPy 1.6 was released on 24th May 2020.

This version of SymPy has been tested on Python 3.5, 3.6, 3.7, 3.8 and PyPy. See our Python version support policy for more information on when we plan to drop support for older Python versions.

Note in particular that SymPy 1.5.1 was the last release to support Python 2.7. SymPy 1.6 will not work on Python 2.7. Python 2.7 users should install SymPy 1.5.1 and will not be able to install any further SymPy updates without updating to Python 3.

Install SymPy with

pip install -U sympy

or if you use Anaconda

conda install sympy

Backwards compatibility breaks and deprecations

Please manually add any backwards compatibility breaks or deprecations here, in addition to the automatic listing below.

  • assumptions

    • Removed deprecated Q.bounded (use Q.finite instead). Deprecated since version 1.0 (issue: #9425) (#18390 by @Smit-create)

    • Removed deprecated Q.infinitesimal (use Q.zero instead). Deprecated since version 1.0 (issue: #9675) (#18390 by @Smit-create)

    • Removed deprecated Q.infinity (use Q.infinte instead). Deprecated since version 1.0 (issue: #9426) (#18390 by @Smit-create)

  • calculus

    • Deprecated evaluate argument in differentiate_finite for making non-conservative finite differences. (#17881 by @vezeli)
  • combinatorics

  • core

    • Deprecated sympify automatically converting custom objects with __str__ or __repr__ implemented. (#19006 by @sylee957)

    • BREAKING CHANGE: Basic.has no longer accepts strings as input. For example in SymPy 1.5 you could do Symbol('x').has('x') and the string 'x' passed to has would be sympified to a symbol so that the result would be True. In SymPy 1.6 this will raise an error because the string 'x' can not be sympified using strict sympification. (#19251 by @oscarbenjamin)

    • Remove deprecated bounded, unbounded and infinitesimal. Deprecated since version 0.7.6 (issue #8071) (#18503 by @Smit-create)

    • Relational is no longer a subclass of Expr and does not produce nonsensical results in arithmetic operations. This affects all Relational subclasses (Eq, Ne, Gt, Ge, Lt, Le). It is no longer possible to call meaningless Expr methods like as_coeff_Mul on Relational instances. (#18053 by @oscarbenjamin)

    • Expr now uses cooperative dispatch for binary operations so it is possible for non-Expr Basic subclasses to override the behaviour of e.g. a + b where one of a or b is an instance of Expr. This also means that any non-Expr Basic subclasses can not depend on Expr.__add__ to create Add(a, b): if a class is not a subclass of Expr and wants to define binary operations with Expr it must do so explicitly in its own __add__ method. For classes depending on this this is not a backward compatible change. (#18116 by @oscarbenjamin)

  • matrices

    • The Matrix.is_zero property has been renamed to Matrix.is_zero_matrix.
    • Matrix.is_zero is now always False. This is because in general is_zero means the number zero so a matrix can never be zero.

    To get the old behavior of M.is_zero in both old and new versions of sympy use from sympy.core.logic import fuzzy_and; fuzzy_and(m.is_zero for m in M). (#18464 by @sylee957)

  • polys

    • BREAKING CHANGE: Poly and PurePoly now subclass Basic rather than Expr. This means that they no longer have various Expr methods such as expand that do not make sense for Poly. Use as_expr to convert the Poly to an Expr before using Expr methods. (#18613 by @oscarbenjamin)

    • BREAKING CHANGE: Poly instances with different domains now always compare unequal with p1 == p2 and p1.eq(p2). Previously Poly instances that had the same expression and generators would compare equal even if the domains were different. In some cases it might be necessary to specify the domain when comparing e.g. if p == Poly(x, x, domain='QQ'). (#18613 by @oscarbenjamin)

    • DEPRECATION: Mixing Poly with non-polynomial Expr in binary operations is now deprecated. For example Poly(x, x) * exp(x) will give a deprecation warning but still return the Expr x*exp(x) as before. If the Expr can be converted to Poly (e.g. Poly(x, x) * x) then a Poly will be returned. To get an Expr always use the as_expr method first to convert the Poly to an Expr. To get a Poly always use as_poly to convert the Expr to a Poly. (#18613 by @oscarbenjamin)

    • DEPRECATION: Passing Poly as the integrand to the integrate function or Integral class is now deprecated. Use the integrate method instead e.g. Poly(x, x).integrate(x) (#18613 by @oscarbenjamin)

  • printing

    • Removed deprecated Ccodeprinter (Use C89Printer or C99Printer instead). Deprecated since version 1.1 (Issue : #12220). (#18392 by @risubaba)

    • Removed deprecated file viewer option in preview. Deprecated since version 0.7.3(Issue: #7018) (#18392 by @risubaba)

    • Removed deprecated StringIO viewer option in preview. Deprecated since version 0.7.2(Issue: #7083) (#18392 by @risubaba)

  • sets

    • Set now uses cooperative dispatch for binary operations so it is possible for non-Set Basic subclasses to override the behaviour of e.g. a + b where one of a or b is an instance of Set. This also means that any non-Set Basic subclasses can not depend on e.g. Set.__add__ to create Union(a, b): if a class is not a subclass of Set and wants to define binary operations with Set it must do so explicitly in its own __add__ method. For classes depending on this this is not a backward compatible change. (#18116 by @oscarbenjamin)
  • other

    • Submodule names are no longer imported with from sympy import *. They can still be imported directly like from sympy import core or accessed like sympy.core, or like sys.modules['sympy.simplify'] for modules that share names with SymPy functions. (#18245 by @oscarbenjamin)

Changes

  • assumptions

    • assumptions will give the T/F assumptions of a symbol or expression (#19155 by @smichr)

    • common_assumptions returns the T/F assumptions in common amongst the given expressions (#19155 by @smichr)

    • Added a refine_matrixelement function (#18681 by @Saanidhyavats)

    • Updated Mul.is_imaginary to support infinite values. (#18192 by @namannimmo10)

    • Removed deprecated Q.bounded (use Q.finite instead). Deprecated since version 1.0 (issue: #9425) (#18390 by @Smit-create)

    • Removed deprecated Q.infinitesimal (use Q.zero instead). Deprecated since version 1.0 (issue: #9675) (#18390 by @Smit-create)

    • Removed deprecated Q.infinity (use Q.infinte instead). Deprecated since version 1.0 (issue: #9426) (#18390 by @Smit-create)

    • Matrices can now be checked for antihermitian property by using ask(Q.antihermitian()) which earlier generated incorrect results. (#18303 by @czgdp1807)

    • Improved code in ask function using constructs from cnf module. (#18204 by @JSS95 and @mcpl-sympy)

    • Fixed bug in ask function: In case of user-defined Predicates it generated KeyError while checking for local_facts. Now falls back to Handlers and satask. (#18204 by @JSS95 and @mcpl-sympy)

  • calculus

    • continuous_domain now finds singularities in nested fractions (#19047 by @smichr and @ThomasHickman)

    • singularities has been upgraded to handle more than rational functions (#19047 by @smichr and @ThomasHickman)

    • fixes operations of AccumBounds (#18803 by @Ryand1234)

    • periodicity of exponential functions with a non-zero phase component is now calculated. (#18746 by @mohitacecode)

    • Correct the solution of differentiate_finite for expressions that contain embedded derivatives. (#17881 by @vezeli)

    • Deprecated evaluate argument in differentiate_finite for making non-conservative finite differences. (#17881 by @vezeli)

    • Updated docstrings of maximum, minimum, stationary_points and AccumBounds.intersection (#18581 by @mijo2)

    • Fixes Recursion Error in AccumulationBounds.__pow__ by adding a check on denominator (#18450 by @Smit-create)

  • combinatorics

    • Cycle class is no longer mutable and can be regarded as a sparse representation of a permutation (#17973 by @sachin-4099)
  • core

    • BREAKING CHANGE: Basic.has no longer accepts strings as input. For example in SymPy 1.5 you could do Symbol('x').has('x') and the string 'x' passed to has would be sympified to a symbol so that the result would be True. In SymPy 1.6 this will raise an error because the string 'x' can not be sympified using strict sympification. (#19251 by @oscarbenjamin)

    • Mul.is_integer no longer rebuilds arguments into Mul (#19182 by @iammosespaulr)

    • Mul with odd numerator and even denominator is recognized as rational but not integer (#19155 by @smichr)

    • Deprecated sympify automatically converting custom objects with __str__ or __repr__ implemented. (#19006 by @sylee957)
    • when strict=True, as_int will not convert True to 1 (#19054 by @smichr)
    • Adds simplification to Pow._eval_nseries resolving incorrect limit evaluation (#18962 by @sachin-4099)
    • Reduces sensitivity of computation of order terms in Pow._eval_nseries (#18785 by @sachin-4099)

    • Pow.is_zero is fixed for some cases involving infinite (or possibly infinite) expressions. (#18728 by @oscarbenjamin)

    • Now finite and infinite are logical opposites in the old assumptions system so e.g. a Symbol declared with finite=False will have infinite=True. (#18726 by @oscarbenjamin)

    • sympify no longer converts numpy arrays with size to scalars (#18651 by @mijo2 and @NeilGirdhar)

    • __getnewargs__() added to Zero, One, NegativeOne, Half. (#18675 by @mohitacecode)

    • simplification of powers with numerical products in the base is improved (#18650 by @sachin-4099)

    • sqrt(x).is_negative is False when x is real (#18597 by @Smit-create)

    • Add,_eval_as_leading_term() has been fixed (#18340 by @sachin-4099)

    • Updated the definition of atoms method of class Basic (#18532 by @mijo2)

    • basic - sorting in subs is improved so unsorted arguments will prefer replacing more complicated patterns first (e.g. the second derivative before the first derivative). (#18043 by @Psycho-Pirate)

    • Remove deprecated bounded, unbounded and infinitesimal. Deprecated since version 0.7.6 (issue #8071) (#18503 by @Smit-create)

    • Added check for AccumBounds. (#18478 by @smichr and @Smit-create)

    • Adding gmpy in integer_nthroot ( It works only for n < 2**63) (#18380 by @Smit-create)

    • Added new test case for relational (#18416 by @mijo2)

    • Pow._eval_nseries fixed to accept all real exponents. (#18406 by @Smit-create)

    • integer_ntroot and igcd now use gmpy when it is installed (#18276 by @Smit-create)

    • Changed some partial derivatives like diff(f(g(x), h(x)), x) not to have dummy symbols. (#18326 by @sachin-4099)

    • subs now works correctly with partial derivatives. (#18326 by @sachin-4099)

    • Subclass of Function can inherit its nargs attribute to its subclasses. (#18258 by @JSS95 and @mcpl-sympy)

    • Added try-except block in sympy/core/relational.py to handle NotImplementedError and return ConditionSet (#18211 by @Smit-create)

    • Renamed core/evaluate to core/parameters (#18198 by @JSS95, @mcpl-sympy, and @oscarbenjamin)

    • Added global_parameters, which is a thread-local storage for global parameters such as evaluate, distribute, etc. (#18198 by @JSS95, @mcpl-sympy, and @oscarbenjamin)

    • Relational is no longer a subclass of Expr and does not produce nonsensical results in arithmetic operations. This affects all Relational subclasses (Eq, Ne, Gt, Ge, Lt, Le). It is no longer possible to call meaningless Expr methods like as_coeff_Mul on Relational instances. (#18053 by @oscarbenjamin)

    • Expr now uses cooperative dispatch for binary operations so it is possible for non-Expr Basic subclasses to override the behaviour of e.g. a + b where one of a or b is an instance of Expr. This also means that any non-Expr Basic subclasses can not depend on Expr.__add__ to create Add(a, b): if a class is not a subclass of Expr and wants to define binary operations with Expr it must do so explicitly in its own __add__ method. For classes depending on this this is not a backward compatible change. (#18116 by @oscarbenjamin)

    • Added global_evaluate[0] condition in add, sub, mul, div functions in Infinity class. (#18109 by @namannimmo10)

    • Moved .as_poly() from Basic to Expr. (#18094 by @dhruvmendiratta6)

    • Fixed a bug in Factors().as_expr() that led to simplifications that are not generally valid for complex numbers. (Exponents were always multiplied in power-of-a-power situations.) (#18087 by @gschintgen)

    • Fix a regression in 1.5 that allowed expressions to compare equal to strings, and caused == to call str() on the other object. (#18057 by @asmeurer)
  • functions

    • Adjoint of exp and transpose of exp now work as expected. (#19151 by @akirakyle)

    • Adds substitution to _eval_nseries() function of Abs() class resolving incorrect limit evaluations (#19037 by @sachin-4099)