Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1591
| From | "mfific@gmail.com" <mfific@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | How to Compile this code (multiple random walks) |
| Date | 2011-04-11 11:06 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <inuncc$2dl$1@smc.vnet.net> (permalink) |
Hi All,
I would appreciate help with Compile function. Below is the code that
I could not compiled. The output are the three random walk counters
with (-5, 5) bounds, along with a counter for a number of steps. The
compile does not work here, I assume because the output is a matrix
(it works if there is only one counter). But I need these three
counters running in parallel for later development. Any help would be
appreciated.
thanks,
Mario Fific
Transpose[{Range[0, Length[#] - 1], #}] &@
NestWhileList[(# + {If[Random[] > .5, 1, -1],
If[Random[] > .5, 1, -1], If[Random[] > .5, 1, -1]}
) &, {0, 0, 0}, -5 < #[[1]] < 5 && -5 < #[[2]] < 5 && -5 < #[[3]]
< 5 & ]
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
How to Compile this code (multiple random walks) "mfific@gmail.com" <mfific@gmail.com> - 2011-04-11 11:06 +0000 Re: How to Compile this code (multiple random walks) Peter Pein <petsie@dordos.net> - 2011-04-12 09:54 +0000 Re: How to Compile this code (multiple random walks) Derek Yates <yatesd@me.com> - 2011-04-12 09:54 +0000
csiph-web