Release Notes for 1.11 - sympy/sympy Wiki

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

SymPy 1.11 has not been released yet.

This version of SymPy has been tested on Python 3.7, 3.8, 3.9, 3.10 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.11 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.11 (see below).

Changes

• algebras

• calculus

• combinatorics

• concrete

• A bug leading to incorrect results when evaluating some infinite summations was fixed. Previously an incorrect result might be found in some cases if the summation symbol was defined with the integer=True assumption set. (#23507 by @KuldeepBorkar)

• more summation are now recognized as telescopic sums (#23129 by @smichr)

• core

• Expr.as_coefficient_dict now accepts one or more symbols so symbolic coefficients can be extracted (#23325 by @smichr)

• Fix calling symbols with Iterable not pass cls parameter (#23534 by @eagleoflqj)

• The return values of eval on Function subclasses are now automatically sympified. (#23526 by @asmeurer)

• Function subclasses now raise an exception if the eval method is not defined as a @classmethod. (#23526 by @asmeurer)

• support string-format for Expr with float precision. (#23476 by @eagleoflqj)

• Making Expr.pow type consistent by sympify the returned ints (#23378 by @airpods69)

• A bug resulting in the core assumptions system being sometimes unreliable was fixed meaning that the assumptions system should now be fully reliable and deterministic including under multithreaded usage. The fix has a side effect that any code that is used as part of an _eval_is_* handler for an assumptions predicate (e.g. _eval_is_real) must not recursively query another assumption on the same object (e.g. by checking something like self.is_positive) or it will lead to infinite recursion. Any downstream code that implements such assumption handlers will need to be reviewed for bugs of this kind. Note that it isn't necessary to query something like x.is_positive in a handler for x.is_real because the assumptions system already understands the relationship between these so if x_eval_is_positive() returns True then the system will conclude that x.is_real should be true. (#22557 by @oscarbenjamin)

• rational expressions formerly reported as not-integer (False) may now be correctly reported as possibly so (None) (#23289 by @smichr)
• Improved results of evalf() based on precision (#22999 by @faze-geek)

• BREAKING: removed deprecated prec keyword argument to Float. (#22952 by @oscargus)

• functions

• Auto evaluate DiracDelta(x, 0) to DiracDelta(x) (#23670 by @eagleoflqj)

• The symbolic Min and Max functions now respect the global evaluate flag. (#23663 by @hsiang-wu)

• DEPRECATION: is_prime, is_perfect_square, and divides methods of carmichael deprecated. (#23104 by @oscargus)

• Fix derivative of acosh (#23568 by @eagleoflqj)

• Improve performance of trigonometric functions (#23541 by @eendebakpt)

• BREAKING: removed deprecated simplify method of DiracDelta. (#22952 by @oscargus)

• geometry

• idiff is more efficient at calculating derivatives (#23560 by @smichr)

• Fixed Circle from equation (wrong radius in some cases; allow non-expanded equation). (#23265 by @gschintgen)

• parabolas that are not vertical or horizontal are now supported (#22792 by @smichr)

• linear intersections of enitities defined in terms of Floats are now more robust (#22920 by @smichr)

• BREAKING: removed deprecated equal method of Line. (#22952 by @oscargus)

• integrals

• matrices

• Made type aliases for Matrix and MutableMatrix compliant with PEP 484 (#23659 by @agryman)

• This enables mypy to recognize the type aliases (#23659 by @agryman)

• Fixed Matrix.QRdecomposition giving wrong results for matrices containing symbols (for most cases where zero test can automatically infer the correct results) (#23316 by @sylee957)
• replacement of MatrixSymbol in MatrixElement requires shape to be compatible with indices to succeed (#22677 by @smichr)

• MatrixElement now has symbol attributes (analogous to base attribute of IndexedBase ) (#22677 by @smichr)

• eval_hyper_sum returns as unchanged arguments for which is_hypergeometric is False and those which produce singularities at a or b + 1 where and and b are the lower and upper limits of evaluation, respectively. (#22677 by @smichr)

• Matrix expression derivative algorithm add support for matrix calculus. The derivative of a matrix expression by another matrix expression can now be computed and the result is either an array expression (4-dimensional) or, if two of the resulting dimensions can be suppressed, a matrix expression (2-dimensional). (#23088 by @Upabjojr)

• ntheory

• isprime extend deterministic solutions to over 2^81 (#23455 by @oittaa)

• isprime: test with pow(2, n, n) up to 31417 (#23454 by @oittaa)

• Remove dead code paths from jacobi_symbol (#23445 by @oittaa)

• parsing

• Latex parser supports f'(x) (#23535 by @eagleoflqj)

• Latex parser treats \frac and \binom as atomic (needn't wrap with braces on exponent), and supports \dfrac, \tfrac (#23475 by @eagleoflqj)

• Added the visit_Num function back into ast_parser.py. (#23122 by @wermos)

• Changed the name of the visit_Num node visitor function to visit_Constant, as the former is deprecated. (#23096 by @wermos)

• New powerful Mathematica parser replacing the old one. Language support greatly improved. (#23014 by @Upabjojr)

• physics.control

• physics.mechanics

• physics.optics

• physics.quantum

• The wrapper class OracleGateFunction is now provided for python functions used in OracleGate. (#22887 by @ThePauliPrinciple)

• COMPATIBILITY BREAK: The deprecated numpy.matrix is replaced by numpy.ndarray (potentially breaking downstream code). (#22295 by @oscargus)

• physics.units

• Fixed wrong dimension calculations for some mathematical functions. (#23296 by @faze-geek and @theanshm)

• Quantity: it is now possible to determine if a Quantity is prefixed (eg. nanometers) with the property is_prefixed. (#23218 by @dyc3)

• Quantity: it is now possible to determine if a Quantity represents a physics constant (eg. speed_of_light) with the property is_physical_constant or if is an instance of the new subclass PhysicalConstant. (#23218 by @dyc3)

• quantity_simplify() can now simplify units across dimensions using the optional flag across_dimensions=True. (#23218 by @dyc3)

• BREAKING: removed deprecated print_unit_base method of UnitSystem. (#22952 by @oscargus)

• BREAKING: removed deprecated desc and name keyword arguments of DimensionSystem. (#22952 by @oscargus)

• BREAKING: removed deprecated description and name keyword arguments of DimensionSystem.extend. (#22952 by @oscargus)

• BREAKING: removed deprecated sort_dims method of DimensionSystem. (#22952 by @oscargus)

• BREAKING: removed deprecated ability to call a DimensionSystem. (#22952 by @oscargus)

• BREAKING: removed deprecated ability to get an item from a DimensionSystem. (#22952 by @oscargus)

• physics.vector

• Fixed bug in the calculation of the velocity of a point. (#23362 by @TJStienstra)

• More informative error message if args are swapped in Vector.diff() (#23372 by @moorepants)

• Restored pre-1.7 simplest form for body fixed angular velocities. (#23171 by @moorepants)

• Adds a new method to physics vectors that extracts the functions of time: .free_dynamicsymbols(). (#23111 by @moorepants)

• Physics Vector differentiation now outputs simpler expressions. (#23082 by @moorepants)

• plotting

• Enable sympy.plotting.plot_contour (#23591 by @zaz)

• Labels etc can be set to expressions, including the default values, and are latexified using the Matplotlib backend. (#23091 by @oscargus)

• polys

• Repair representation of prime ideals for inert primes (#23450 by @skieffer)

• Provide method to reduce an algebraic number to a small representative mod an ideal. (#23409 by @skieffer)

• Lazy interval calculation for CRootOf on irreducible polys (#23426 by @skieffer)

• Repair a bug in HNF for m x n matrices with n < m. (#23413 by @skieffer)

• Improve printing for PrimeIdeal (#23404 by @skieffer)

• Support setting of an alias for the primitive element of an AlgebraicField (#23339 by @skieffer)

• Improve equal degree factorization mod powers of 2. (#23175 by @skieffer)

• fixed bug in primitive_element which now does not raise zero divisor error when zero is present in the input. (#23099 by @praneethratna)

• Add convenience constructors for AlgebraicField (#22973 by @skieffer)

• BREAKING: removed deprecated has_Field and has_Ring methods of Domain. (#22952 by @oscargus)

• printing

• Added JaxPrinter, allowing sympy.lambdify to operate on and produce JAX functions. Example: f = lambdify(variables, expr, 'jax'). (#23627 by @tttc3)

• BREAKING CHANGE: The deprecated stub submodules sympy.printing.ccode, sympy.printing.cxxcode and sympy.printing.fcode have been removed. These modules were renamed to e.g. sympy.printing.c in SymPy 1.7 but deprecated stub modules were left behind to give a warning to anyone doing from sympy.printing.ccode import ccode that they should change their imports. Those deprecated stub modules are now removed. The reason for this change was because of ambiguity when writing from sympy.printing import ccode which might import the ccode submodule or the ccode function defined in the submodule. Even continuing to test these deprecated stub modules caused problems in the test suite precisely because of this ambiguity so the modules are now removed completely. The functions that used to be defined in these modules are still available as e.g. from sympy import ccode, cxxcode, fcode (as they have been since before 1.7). (#23660 by @oscarbenjamin)

• LaTeX-printing of Prefix is supported. (#23646 by @oscargus)

• Reciprocals are printed as divisions in Python printers. (#23649 by @oscargus)

• Fixed a bug with Array printing (#23622 by @viocha)

• The llvmjit printer now works with Python 3.10. Previously a bug caused it to segfault. (#23513 by @oscarbenjamin)

• The function names in the LaTeX printer, take the include sub- and superscripts into account then determining the name length. (e.g.: now a_1 is interpreted as a one letter name with subscript) (#23448 by @Alex031544 and @eagleoflqj)

• Corrected LaTeX- and pretty-printing of Adjoint, Determinant, Inverse, and Transpose. (#22773 by @dispasha and @oscargus)

• LaTeX printing of elements of AlgebraicFields is repaired (in terms of both speed and appearance). (#23339 by @skieffer)

• NumExprPrinter now handles codegen AST objects. (#23196 by @ThePauliPrinciple)

• Allow to configure differential operator in latex printer. Default is "d". (#23239 by @eagleoflqj)

• Fixed a bug in pretty_print, where sympy.vector objects were being incorrectly printed in certain cases. (#23191 by @wermos)

• The LaTeX printer now uses \Delta instead of \triangle for the Laplace operator. (#23200 by @wermos)

• NumPyPrinter and TensorflowPrinter have improved support for array expressions. (#22950 by @ThePauliPrinciple)

• series

• fixes bug in series and now series expansion with float does not give NotImplementedError. (#23456 by @praneethratna)

• Fixes limit computations where arg0 would evaluate to S.NaN for the ceiling and floor functions. (#23258 by @anutosh491)

• Fixed leading term method inconsistency for expressions involving variables in powers. (#23241 by @anutosh491)

• Fixes leading term for exponential functions involving AccumBounds based arguments. (#23127 by @anutosh491)

• Improved Consistency between basic limits and added _eval_as_leading_term for csc function. (#22905 by @anutosh491)

• Fixes series for expressions of type Pow having unspecified exponents (#22870 by @anutosh491)

• solvers

• A number of incorrect results from rsolve fixed by backport/cherry-pick from diofant (by @skirpichev) (#23567 by @ehren and @skirpichev)

• A bug was fixed in the hypergeometric solver so that classify_ode() does not raise PolynomialError for certain ODEs. (#23478 by @praneethratna)

• A bug leading to incorrect solutions of some radical equations from solveset was fixed. (#23341 by @maurogaravello)

• nonlinsolve now handles all polynomial equations using polynomial methods. (#23011 by @NikhilSDate)

• solve_poly_system accepts a keyword argument strict and raises NotImplementedError if it is not able to find a complete solution and strict is True (#23011 by @NikhilSDate)

• solve_generic accepts a keyword argument strict and raises NotImplementedError if it is not able to find a complete solution and strict is True (#23011 by @NikhilSDate)

• improved detection of Lambert solutions when a power of x appear in log (#23255 by @praneethratna and @smichr)

• solve will give more factored results automatically when solving binomial expressions with similar powers in the constant term -- like when solving x**3 - (1 - y)**6 for x. (#22781 by @smichr)

• bug involving error sometimes raised when using the as_set=True flag was fixed (#23182 by @smichr)

• a bug fix in checking solutions now allows more complete solutions to some nonlinear systems using solve (#22719 by @smichr)

• use of the flag quick wthout setting particular=True will raise an error (#22719 by @smichr)

• an error is raised if particular is True but a single equation (not in a list) was passed to solve (#22719 by @smichr)

• when using particular=True an error is no longer raised when a solution compatible with assumptions is not found (#22719 by @smichr)

• a bug where less than complete solutions were being returned for systems of equations from solve was addressed (#22719 by @smichr)

• checksol no longer produces an error if ints or floats are passed as equations (#22866 by @NikhilSDate and @smichr)

• Added Min/Max support for decompogen. (#23021 by @praneethratna and @smichr)

• stats

• The PyMC3 library that can optionally be used for random sampling is now replaced by PyMC version 4. It is still possible to install and use pymc3 as SymPy tries to select an available version, but for new code it is recommended to use pymc. (#23678 by @oscargus)

• Registered more distributions that can be sampled using numpy. (#23346 by @KuldeepBorkar)

• removed deprecation warning about using evaluate=False (#22677 by @smichr)

• testing

• The kw flag to test() is now case insensitive. (#23062 by @asmeurer)
• utilities

• Pass keyword arguments of filldedent() through to textwrap.fill(). (#23193 by @asmeurer)
• itertools.subsets() and itertools.variations() should be a bit faster. The return type of these functions now depends on the arguments, but is always an iterator. In particular, isinstance(result, collections.abc.Iterator) should always be True. (#23063 by @rathmann)
• vector

• Scalar condition of vectors made False (#23033 by @faze-geek)

• BREAKING: removed deprecated CoordSysCartesian class. (#22952 by @oscargus)

• BREAKING: removed deprecated delop method of CoordSys3D. (#22952 by @oscargus)

• BREAKING: removed deprecated system keyword argument of Del. (#22952 by @oscargus)

• BREAKING: removed deprecated coord_sys keyword argument of curl, divergence, and gradient. (#22952 by @oscargus)

• other

• A new, user-friendly page on solving of various types in SymPy was added to the Guides page. (#23462 by @bertiewooster)
• Fixed several issues with __slots__ (overlaps and omission in base classes) (#22924 by @ariebovenberg)