Comment #13 on issue 1128 by [email protected]: .rref() sometimes returns invalid results
http://code.google.com/p/sympy/issues/detail?id=1128

Here's another instance of the problem that my provide insight. Create a symbolic matrix where each individual column sums to zero. This is clearly a singular matrix, and you can easily get a row of zeros by adding all the rows together. rref(), however, returns the identity matrix for the reduction.

In [1]: import sympy as sym

In [2]: from sympy import Matrix

In [3]: P = Matrix(sym.symbols(tuple('P'+str(ii)+'_0:'+str(4) for ii in range(4))))

In [4]: for ii in xrange(4):
        P[ii,ii] = -(sum(P[:,ii])-P[ii,ii])


In [5]: P
Out[5]:
[-P1_0 - P2_0 - P3_0, P0_1, P0_2, P0_3] [ P1_0, -P0_1 - P2_1 - P3_1, P1_2, P1_3] [ P2_0, P2_1, -P0_2 - P1_2 - P3_2, P2_3] [ P3_0, P3_1, P3_2, -P0_3 - P1_3 - P2_3]

In [6]: sum(P[:,0]), sum(P[:,1]), sum(P[:,2]), sum(P[:,3])
Out[6]: (0, 0, 0, 0)

In [7]: P.rref()
Out[7]:
([1, 0, 0, 0]
[0, 1, 0, 0]
[0, 0, 1, 0]
[0, 0, 0, 1], [0, 1, 2, 3])

Hope this helps!

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

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


Reply via email to