Hi all

>>> from sympy import *
>>> M = Matrix( [ [1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6] ] )
>>> M.row_del ( 8 )                                            # any index 
>= M.rows to be used
>>> print( M )
Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5] ] )               # deletes the 
last row of Matrix for Index >= M.rows

>>> N = Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6] ] )
>>> N.row_del( -10 )
>>> print( N )                                                     # 
deletes the last row of Matrix with any `Negative Index`
Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5] ] )

But the output for .row_insert() shows different behavior

>>> M = Matrix( [ [1, 2, 3], [2, 3, 4], [3, 4, 5] ] )
>>> M.row_insert ( 10, Matrix( [ [ 5, 5, 5 ] ] ) )
Matrix( [ [1, 2, 3], [2, 3, 4], [3, 4, 5], [5, 5, 5] ] )   # inserts the 
row at the very end for Index >= M.rows

>>> N = Matrix( [ [ 1, 2, 3], [2, 3, 4], [3, 4, 5] ] )
>>> N.row_insert( -10, Matrix( [ [5, 5, 5 ] ] ) )
Matrix( [ [5, 5, 5], [1, 2, 3], [2, 3, 4], [3, 4, 5] ] )     # inserts the 
row at the very beginning for `Negative Index`


First of all i  expected that an IndexError be raised in all cases. Because 
i think it should follow something like  a = [1, 2, 3] and del a[ 10 ] 
which raises an error. 
But even if not error then it should be more consistent with the indices. 
Is it the way the things are expected to work ?

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
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/5f4fb1ab-2f0d-4264-8960-754d57ee1317%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to