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


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

Re: ReplacePart, Multiple replacements in one time

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: ReplacePart, Multiple replacements in one time
Date 2012-04-03 08:51 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jledmi$h2c$1@smc.vnet.net> (permalink)

Show all headers | View raw


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}}

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web