[sympy] Re: sympify and matrices

2008-06-09 Thread Robert Cimrman
Ondrej Certik wrote: Let's clean this up. I sent an email to the numpy-list asking for an advice: http://projects.scipy.org/pipermail/numpy-discussion/2008-June/034801.html I agree with Robert Kern's view that sympy.Matrix should not be tied to numpy.matrix - the latter in numpy has a

[sympy] Re: sympify and matrices

2008-06-09 Thread Pearu Peterson
Hi, Just a quick note that could be relevant to the discussion: check also out http://code.google.com/p/sympycore/wiki/MatrixSupportIdeas that contains ideas how to deal with mutable matrices in operations where they should be immutable, all in a very efficient way. The idea is based on using

[sympy] Re: sympify and matrices

2008-06-09 Thread Ondrej Certik
On Mon, Jun 9, 2008 at 10:40 AM, Pearu Peterson [EMAIL PROTECTED] wrote: Hi, Just a quick note that could be relevant to the discussion: check also out http://code.google.com/p/sympycore/wiki/MatrixSupportIdeas that contains ideas how to deal with mutable matrices in operations where

[sympy] Re: sympify and matrices

2008-06-07 Thread Ondrej Certik
So that's not how I would like this to be. It should either work for all functions or for no functions. I see. I do not use numpy matrices anyway, just arrays, as they are not really the linear algebra matrices, only arrays with some peculiar modifications - they have no extra value that

[sympy] Re: sympify and matrices

2008-06-07 Thread Ondrej Certik
Let's clean this up. I sent an email to the numpy-list asking for an advice: http://projects.scipy.org/pipermail/numpy-discussion/2008-June/034801.html The ultimate reason that Matrix is not a subclass of a Basic is that it is mutable, while SymPy objects need to be immutable, so that when you

[sympy] Re: sympify and matrices

2008-06-07 Thread Ondrej Certik
Disadvantage -- if one needs to set entries of a Matrix using the syntax A[1, 2] = y not only at the beginning of the calculaton, but also in the middle, then he would have to do: A = Matrix(Array(A)[1,2] = y). Of course A[1,2] = y would create an exception saying: use the A =

[sympy] Re: sympify and matrices

2008-06-05 Thread Ondrej Certik
On Thu, Jun 5, 2008 at 4:20 PM, Ondrej Certik [EMAIL PROTECTED] wrote: On Thu, Jun 5, 2008 at 3:50 PM, Robert Cimrman [EMAIL PROTECTED] wrote: Hi, In [16]: sympy.__version__ Out[16]: '0.5.15-hg' In [19]: K = sympy.Matrix(nm.array(1, ndmin = 2)) In [20]: sympy.sympify(K) ...

[sympy] Re: sympify and matrices

2008-06-05 Thread Ondrej Certik
On Thu, Jun 5, 2008 at 3:50 PM, Robert Cimrman [EMAIL PROTECTED] wrote: Hi, In [16]: sympy.__version__ Out[16]: '0.5.15-hg' In [19]: K = sympy.Matrix(nm.array(1, ndmin = 2)) In [20]: sympy.sympify(K) ... NotImplementedError: matrix support Is there a reason for this? Why a Matrix

[sympy] Re: sympify and matrices

2008-06-05 Thread Ondrej Certik
On Thu, Jun 5, 2008 at 4:32 PM, Robert Cimrman [EMAIL PROTECTED] wrote: Ondrej Certik wrote: I just discovered we probably need to think about this: In [1]: a = Matrix((1, x), (2, y)) In [2]: from numpy import array In [3]: a Out[3]: ⎡1 x⎤ ⎣2 y⎦ In [4]: Matrix(sin(array(a))) Out[4]:

[sympy] Re: sympify and matrices

2008-06-05 Thread Robert Cimrman
Ondrej Certik wrote: On Thu, Jun 5, 2008 at 4:32 PM, Robert Cimrman [EMAIL PROTECTED] wrote: Ondrej Certik wrote: I just discovered we probably need to think about this: In [1]: a = Matrix((1, x), (2, y)) In [2]: from numpy import array In [3]: a Out[3]: ⎡1 x⎤ ⎣2 y⎦ In [4]: