ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 10 May 2015 20:26:52 +0200Can I use the block_matrix command to create arbitrary sizes of block matrix arrays?https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/ Like say I want to create a $4k \times 4k$ size matrix by putting together certain $4\times 4$ matrices into a $k \times k$ array.
- Can the "block_matrix" command help me create such a $4k \times 4k$ array of 0s called $A$ ? (such later I can say something like $A[a,b] = X$ where $0 \leq a,b \leq k$ and $X$ is some $4\times 4$ matrix and that will assign the matrix $X$ at the $(a,b)$ array position) Sat, 09 May 2015 20:40:56 +0200https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/Answer by calc314 for <p>Like say I want to create a $4k \times 4k$ size matrix by putting together certain $4\times 4$ matrices into a $k \times k$ array. </p>
<ul>
<li>Can the "block_matrix" command help me create such a $4k \times 4k$ array of 0s called $A$ ? (such later I can say something like $A[a,b] = X$ where $0 \leq a,b \leq k$ and $X$ is some $4\times 4$ matrix and that will assign the matrix $X$ at the $(a,b)$ array position) </li>
</ul>
https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?answer=26781#post-id-26781 Please read http://www.sagemath.org/doc/reference/matrices/sage/matrix/constructor.html for some details.
I think you will need to specify the submatrices first and then build the block matrix. Of course, you might be able to write your own code to do exactly what you are suggesting.Sat, 09 May 2015 21:19:30 +0200https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?answer=26781#post-id-26781Comment by phoenix for <p>Please read <a href="http://www.sagemath.org/doc/reference/matrices/sage/matrix/constructor.html">http://www.sagemath.org/doc/reference...</a> for some details.</p>
<p>I think you will need to specify the submatrices first and then build the block matrix. Of course, you might be able to write your own code to do exactly what you are suggesting.</p>
https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?comment=26782#post-id-26782Thats a very generic description. Is there something specific which helps?Sat, 09 May 2015 23:42:06 +0200https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?comment=26782#post-id-26782Comment by phoenix for <p>Please read <a href="http://www.sagemath.org/doc/reference/matrices/sage/matrix/constructor.html">http://www.sagemath.org/doc/reference...</a> for some details.</p>
<p>I think you will need to specify the submatrices first and then build the block matrix. Of course, you might be able to write your own code to do exactly what you are suggesting.</p>
https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?comment=26783#post-id-26783Some basic things about matrices don't seem to work, like,
Z = matrix([[1,0],[2,3]])
Z.charpoly(y)Sun, 10 May 2015 01:23:31 +0200https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?comment=26783#post-id-26783Comment by calc314 for <p>Please read <a href="http://www.sagemath.org/doc/reference/matrices/sage/matrix/constructor.html">http://www.sagemath.org/doc/reference...</a> for some details.</p>
<p>I think you will need to specify the submatrices first and then build the block matrix. Of course, you might be able to write your own code to do exactly what you are suggesting.</p>
https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?comment=26789#post-id-26789Those commands are working well for me. But, you must begin by declaring y to be a variable using the command `var('y')`.Sun, 10 May 2015 20:26:52 +0200https://ask.sagemath.org/question/26780/can-i-use-the-block_matrix-command-to-create-arbitrary-sizes-of-block-matrix-arrays/?comment=26789#post-id-26789