Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Matrices

New issue 2220 by asmeurer: Bug with Matrix.is_symbolic and Matrix.is_upper
http://code.google.com/p/sympy/issues/detail?id=2220


In [47]: a = Matrix([[1, 2, 3]])

In [48]: a.is_symbolic()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in <module>()

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/matrices/matrices.pyc in is_symbolic(self)
   1213         for i in range(self.cols):
   1214             for j in range(self.rows):
-> 1215                 if self[i,j].has(Symbol):
   1216                     return True
   1217         return False

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/matrices/matrices.pyc in __getitem__(self, key)
    256
257 if not (i>=0 and i<self.rows and j>=0 and j < self.cols): --> 258 raise IndexError("Index out of range: a[%s]" % (key,))
    259                 else:
    260                     return self.mat[i*self.cols + j]

IndexError: Index out of range: a[(1, 0)]

In [49]: a.is_upper()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in <module>()

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/matrices/matrices.pyc in is_upper(self)
   1199         for i in range(self.cols):
   1200             for j in range(self.rows):
-> 1201                 if i > j and self[i,j] != 0:
   1202                     return False
   1203         return True

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/matrices/matrices.pyc in __getitem__(self, key)
    256
257 if not (i>=0 and i<self.rows and j>=0 and j < self.cols): --> 258 raise IndexError("Index out of range: a[%s]" % (key,))
    259                 else:
    260                     return self.mat[i*self.cols + j]

IndexError: Index out of range: a[(1, 0)]

In [50]: a.is_lower()
Out[50]: True


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to