Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9381 > unrolled thread

Re: ReplacePart, Multiple replacements in one time

Started byBill Rowe <readnews@sbcglobal.net>
First post2012-04-03 08:51 +0000
Last post2012-04-03 08:51 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: ReplacePart, Multiple replacements in one time Bill Rowe <readnews@sbcglobal.net> - 2012-04-03 08:51 +0000

#9381 — Re: ReplacePart, Multiple replacements in one time

FromBill Rowe <readnews@sbcglobal.net>
Date2012-04-03 08:51 +0000
SubjectRe: ReplacePart, Multiple replacements in one time
Message-ID<jledmi$h2c$1@smc.vnet.net>
On 4/2/12 at 4:27 AM, andrey.demidov@gmail.com (Andrey Demidov)
wrote:

>I'm just wondering if it is possible to make n different
>replacements in one command?

>Something like this:

>>>a = {{1, 2}, {3, 4}} ReplacePart[a, 1 -> a[[1]] * 2, 2 -> a[[2]] +
>>>5]

Yes, its possible as demonstrated by:

In[3]:= a = {{1, 2}, {3, 4}};
ReplacePart[a, {1 -> 2 a[[1]], 2 -> a[[2]] + 5}]

Out[4]= {{2, 4}, {8, 9}}

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web