Skip to main content

Timeline for Programming a 2D random walk

Current License: CC BY-SA 3.0

17 events
when toggle format what by license comment
Oct 8, 2015 at 20:11 comment added george2079 worth pointing out, if you only care about the final position, in this case order doesn't matter and you can just do this Total /@ Transpose[ RandomChoice[{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}, n] (I expect substantially faster for large n )
Oct 8, 2015 at 15:01 comment added user31159 @blochwave Yes I agree, this would be an unfortunate wording though.
Oct 8, 2015 at 12:13 comment added Karsten7 mathematica.stackexchange.com/a/78351/18476
Oct 8, 2015 at 7:47 history edited dr.blochwave CC BY-SA 3.0
added 4 characters in body; edited tags
Oct 8, 2015 at 7:46 comment added dr.blochwave @Xavier "average position for a walk" could also be a poor way of describing the mean squared displacement...
Oct 8, 2015 at 7:42 answer added Alexei Boulbitch timeline score: 7
Oct 8, 2015 at 7:28 comment added user31159 I suppose the "average position for a walk" can be obtained by running several random walks and taking the Mean on the last position of the outputs. You may want to use N at some point in case you want numerical values.
Oct 8, 2015 at 5:53 comment added ferrou Thanks ! I have to find the average position for a walk but the thing is I don't get what it means. Do I have to extract the position after every step, put that in a table, and sum them than divide them by the number of steps ? Whats would be the easiest way to do that in mathematica ?
Oct 8, 2015 at 5:38 answer added Prashanth timeline score: 8
Oct 8, 2015 at 5:37 comment added user31159 A shorter version for your one-dimensional problem using RandomChoice as suggested by @J.M.: randomwalk[n_] := Accumulate[RandomChoice[{-1, 1}, n]]. The extension to the 2D case that you are asking for would read: randomwalk2d[n_] := Accumulate[RandomChoice[{-1, 1}, {n, 2}]].
Oct 8, 2015 at 5:30 comment added Dr. belisarius From the help data2d = RandomFunction[RandomWalkProcess[0.5], {0, 10^3}, 2]; Graphics[Line[Transpose@data2d["States"]], AspectRatio -> Automatic]
Oct 8, 2015 at 5:19 comment added Dr. belisarius Welcome to Mathematica.SE! I suggest the following: 1) Browse common pitfalls. 2) As you receive help, try to give it too, by answering questions in your area of expertise. 3) Take the tour and check the help center! 4) When you see good questions and answers, vote them up using the triangles. Also, please remember to accept an answer if it solves your problem, by clicking the checkmark!
Oct 8, 2015 at 5:17 history edited ferrou CC BY-SA 3.0
idea of programming this another way
Oct 8, 2015 at 5:07 comment added ferrou We didn't see a lot ! But we have the right to use everything in mathematica
Oct 8, 2015 at 4:47 comment added J. M.'s missing motivation Have you seen RandomChoice[]?
Oct 8, 2015 at 4:42 review First posts
Oct 8, 2015 at 5:23
Oct 8, 2015 at 4:37 history asked ferrou CC BY-SA 3.0