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
-2
votes
3 answers

If function, if value in vector > 0, then replace with number

I try to performe the Cowles-Jones-Test in R. Basically, I don't know how to write a script, in which I can check, if a value within my vector is bigger than zero or not (for every single value in this vector). If it's bigger than zero, it should…
Chris M
  • 5
  • 2
-2
votes
1 answer

Displaying the shortest path along a random walk

I'm a CS teacher, and we wrote some Python code in class to have a turtle draw a random walk. Someone asked if we could draw a new turtle that will trace the route (from starting point to ending point) that will take the minimum path. Current code…
-2
votes
2 answers

What are the errors inside this random walking code?

I am having unexpected outputs with the following code: import random N = 30 # number of steps n = random.random() # generate a random number x = 0 y = 0 z = 0 count = 0 while count <= N: if n < 1/3: x = x + 1 # move east n…
Jenny Azaz
  • 11
  • 1
  • 1
-2
votes
2 answers

Function used to derive continuous series of random numbers

I read an article at one point about a function, which I believe had a name like Piersen or Poisson, used to get random numbers that are close to the previous one. Apparently, it is used in some appliances, and widely used in robotics as described…
TheEnvironmentalist
  • 2,694
  • 2
  • 19
  • 46
-2
votes
2 answers

random walk function in R

I have a random walk function random.walk = function(n){ return(cunsum(c(0, sample(c(-1, 1), size = n-1, replace =TRUE)))) } I would like to make recursive random walk function. what I did was recursive.rwalk=function(n){ …
user3358686
  • 883
  • 2
  • 7
  • 7
-3
votes
1 answer

Random walk algorithm for image segmentation

Can any one please suggest a matlab code for implementation of random walk algorithm, for image segmentation, specifically CT images.
Parth Sehgal
  • 139
  • 1
  • 1
  • 7
-4
votes
1 answer

Random Walk Java Array Coin Flip

Write a program to take in the size of the array and an integer N that simulates a “random” walk. using a coin flip for N steps. The initial position is the middle of the array and if the coin flip is heads (0) move 1 step to the right, tails…
-6
votes
1 answer

How to go through all the numbers between -1 and 1 with numpy.arange()?

I am trying to write a code for random walk, and in the direction part, I met this problem. I want the direction to be any degrees, what I do is try to use py.arrange to generate as many numbers as possible between -1 and 1. I want to ask is there…
Dave
  • 7
1 2 3
16
17