Possible bug with MatrixSymbol and subs(titution)

43 views
Skip to first unread message

Nathan Thern

unread,
Nov 4, 2016, 2:37:11 PM11/4/16
to sympy
Does this session illustrate a bug, or am I missing a concept here?

Jupyter console 5.0.0
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import sympy
In [2]: sympy.__version__
Out[2]: '1.0'
In [3]: from sympy import *
In [4]: A=MatrixSymbol('A',1,3)
In [5]: B=MatrixSymbol('B',1,3)
In [6]: C=MatrixSymbol('C',1,3)
In [7]: E=A-B
In [8]: F=C[0,0]
In [9]: F.subs(C,E)
Out[9]: (-1)*B + A[0, 0]
In [10]:


I would think the output of the last command should be
(-1)*B[0,0] + A[0, 0]


Aaron Meurer

unread,
Nov 4, 2016, 7:15:23 PM11/4/16
to sy...@googlegroups.com
Yes, this is a bug (can you open an issue for it?). It looks like the
expression is correct, but the printer isn't putting parentheses
around the (-B + A).

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/f37123a0-328c-4268-b44e-59534e3d61ef%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Nathan Thern

unread,
Nov 7, 2016, 10:01:53 AM11/7/16
to sympy


On Friday, November 4, 2016 at 6:15:23 PM UTC-5, Aaron Meurer wrote:
Yes, this is a bug (can you open an issue for it?).

Done.
Issue #11821
 

Francesco Bonazzi

unread,
Nov 7, 2016, 6:30:09 PM11/7/16
to sympy


On Monday, 7 November 2016 16:01:53 UTC+1, Nathan Thern wrote:

Done.
Issue #11821
 
Reply all
Reply to author
Forward
0 new messages