Questions tagged [random-walk]

A random walk is a mathematical formalization of a path that consists in a succession of random steps. A random walk can be a Markov chain or process; it can be on a graph or a group. Random walks can model randomized processes, in fields such as: ecology, economics, psychology, computer science, physics, chemistry, and biology.

248 questions
4
votes
1 answer

OpenCL Intel Iris Integrated Graphics exits with Abort Trap 6: Timeout Issue

I am attempting to write a program that executes Monte Carlo simulations using OpenCL. I have run into an issue involving exponentials. When the value of the variable steps becomes large, approximately 20000, the calculation of the exponent fails…
Nick
  • 75
  • 6
4
votes
0 answers

modifying spark GraphX pageRank to do random walk with restart

I am trying to implement random walk with restart by modifying the Spark GraphX implementation of PageRank algorithm. def randomWalkWithRestart(graph: Graph[VertexProperty, EdgeProperty], patientID: String , numIter: Int = 10, alpha: Double =…
4
votes
3 answers

Python: Repetition of 2-d random walk simulation

I'm simulating a 2-dimensional random walk, with direction 0 < θ < 2π and T=1000 steps. I already have: a=np.zeros((1000,2), dtype=np.float) def randwalk(x,y): theta=2*math.pi*rd.rand() # Theta is a random angle between 0 and 2pi …
user4142446
4
votes
3 answers

Visualizing a 2d random walk in python

I'm trying to make a random walk in 2d, and plot the 2d walk. I've been able to make the walk, but the plot is not exactly what I wanted. Would it be possible to see the walk live in python ? Or just add a label to every point so that you know which…
90intuition
  • 966
  • 3
  • 12
  • 25
4
votes
0 answers

How to use Random Walk to generate a dungeon map?

Ok so, I'm making a 2d dungeon crawler and I want to randomize a map for it. Right now it's look like I'm going to use a Random Walk algoritm for the path, combined with a Perlin Noise for different the underworld enviroments (currently only 1, as…
Sebastian Zander
  • 347
  • 1
  • 4
  • 13
3
votes
1 answer

Average of 100 random walkers with 1000 steps

I was asked to write the code of 100 random walkers, each with 1000 steps. then plot the steps of the average of the 100 walkers. I was able to plot all the walkers in one plot, but couldn't find a way to plot the average. any help will be…
3
votes
1 answer

Can we algorithmically find expected hitting time for 2D random walk without simulating/approximating?

Suppose we're given some absorbing boundary that encloses the origin/starting position, and we take a simple random walk (up/down/left/right with equal probability). For simplicity's sake say we have access to a function which tells us for (x,y)…
3
votes
1 answer

Visualizing the 1D random walk in Julia

I would like to know how to plot 1000 "walkers" that each "walk" 100 steps. I am not sure how to plot a diagram with more then one walker, let alone 1000 each walking 100 steps. Below is the code for one "walker" walking 10 steps. function walk(N,…
3
votes
0 answers

Simple random walk on a hypercube

I have written a code for a lazy simple random walk on a n-dimensional hypercube. To visualize it, one can think of a 2D square or a 3D cube with the corners of the square/cube being the vertices of a graph. The walk on this graph starts at the…
trickymaverick
  • 199
  • 1
  • 3
  • 8
3
votes
0 answers

Random Walk Metropolis Hastings implementation in R using log scale

Context I looked literally everywhere but I couldn't find a complete implementation of the Random Walk Metropolis-Hastings algorithm using the log scale. By log scale I mean that we are working with the logarithm of the target distribution (which…
Euler_Salter
  • 3,271
  • 8
  • 33
  • 74
3
votes
2 answers

Why isn't my random walk simulation working correctly?

I have written the following code to simulate an unbiased random walk on Z^2. With probability 1/4, the "destination" is supposed to move one unit up, left, right, or down. So I made "destination" a matrix with two columns, one for the x-coordinate…
Math1000
  • 145
  • 10
3
votes
0 answers

while x and y are within certain limits

Im trying to write a random walk sim where the field size is limited to 10 x 10 m. My idea was to limit x and y to -10 to +10 in a while loop, but it does not work. x and/or y keeps getting bigger than 10 or less than -10. I have tried to break up…
Rob
  • 179
  • 9
3
votes
1 answer

More efficient way to run a random walk on a transition matrix than the igraph::random_walk()

I'm trying to create a random walker on a specific transition matrix (20,000 * 20,000) and so far I'm using the igraph::random_walk() function from R's package igraph. The thing with that function is that gets as input a graph and not the transition…
J. Doe
  • 619
  • 4
  • 16
3
votes
1 answer

random_walk function from iGraph in R does not stop at absorbing states

I'm trying to emulate a random walk/ Markov chain using R. As you can see I've set up a transition matrix, and then I'm trying to run a random walker on this. The thing here is that when the random walker meets an absorbing state (like 2 and 5) does…
J. Doe
  • 619
  • 4
  • 16
3
votes
1 answer

R - RW metropolis using gibbs fails

I want to sample from the posterior, where LambdaA and LambdaB are exponential rates of A and B. Also, y is the observations of the r.v.'s. The posterior is given by and for numerical reasons, i am taking the log of this function. Data: n<-100 y<-…
Btzzzz
  • 143
  • 9
1
2
3
16 17