Ask Your Question
1

creating a matrix from blocks

asked 2012-11-29 19:30:58 +0200

Dionysus gravatar image

updated 2012-11-30 01:27:37 +0200

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 20:32:19 +0200

fidbc gravatar image

updated 2012-11-29 20:43:29 +0200

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 20:36:29 +0200 )edit

Nice! I'll update the answer above.

fidbc gravatar imagefidbc ( 2012-11-29 20:40:11 +0200 )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-12-01 00:39:31 +0200 )edit
0

answered 2012-11-30 20:16:53 +0200

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

1

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 07:22:03 +0200 )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 19:30:58 +0200

Seen: 1,464 times

Last updated: Nov 30 '12