Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9367 > unrolled thread
| Started by | Andrey Demidov <andrey.demidov@gmail.com> |
|---|---|
| First post | 2012-04-02 08:30 +0000 |
| Last post | 2012-04-03 08:54 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
ReplacePart, Multiple replacements in one time Andrey Demidov <andrey.demidov@gmail.com> - 2012-04-02 08:30 +0000
Re: ReplacePart, Multiple replacements in one time nanobio9 <kuokan.liang@gmail.com> - 2012-04-03 08:49 +0000
Re: ReplacePart, Multiple replacements in one time Rodrigo Murta <murta@rodrigomurta.com> - 2012-04-03 08:54 +0000
| From | Andrey Demidov <andrey.demidov@gmail.com> |
|---|---|
| Date | 2012-04-02 08:30 +0000 |
| Subject | ReplacePart, Multiple replacements in one time |
| Message-ID | <jlbo41$47q$1@smc.vnet.net> |
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]
[toc] | [next] | [standalone]
| From | nanobio9 <kuokan.liang@gmail.com> |
|---|---|
| Date | 2012-04-03 08:49 +0000 |
| Message-ID | <jledjl$h0k$1@smc.vnet.net> |
| In reply to | #9367 |
Hi,
> 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]
Just put curly braces around your list of replacements:
a = {{1, 2}, {3, 4}}
ReplacePart[a, {1 -> a[[1]] * 2, 2 -> a[[2]] + 5}]
[toc] | [prev] | [next] | [standalone]
| From | Rodrigo Murta <murta@rodrigomurta.com> |
|---|---|
| Date | 2012-04-03 08:54 +0000 |
| Message-ID | <jledsa$h4a$1@smc.vnet.net> |
| In reply to | #9367 |
On Apr 2, 5:30 am, Andrey Demidov <andrey.demi...@gmail.com> 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]
Maybe like this?
ReplacePart[a, {1 -> a[[1]]*2, 2 -> a[[2]] + 5}]
best regards
Murta
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web