Hi Lucy,

Running on master I get this:

In [13]: sym.BlockMatrix([[a], [phi], [theta]])
Out[13]:
⎡⎡0⎤⎤
⎢⎢ ⎥⎥
⎢⎢0⎥⎥
⎢⎢ ⎥⎥
⎢⎣0⎦⎥
⎢   ⎥
⎢ φ ⎥
⎢   ⎥
⎣ θ ⎦

In [14]: sym.BlockMatrix([[a], [phi], [theta]]).shape
Out[14]: (11, 1)

Note that I've used extra square brackets to indicate that I want
these combined column-wise. Without those I get:

In [11]: sym.BlockMatrix([a, phi, theta])
Out[11]:
⎡⎡0⎤      ⎤
⎢⎢ ⎥      ⎥
⎢⎢0⎥  φ  θ⎥
⎢⎢ ⎥      ⎥
⎣⎣0⎦      ⎦

In [12]: sym.BlockMatrix([a, phi, theta]).shape
Out[12]: (3, 3)

It's unfortunate that the sizes aren't checked there since those are
inconsistent.

It looks like the main problem you're having is fixed in master. What
version of SymPy are you using?


--
Oscar

On Wed, 19 Jun 2019 at 15:15, Lucy Jackson <lucy.jackson....@gmail.com> wrote:
>
> Hi,
>
> I am looking to concatenate three matrices (shown below) using BlockMatrix, 
> however, the output has the wrong dimensions.
>
> theta = sym.MatrixSymbol('theta', 5, 1)
> phi = sym.MatrixSymbol('phi', 3, 1)
> a = sym.Matrix([[0],[0],[0]])
>
> X = sym.BlockMatrix([a, phi, theta])
>
> With this code I get the following output:
>
>  X = Matrix([
>
> [          0],
> [          0],
> [          0],
> [  phi[0, 0]],
> [theta[0, 0]]])
>
>
> However, I am expecting an output thats 11 x 1. I am also unable to check the 
> shape of X as X.shape yields the following error:
>
>
> AttributeError: 'Zero' object has no attribute 'shape'
>
>
> Any help would be greatly appreciated!
>
>
> Many Thanks,
>
>
> Lucy
>
>
>
> --
> 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 https://groups.google.com/group/sympy.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/76c6868d-b014-4b87-a514-f60a574ad7bd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxT3Tzw44EEt7JjbsKaBfNwNONBGNJ%2BbYEmjFuHFCrdgcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to