MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: (Q:) ReplacePart + SubMatrix replacement

  • To: mathgroup at
  • Subject: [mg7066] Re: [mg7033] (Q:) ReplacePart + SubMatrix replacement
  • From: Allan Hayes <hay at>
  • Date: Sat, 3 May 1997 22:04:56 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Fri, 2 May 1997
"m.r." <schaferk at>
[mg7033] (Q:) ReplacePart + SubMatrix replacement

> For A,B n-by-n,  matrices,
> K  non empty subset of CartesianProduct[Range[n],Range[n]]...
> i wish to replace the block A[[K]] with the block B[[K]]

As you comment in your full message (copied below ****) ReplacePart  
does not seem to perform as expected.

A = Table[0,{3},{3}]
B = Table[1,{3},{3}]
A[[{1,3},{2,3}]] = B[[{1,3},{2,3}]];
Of course, much more is possible using this technique
Allan Hayes
hay at

Begin forwarded message:

>From: "m.r." <schaferk at>
>To: mathgroup at
>Subject: [mg7033] (Q:) ReplacePart + SubMatrix replacement
>Organization: Communique Inc.


Mma3.0 has added a form of ReplacePart not found in Mma2.2.2:


ReplacePart[expr,new,pos,npos] replaces parts at positions pos
	in expr by parts at positions npos in new.

A,B n-by-n,  matrices,
K  non empty subset of CartesianProduct[Range[n],Range[n]]

one can use


to replace the block A[[K]] with B[[1,1]]. (no problem)

what i wish ( though perhaps unrealistically) is



to replace the block A[[K]] with the block B[[K]].

am i misreading the above usage message for ReplacePart?

if so, how does one do a simple block replace in "one fell swoop"?


m. r.

email replies to

schaferk at

  • Prev by Date: Re: Extracting functions from Solve
  • Next by Date: Re: How to return the position of a multidimensional list ..
  • Previous by thread: (Q:) ReplacePart + SubMatrix replacement
  • Next by thread: Export of HTML/GIF broken on NextStep/Intel?