Release Notes for 1.8 - sympy/sympy GitHub Wiki

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

SymPy 1.8 was released on 9th April 2021.

This version of SymPy has been tested on Python 3.6, 3.7, 3.8, 3.9, 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.8 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

Highlights

There are many changes in 1.8 (see below).

Backwards compatibility breaks and deprecations

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

  • assumptions

    • AskHandler(), register_handler() and remove_handler() are deprecated. Handler now must be multipledispatch instance. (#20835 by @JSS95)
  • parsing

    • Parsing of "Q" returns AssumptionKeys instance in assumptions module. This means that sympify("Q") will no longer return a symbol. (#21152 by @JSS95)

Changes

  • assumptions

    • Q.infinite now correctly evaluates to True for oo, -oo, and zoo. (#21242 by @JSS95)

    • Assumption predicates now correctly evaluates to None for S.NaN. (#21242 by @JSS95)

    • Relational objects do not need to be wrapped by Q.is_true to be asked or refined anymore (#21198 by @JSS95)

    • Q.is_true wrapping over AppliedPredicate now just return the argument. (#21152 by @JSS95)

    • refine arg(x) when x is real and nonzero (#21055 by @zanzibar7)

    • assumptions/relation module is introduced. This module implements binary relation as predicate. (#20965 by @JSS95)

    • AskHandler(), register_handler() and remove_handler() are deprecated. Handler now must be multipledispatch instance. (#20835 by @JSS95)

    • Predicate now uses a single handler which is multipledispatch instance. (#20656 by @JSS95 and @YounghyeonKim)

    • Predicate can now take multiple arguments. (#20656 by @JSS95 and @YounghyeonKim)

    • Predicate("...") now returns UndefinedPredicate instance. To define a predicate, you must make a subclass of Predicate. (#20656 by @JSS95 and @YounghyeonKim)

  • calculus

    • Using maximum with a piecewise expression over a domain no longer fails due to a bug fix in Piecewise.as_expr_set_pairs. (#20121 by @Maelstrom6)
  • codegen

    • allowing for multi-dimensional arrays as arguments/locals in c code generation (#21190 by @rols121)

    • create_expand_pow_optimization is now customizable with respect to requirement on base. (#20788 by @bjodah)

    • Support flattening of elementwise additions of array expressions. (#20841 by @Upabjojr)

    • Fixes to array-expressions in order to properly work with ZeroArray and ZeroMatrix. (#20834 by @Upabjojr)

    • Fixing matrix expression recognition from array-expressions. (#20834 by @Upabjojr)

    • Minor fixes to the way the AST of array expressions is built (#20826 by @Upabjojr)

    • Add normalization of CodegenArrayDiagonal when it's nested with CodegenArrayPermuteDims and CodegenArrayContraction. (#20627 by @Upabjojr)

    • Increased support for the normalization of array expressions and permutations of indices. (#20203 by @Upabjojr)

    • parse_matrix_expression( ) is now able to parse traces of matrices. (#20193 by @Upabjojr)

  • combinatorics

    • Added a section to the permutation docs about containment in permutation groups. (#20480 by @wsdookadr)
  • concrete

    • Improved infinite summation capability by adding residue formula. (#21178 by @sylee957)
  • core

    • Fixed a bug in Pow._eval_nseries that added Order terms to exact expansions (#21078 by @0sidharth)

    • Fixed a bug in Expr.round that could lead to infinite recursion in integrate. (#21053 by @Nisarg-Chaudhari)

    • Removed deprecated ClassRegistry (#20896 by @0sidharth)

    • get_integer_part no longer has a threshold on the approximation to closest integer based on difference, allowing floor to give more accurate results for smaller evalf precisions also (#20863 by @0sidharth)

    • A bug causing match to fail for expressions with different signs was fixed. Previously this resulted in solve raising an exception for some inputs. (#20842 by @hailcpy)

    • Make S(0.0) == S.false return False (#20801 by @AaronStiff)

    • .refine() method is moved from Expr to Basic. (#20763 by @JSS95)
    • gcd correctly handles unevaluated Mul (#20700 by @AaronStiff)

    • Fixed a bug leading to infinite recursion in the old assumptions under evaluate(False). (#20721 by @0sidharth)

    • Fixed _eval_is_zero() functionality when imaginary numbers are involved. (#20663 by @prince776)

    • Kind classification of objects is introduced. This feature is experimental, and can be replaced or deleted in the future. (#20549 by @JSS95)
  • functions

    • Fixed assumption is_algebraic for exponentials with rational multiples of I*pi to be True. (#20618 by @sylee957)
  • geometry

    • Geometric entities with symbolic coordinates will not be printed in SVG. (#20601 by @sylee957)
  • integrals

    • Fixed a bug that led to RecursionError in integrals involving hyperbolic functions. (#21250 by @akshanshbhatt)

    • The heurisch integration method was made faster by improvements in the sparse linear systems solver. (#20989 by @oscarbenjamin)

    • A bug leading to incorrect results when integrating Piecewise expressions where a condition simplifies to True was fixed. (#20518 by @kc611)

  • logic

    • refine() on Boolean objects reduces them to true or false if the truth value can be determined.(#20763 by @JSS95)
  • matrices

    • Fixed a bug that led to the wrong derivative result in matrix expressions. (#21208 by @akshanshbhatt)

    • The eye and zero functions have been made much faster for large matrices. (#21006 by @hyadav2k)

    • Added two new functions upper_triangular and lower_triangular, that return upper and lower triangular parts of a matrix. (#20911 by @ks147)

    • Minus one, integers, rational numbers multiplied with MatAdd is automatically distributed. (#20741 by @sidhu1012)

    • Added function returning Wilkinson matrix (#20922 by @ks147)

    • Implemented Singular Value decomposition for matrices (#20761 by @ks147)

    • Implemented Upper Hessenberg Decomposition for a matrix (#20829 by @ks147)

    • eigenvals, eigenvects without radical solution will be returned as CRootOf (#20614 by @sylee957)
    • Added function to calculate Generalized Schur Complement for Block Matrices (#20406 by @naveensaigit)

    • Added functions to compute LDU, UDL and LU decompositions for Block Matrices (#20406 by @naveensaigit)

    • Fixed issues with dot product for Matrix.orthogonalize with complex vectors. (#20342 by @sylee957)

    • Fixed zero division issues for Matrix.QRdecomposition with zero columns coming first than nonzero columns. (#20342 by @sylee957)

    • Changed behaviour of eq() of class DenseMatrix (#20175 by @sidhu1012)

    • det has a new option 'gauss-ge' which is much faster in many cases (#21052 by @hyadav2k)

  • ntheory

  • parsing

    • Fixed issue with parsing logarithm bases without curly braces (#21068 by @rodluger)
    • Fix parse_expr parsing of expressions with methods when using the implicit_multiplications transformation. (#21021 by @asmeurer)

    • Include the transformed code in the error message when the evaluation in parse_expr fails. (#21021 by @asmeurer)

  • physics.continuum_mechanics

    • make beam module compute correctly internal forces (#20431 by @nopria)
  • physics.optics

  • physics.quantum

    • WignerD now evaluates to KroneckerDelta in some cases. (#20844 by @VBhat97)
  • physics.units

    • Fix bug when input argument to a function is an integer (#21089 by @mgreminger)

    • Change default behavior for functions (all function arguments must be dimensionless by default) (#21089 by @mgreminger)

    • sin, cos, tan, cot, sec, and csc functions may have a dimensionless or angle input argument (#21089 by @mgreminger)

    • Exponents must now be dimensionless (#21089 by @mgreminger)

    • Constants such as pi and E are now treated as dimensionless (raised exception previously) (#21089 by @mgreminger)

    • Numbers with an imaginary component are now treated as dimensionless (raised exception previously) (#21089 by @mgreminger)

    • Fixed a bug with derived units and dimensions in check_dimensions. (#20301 by @schymans)

    • Fix bug in convert_to returning wrong units in some cases where the linear equation system between canonical units is unsolvable. (#20442 by @Upabjojr)

  • physics.vector

    • Introduced new methods on ReferenceFrame: .orient_axis(), .orient_explicit(), .orient_body_fixed(), .orient_space_fixed(), and .orient_quaternion(). .orient() calls out to each new method and it is recommended to use the new methods. (#20318 by @moorepants, @sidhu1012, and @sksingh1202)
  • plotting

  • polys

    • Added internal representation as both dense and sparse matrix (#21146 by @ks147 and @oscarbenjamin)

    • Added docstrings for Domain Matrix class (#20992 by @ks147)

    • Add zeros method to DomainMatrix (#21015 by @ks147)

    • A new sparse implementation of DomainMatrix is added. (#20780 by @oscarbenjamin)

    • make is_disjoint strict so that inequalities evaluated with solve() return consistent results (#20906 by @AaronStiff)

    • The DomainMatrix class has moved from sympy.polys.domainmatrix to sympy.polys.matrices and should now be imported as from sympy.polys.matrices import DomainMatrix. (#20759 by @oscarbenjamin)

    • A new polys FiniteExtension domain is added. (#20631 by @oscarbenjamin)

    • added boilerplate index method for FracField (#20503 by @wsdookadr)

    • Solved bug in Poly.replace (#20387 by @jmgc)

    • Solve a bug in polytools.degree. (#20390 by @jmgc)

    • Use assumption system instead of structural equality check in __bool__ method of Expression domain element (fixing cases where Poly(...).is_zero would incorrectly return False) (#20428 by @ehren)

  • printing

    • Symbols with Unicode character names and no underscores, like ω0 now properly pretty print subscripts. (#20916 by @costika1234)

    • Fix the printing of the vertical bar in ImageSet, ConditionSet, and ComplexRegion so that it is the full height in the pretty and LaTeX printers. (#20868 by @asmeurer)

    • Fix the tag for the degree of a root with a rational base in MathML output. (#18699 by @czgdp1807 and @wyattpeak)

    • irrational powers are no longer printed with square root sign, they are printed as fractional powers (#20639 by @0sidharth)

    • Allow spreading assignments across multiple symbols when printing multi-member objects. (#19973 by @micahscopes)

    • Support various array constructor types when printing arrays to GLSL. (#19973 by @micahscopes)

    • Fixes a bug when printing negative expressions to GLSL with operators printed as functions. (#19973 by @micahscopes)

    • Support a custom 0 substitution for printing expressions representing various GLSL types. (#19973 by @micahscopes)

    • make cxxcode correctly print the first argument of Min/Max functions (#20558 by @FFroehlich)

  • sets

    • Added basic denesting functionaility for sets of the form ConditionSet(x, Contains(x, ...)). (#20121 by @Maelstrom6)

    • ConditionSet.contains(x) now returns False if x is not in the base set (even if its substitution into the condition will cause an error). (#20121 by @Maelstrom6)

    • FiniteSet.evalf with a subs argument now does the substitution. Previously, the argument was ignored. (#20321 by @Maelstrom6)

    • Add .simplify to FiniteSet. (#20666 by @sidhu1012)

    • Make 'is_subset' work for ProductSet (#20438 by @oscarbenjamin and @sidhu1012)

    • changed behavior of Rationals.contains(float) to indeterminate (#20565 by @gopalamn)

    • tests modified to include new behavior (#20565 by @gopalamn)

    • .evalf() precisions with x and FiniteSet(x) is same now. (#20451 by @sidhu1012)

  • simplify

    • TRmorrie now takes powers of cos terms into account (#20476 by @kc611)
  • solvers

    • Fixed a bug in solve that expanded hyperbolic function constants to equivalent exp form. (#21250 by @akshanshbhatt)

    • Handle x**r=0 case in invert_complex (#21071 by @eagleoflqj)

    • Fixed a bug in solveset, which led to infinite recursion for solving some expressions involving radicals. (#21032 by @almighty123789)

    • The new sparse DomainMatrix implementation is used in linsolve to make it much faster when solving large sparse systems of linear equations. (#20780 by @oscarbenjamin)

    • Modified symbols sorting in solvers._solve_system to ensure solve and linsolve solve the same way (#20928 by @AaronStiff)

    • Added solver for 2nd order nonlinear autonomous ODE. (#20696 by @naveensaigit)

    • speed improvement in a substep of rsolve_hyper (when computing constant solutions to constant coefficient recurrences). (#20426 by @ehren)

    • Fixed incorrect solutions from rsolve for higher order recurrences (#20440 by @naveensaigit)

  • stats

  • tensor

    • Introduced objects ArraySymbol and ArrayElement for array expressions equivalent to MatrixSymbol and MatrixElement in the matrix expression module. (#20943 by @Upabjojr)
    • shape() function is introduced in array module. (#20791 by @JSS95)
    • Add class ZeroArray for array expressions of zero-valued elements. (#20827 by @Upabjojr)

    • Make Array differentiation(derive_by_array) work with non sympy expressions. (#20676 by @sidhu1012)

    • Added tensordiagonal( ) function to perform diagonalization of array expressions. (#20465 by @Upabjojr)

    • Adding an array with any other type now consistently gives NotImplemented. (#20223 by @sidhu1012)
  • utilities

    • Added official support for using CuPy to GPU accelerate lambdify functions. (#21155 by @thomasaarholt)

    • Added Replacer class to simplify the creation of replacement expressions with MatchPy. (#20794 by @Upabjojr)

    • Added tests for optional parameter in MatchPy patterns. (#20751 by @Upabjojr)

    • Added string printers for MatchPy-compatible wildcards in sympy.utilities.matchpy_connector (#20649 by @Upabjojr)

    • Added WildDot, WildPlus and WildStar classes to MatchPy connector. These classes correspond to the dot, dot-plut and dot-star expressions in regular expression, but operate on SymPy expression trees and are aware of associative and commutative properties, features supported through the MatchPy library. (#20612 by @Upabjojr)

    • minlex no longer accepts is_set or small arguments (#20433 by @MarkCBell)

    • minlex and least_rotation now accept key= arguments similar to sorted. (#20433 by @MarkCBell)

  • vector

  • other

    • Expanding documentation to include all class members with docstrings (#20984 by @paulmand3l)

Authors