Ask Your Question
1

creating a matrix from blocks

asked 2012-11-29 12:30:58 -0500

Dionysus gravatar image

updated 2012-11-29 18:27:37 -0500

I am new to SAGE. I need to create a matrix by using matrices of different sizes. For example:

Abar= [(A + B), C]
      [  D ,    E]

where A and B are 2x2's, C is a 2x1, D is a 1x2, and E is a 1x1. I do not need Abar to be a partitioned matrix. Thanks much.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2012-11-29 13:32:19 -0500

fidbc gravatar image

updated 2012-11-29 13:43:29 -0500

Here is a way of getting Abar

sage: Abar=block_matrix([[(A+B),C],[D,E]])

Update: Using @calc314's suggestion for no subdivisions:

sage: Abar=block_matrix([[(A+B),C],[D,E]], subdivide=False)
edit flag offensive delete link more

Comments

1

If you don't want the subdivisions, you can use: `block_matrix([[a+b,c],[d,e]],subdivide=False)`

calc314 gravatar imagecalc314 ( 2012-11-29 13:36:29 -0500 )edit

Nice! I'll update the answer above.

fidbc gravatar imagefidbc ( 2012-11-29 13:40:11 -0500 )edit

Thanks much, but I still get a syntax error. I have double checked the matrices A,B,C,D, and E by using print and dimensions are correct. The matrices do contain symbolic variables that have been defined using var. Any suggestions? Thanks.

Dionysus gravatar imageDionysus ( 2012-11-30 17:39:31 -0500 )edit
0

answered 2012-11-30 13:16:53 -0500

Dionysus gravatar image

Thanks much, but I still get a syntax error. I have double checked the matrices A,B,C,D, and E by using print and dimensions are correct. The matrices do contain symbolic variables that have been defined using var. Any suggestions? Thanks.

edit flag offensive delete link more

Comments

Please post all of your code or a simplified example so we can take a look at the situation.

calc314 gravatar imagecalc314 ( 2012-12-01 00:22:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-29 12:30:58 -0500

Seen: 206 times

Last updated: Nov 30 '12