Re: Matrix Manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg16427] Re: Matrix Manipulation
- From: Hartmut Wolf <hw at gsmail01.darmstadt.dsh.de>
- Date: Sat, 13 Mar 1999 02:21:42 -0500
- Organization: debis Systemhaus
- References: <7c5bl0$7rt@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Andreas Andreas Paul Friedrich Bernhard schrieb: > > I am trying to modify the elements of a submatrix in a matrix, without > having to replace each element explicitly > > for example: > mm = { {1,2,3}, {4,5,6}, {7,8,9} } > msub = { {21,22}, {23,24} } > I now wish to add the sub matrix: to positions (1,1),(1,3),(3,1),(3,3) > p={{1,1},{1,3},{3,1},{3,3}}; MapAt[#+msub&, mm, p] gives --> {{ {{22,23},{24,25}}, 2, {{24,25},{26,27}} }, { 4, 5, 6 }, { {{28,29},{30,31}}, 8, {{30,31},{32,33}} }} (spaces adjusted by hand to mimik TableForm) ---Hartmut