sympy/sympy — Issue #1067: Slicing of column vectors 
Author: strasdat
Created: 2012-02-17 15:37:08+00:00
State: open

A slicing operation turn a column vector into a row vector. Is this behavior intended? At least it feels very contra-intuitive.
(In MATLAB, v[1:3] is equivalent to v[:,1:3]. I was expecting the same...)

In [1]: col = Matrix([1,2,3,4])

In [2]: col
Out[2]:
⎡1⎤
⎢ ⎥
⎢2⎥
⎢ ⎥
⎢3⎥
⎢ ⎥
⎣4⎦

In [3]: sub_col = col[0:2]

In [4]: sub_col
Out[4]: [1, 2]

>> Even worse, the following does not work either:

In [5]: sub_col = col[:,0:2]

In [6]: sub_col
Out[6]:
⎡1⎤
⎢ ⎥
⎢2⎥
⎢ ⎥
⎢3⎥
⎢ ⎥
⎣4⎦

How do I create a column slice?