Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3201
| From | Jonathan Frazer <J.Frazer@sussex.ac.uk> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Multiple use of Set on lists |
| Date | 2011-06-20 23:38 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <itolks$erm$1@smc.vnet.net> (permalink) |
| References | <itm0of$143$1@smc.vnet.net> <201106201204.IAA07658@smc.vnet.net> |
Hello,
I have a largish list of awkwardly "indexed variables", of the form cs =
{c[1/2][-(1/2)][1/2][-(1/2)][-1], c[1/2][-(1/2)][1/2][1/2][-1]......etc....
....} which need to be assigned random values multiple times inside a Do loop. I was hoping I could generate a new list of random numbers each time then do something like
MapThread[Set, {cs, rands}]
Where "rands" would be the list of random numbers. I'm clearly misunderstanding how MapThread works though as this doesn't work. Rather than getting "c[1/2][-(1/2)][1/2][-(1/2)][-1]=new random number", instead "old random number=new random number" is what seems to be happening.
As a last resort I thought I would just clear the variables at the beginning of the do loop but you can't use Clear to do this and I don't see how you can apply "=." (Unset) over a list either.
Any suggestions?
Many thanks,
Jonny
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to find one expression in terms of another expression? Jacare Omoplata <walkeystalkey@gmail.com> - 2011-06-19 23:29 +0000
Re: How to find one expression in terms of another expression? Ray Koopman <koopman@sfu.ca> - 2011-06-20 23:37 +0000
Re: How to find one expression in terms of another expression? Jacare Omoplata <walkeystalkey@gmail.com> - 2011-06-21 11:18 +0000
Multiple use of Set on lists Jonathan Frazer <J.Frazer@sussex.ac.uk> - 2011-06-20 23:38 +0000
Re: Multiple use of Set on lists Oleksandr Rasputinov <oleksandr_rasputinov@hmamail.com> - 2011-06-21 11:17 +0000
Re: Multiple use of Set on lists Leonid Shifrin <lshifr@gmail.com> - 2011-06-25 09:31 +0000
csiph-web