[sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-13 Thread Shriramana Sharma
Hello. In my program I am having to do this: PartDerivs [ - ( n + 1 ) : ] = PartDerivs [ - ( n + 1 ) : ] . subs ( { Ep ( 0 ) : 0, De ( n ) : 0 } ) but this fails saying: AttributeError: 'list' object has no attribute 'subs' There is a curious behaviour of Matrix w.r.t slicing: In [1]: from sy

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-13 Thread Chris Smith
On Thu, Dec 13, 2012 at 8:55 PM, Shriramana Sharma wrote: > Hello. > > In my program I am having to do this: > > PartDerivs [ - ( n + 1 ) : ] = PartDerivs [ - ( n + 1 ) : ] . subs ( { > Ep ( 0 ) : 0, De ( n ) : 0 } ) > > but this fails saying: > > AttributeError: 'list' object has no attribute 'su

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-13 Thread Aaron Meurer
First off, what you are doing would not work, because Matrix slices to not provide "views" to the Matrix, like numpy arrays. So assigning to a slice would not work. I agree that a slice should return a Matrix, though, to be consistant. In the future, we may implement a view model. This would hel

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-13 Thread Matthew Rocklin
Something like a view will soon be necessary for my work. This will probably be in MatrixExprs in a few months. On Thu, Dec 13, 2012 at 3:35 PM, Aaron Meurer wrote: > First off, what you are doing would not work, because Matrix slices to > not provide "views" to the Matrix, like numpy arrays.

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-13 Thread smichr
On Friday, December 14, 2012 3:20:26 AM UTC+5:45, Aaron Meurer wrote: > > First off, what you are doing would not work, because Matrix slices to > not provide "views" to the Matrix, like numpy arrays. So assigning to > a slice would not work. > > If you mean that modifying a slice doesn't mod

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-14 Thread Shriramana Sharma
On Fri, Dec 14, 2012 at 3:05 AM, Aaron Meurer wrote: > > I agree that a slice should return a Matrix, though, to be consistant. Hi and thanks people for your replies. It is good to know that there is a workaround by using index by tuple (i.e. [5,:] or [5:,:]) notation for now, but I also would e

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-14 Thread Chris Smith
On Fri, Dec 14, 2012 at 8:58 PM, Shriramana Sharma wrote: > On Fri, Dec 14, 2012 at 3:05 AM, Aaron Meurer wrote: > > > > I agree that a slice should return a Matrix, though, to be consistant. > > Hi and thanks people for your replies. > > It is good to know that there is a workaround by using ind

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-14 Thread Aaron Meurer
On Fri, Dec 14, 2012 at 8:13 AM, Shriramana Sharma wrote: > On Fri, Dec 14, 2012 at 3:05 AM, Aaron Meurer wrote: >> >> I agree that a slice should return a Matrix, though, to be consistant. > > Hi and thanks people for your replies. > > It is good to know that there is a workaround by using index

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-14 Thread Aaron Meurer
Ah, OK. I didn't realize that that worked. Still, in a true view, any mutable operation would apply to the given slice in place. Aaron Meurer On Thu, Dec 13, 2012 at 9:05 PM, smichr wrote: > > > On Friday, December 14, 2012 3:20:26 AM UTC+5:45, Aaron Meurer wrote: >> >> First off, what you are

Re: [sympy] Why does slicing a vector matrix return a builtins.list?

2012-12-14 Thread Ronan Lamy
Le 14/12/2012 15:13, Shriramana Sharma a écrit : How about this -- it doesn't seem as if Matrix has any operator() i.e. __call__: from sympy import Matrix a=Matrix(2,2,(1,2,3,4)) a(1,1) Traceback (most recent call last): File "", line 1, in TypeError: 'MutableMatrix' object is not callabl