Matrices are mutable as default in SymPy.
You would either have to copy

>>> from sympy import *

>>> q = Matrix([[x,x+1],[x-1,x+2]])
>>> w = q.copy()
>>> w.col_del(0)

Or use ImmutableMatrix

>>> from sympy import *

>>> q = ImmutableDenseMatrix([[x,x+1],[x-1,x+2]])
>>> w = q
>>> w1 = w.col_del(0)

Python lists also have the same philosophy, so you would have to use 
mutable ones carefully.

On Friday, May 3, 2019 at 4:50:29 PM UTC+9, [email protected] wrote:
>
> Hello,
>   
>     I am new to sympy and I want removed one column of a matrix and I want 
> to keep the original one also but when I use col_del() command it deletes 
> the column for all matrices. Do you have idea how I can keep original while 
> I changing matrix with another name?
> The example I am writing is like that
>
>     q=sp.Matrix([[x,x+1],[x-1,x+2]])
>     
>     w=q
>     
>     w.col_del(0)
>     w1=w
>
>   Then all q, w, w1 have deleted columns but I want to keep q unchanged.
>
>

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/96e187d8-b9eb-4d84-b569-8549cd842fc1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to