Currently I am going through the functions available in Matrix. One thing
that I have noted as a ordinary python programmer(note the developer) :
*Huge error is displayed if we call the functions with incorrect parameter.*
*For example: *
Following set of code will be an error as I am trying to access the matrix
element out of index range.
*from sympy import **
*M = Matrix([[1, 2, 3], [3, 2, 1]])*
*print(M.col(3))*
*output:*
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\sympy\matrices\dense.py", line 74, in
__ge
titem__
i, j = self.key2ij(key)
File "C:\Python33\lib\site-packages\sympy\matrices\matrices.py", line
1087, in
key2ij
for i, n in zip(key, self.shape)]
File "C:\Python33\lib\site-packages\sympy\matrices\matrices.py", line
1087, in
<listcomp>
for i, n in zip(key, self.shape)]
File "C:\Python33\lib\site-packages\sympy\matrices\matrices.py", line
4125, in
a2idx
raise IndexError("Index out of range: a[%s]" % (j, ))
IndexError: Index out of range: a[3]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "matrix.py", line 3, in <module>
print(M.col(3))
File "C:\Python33\lib\site-packages\sympy\matrices\dense.py", line 195,
in col
return self[:, j]
File "C:\Python33\lib\site-packages\sympy\matrices\dense.py", line 89, in
__ge
titem__
return self.extract(i, j)
File "C:\Python33\lib\site-packages\sympy\matrices\matrices.py", line
1039, in
extract
colsList = [a2idx(k, self.cols) for k in colsList]
File "C:\Python33\lib\site-packages\sympy\matrices\matrices.py", line
1039, in
<listcomp>
colsList = [a2idx(k, self.cols) for k in colsList]
File "C:\Python33\lib\site-packages\sympy\matrices\matrices.py", line
4125, in
a2idx
raise IndexError("Index out of range: a[%s]" % (j, ))
IndexError: Index out of range: a[3]
*This huge error is not needed for an ordinary programmer who will not be
interested in the code of the library used. Only he/she must be notified
that matrix is access index out of range. So only the following two lines
are enough. It is just my own opinion.*
File "matrix.py", line 3, in <module> print(M.col(3))
IndexError: Index out of range: a[3]
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/9b201084-fd8d-4946-bdf7-0f800f74f540%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.