sympy/sympy — pull request #2193 by seshagiriprabhu (2013-06-19 16:04:20+00:00)
Title: MutableMatrix.is_Piecewise

Porblem: Matrix.eye(3).is_Piecewise fails but S(Matrix.eye(3)).is_Piecewise does not because S() turns it into an
ImmutableMatrix. So the Mutable version does not have at least this (and maybe more) attributes set.

Solution: After a regular expression search through the code base, I found that is_Piecewise variable is declared in
sympy/core/basic.py as

is_Piecewise = False

which is never updated once it is initialized.
As "S(What_ever_matrix).is_Piecewise" always returns False value, is it fine to add this line to sympy/matrices/matrices.py:

is_Piecewise = False.

Which resolves the problem of the MutableMatrices at least for the above mentioned test case
After making the changes to the code, this the output:

>>> A=Matrix([(1, 2, 3), (2, 3, 4), (5, 6, 7)])
>>>A
Matrix([
[1, 2, 3],
[2, 3, 4],
[5, 6, 7]])
>>> A.is_Piecewise
False
>>> S(A).is_Piecewise
False
>>>

All the tests were passed after making the changes.