Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14766
| From | Kurt TeKolste <ektekolste@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Adding value to some elements of a list |
| Date | 2013-06-06 11:50 +0000 |
| Message-ID | <kopt23$da1$1@smc.vnet.net> (permalink) |
| References | <komoi3$1un$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
I am afraid that the answer is much easier than so far offered.
Setup
In[8]:= a=10 Range[6]
Out[8]= {10,20,30,40,50,60}
In[9]:= b=2Range[3]
Out[9]= {2,4,6}
Here is what you are looking for
In[10]:= a[[b]]+=17
Out[10]= {37,57,77}
Check resultIn[11]:= a
Out[11]= {10,37,30,57,50,77}
Kurt
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Adding value to some elements of a list Joerg Lenhardt <joerg.lenhardt@FernUni-Hagen.de> - 2013-06-05 07:15 +0000 Re: Adding value to some elements of a list David Bailey <dave@removedbailey.co.uk> - 2013-06-06 11:23 +0000 Re: Adding value to some elements of a list Kurt TeKolste <ektekolste@gmail.com> - 2013-06-06 11:50 +0000
csiph-web