sympy/sympy — pull request #1354 by EnricoGiampieri (2012-06-14 14:30:49+00:00)
Title: bug fix on the BaseMatrix Class

Hi!
Yesterday i found a small bug in the BaseMatrix class, that led to an exception when a SparseMatrix has zero determinant because it try to use the method expand on an object that doesn't have it (the number 0).
It is simply fixed by using the standard expand instead of the object method.

This is my first patch ever, so please forgive me if i missed some step in the process.
Thank you very much for the grat job on sympy.
Enrico.

A small code to replicate the error:

N=3
def f(i,j):
if i==j: return -x-y
elif i==j+1: return y
elif i==j-1: return x
elif i==0 and j==N-1: return y
elif i==N-1 and j==0: return x
else: return Rational(0)
R=SparseMatrix(N,N,f)
print R.det()