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
0
votes
1 answer

Simulating for loop

I am trying to simulate the following random walk equation: However, when I run my code I can't append the results. I get the following error: first_term = results[i] TypeError: 'NoneType' object is not subscriptable Is there an alternative…
0
votes
0 answers

Brownian motion on a Matplotlib canvas

I am trying to draw a Brownian motion on top of the following canvas: import matplotlib import matplotlib.pyplot as plt palette = matplotlib.colors.ListedColormap(['#F08080']) gridCells = np.ones((50, 50)) * np.nan gridCells.shape N=50 for j in…
COxf
  • 45
  • 4
0
votes
1 answer

R Limit matrix in random walk

I have the following code for a random walk, in which I start from i and add up cumulatively for each line. However, I need to limit my random walk on each line. One way I thought of doing this, would be from the index j (where the value in the…
0
votes
0 answers

For loop of random walk in Python

I am currently learning the random walk on Python, I came across the sample code that I couldn't explain please help me to clarify this My question is that why does x no need to be put in the loop but the code is still able to operate. The other…
James Huang
  • 63
  • 1
  • 10
0
votes
1 answer

Random walk with stop condition

I have the following generator code for a random walk: i = 1 t = 100 p = 0.5 max_walk = 1000 samples = rbinom(max_walk, 1, p) samples[samples==0] = -1 walk = c(i, cumsum(samples)) In my case i is the value of the first step, and t would be the…
0
votes
0 answers

Algorithm for 1D Random Walk with Varying Step Sizes?

I am trying to figure out all the possible random walks for a given distance and displacement, and it has a fairly complicated set of conditions. The step sizes can vary, eg. the walk is not just a combination of +1s and -1s, but will include…
0
votes
1 answer

Can you construct a deterministic infinite RNG with just a few known parameters?

I'm currently using a cone-based random walk with reflections at the boundaries (denoted R[n]), with the following properties: R[n] is always in a user defined range (called the boundaries) [a, b] (or [-a, a] if that's easier) R[0] is defined by…
ijustlovemath
  • 703
  • 10
  • 21
0
votes
1 answer

Does this simulate 1D random walk?

Just started with python, so bear with me for some silly questions. Trying to figure out if the below code actually simulates a 1D random walk motion. The +/- 1 of respective random steps do not seem to add up in results. Results: positions: [0, 1,…
0
votes
1 answer

Python: Plot frequency of negative (x,y) coordinates

I'm trying to plot the frequencies of a 2D-integer random walk starting from (0,0). First, I get a list of (x,y)-coordinates, some of which are negative and I'm having problems plotting them the right way. I know my current attempt is wrong, as…
ProbM
  • 3
  • 1
0
votes
2 answers

Random walk simulation based on the flipping of a biased coin 100 times

I'm starting in Python. I'm trying to make a simulation of a random walk in a straight line (north and south) based on flipping a biased coin 100 times with 0.3 chance of getting tails and 0.7 chance of getting heads assuming that the values from…
0
votes
0 answers

Neutrons through a reactor shield

I have been staring at my screen now since last Thursday. I am very new to coding and am not at all sure how to go about this problem. Please any help would be greatly appreciated. A beam of neutrons bombards a reactor's wall. Consider the motion of…
sek1996
  • 11
  • 1
0
votes
0 answers

How do i animate using matplotlib?

I try to animate my random walk code. I have two lists that i want to animate, peopleX and peopleY. peopleX = [[-9, 9, -18], [-10, 9, -18], [-10, 9, -18], [-10, 10, -18], [-9, 10, -17], [-10, 10, -18]] peopleY = [[-14, 16, 3], [-15, 15, 3], [-16,…
0
votes
1 answer

Question regarding the implementation of the paper " guided random walks" weighing functions

I'm working on the implementation of the paper: Segmentation by retrieval with guided random walks: Application to left ventricle segmentation in MRI. I tried to modify the weights functions mentioned in Scikit-Image random walker algorithm to…
Bilal
  • 3,191
  • 4
  • 21
  • 49
0
votes
1 answer

Random walker algorithm how a gray-level image can be 3D?

I was reading the source of the random walker algorithm in scikit-image library, and it's written there that: Parameters data : array_like Image to be segmented in phases. Gray-level `data` can be two- or three-dimensional My question…
Bilal
  • 3,191
  • 4
  • 21
  • 49
0
votes
2 answers

In python random walker ,how can I set a random starting point instead of setting origin?

I'm trying to implement a random walker in python.But I want to set a random starting point instead of initialize the first position.how can i set a random starting point?
user9338977