Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10792
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Modifying an entry in array specified by a list of arbitrary length |
| Date | 2012-07-05 10:11 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jt3p86$102$1@smc.vnet.net> (permalink) |
On 7/4/12 at 3:32 AM, samid.hoda@gmail.com wrote:
>I want to edit an element whose position is specified by an
>arbitrary list that is a result of a computation (the list is not of
>fixed length). Something like
>i = {1,2,3} Extract[X,i]+=1
>except that Extract passes X by value instead of by reference.
>Anyone have any ideas?
In[1]:= data = RandomReal[1, 5];
data + SparseArray[{2 -> 1}, Length@data]
Out[2]= {0.792931,1.11432,0.235235,0.730301,0.48574}
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Modifying an entry in array specified by a list of arbitrary length Bill Rowe <readnews@sbcglobal.net> - 2012-07-05 10:11 +0000
csiph-web