MathGroup Archive 2013

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

Search the Archive

Re: Adding value to some elements of a list


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



  • Prev by Date: Re: Applications and Packages, WRI Strikes Out!
  • Next by Date: Re: Adding value to some elements of a list
  • Previous by thread: Re: Adding value to some elements of a list
  • Next by thread: Re: Adding value to some elements of a list