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

Random walk simulation in one dimension using random number generator

I am trying to develop a random walk simulation in one dimension. I am modelling a particle along a line with 10 discrete positions that particle can occupy. The particle can only move left or right one space each time it 'hops'. In this simulation…
adamlsmith981
  • 63
  • 1
  • 8
0
votes
0 answers

What is a point with nonsmooth boundary?

I am trying to implement the billiard walk sampling algorithm presented in this paper https://arxiv.org/pdf/1211.3932.pdf.One step of the algorithm is stating: "If a point with nonsmooth boundary is met or the number of reflections exceeds R, go to…
S.Andreea
  • 1
  • 4
0
votes
1 answer

How to Implement Integrated Random Walk Trend Component in Tensorflow Probability

I'm running tensorflow 2.1 and tensorflow_probability 0.9. I have fit a Structural Time Series Model with a seasonal component. I wish to implement an Integrated Random walk in order to smooth the trend component, as per Time Series Analysis by…
0
votes
2 answers

Metropolis-Hastings in matlab

I am trying to use the Metropolis Hastings algorithm with a random walk sampler to simulate samples from a function $$ in matlab, but something is wrong with my code. The proposal density is the uniform PDF on the ellipse 2s^2 + 3t^2 ≤ 1/4. Can I…
Natalie_94
  • 79
  • 3
  • 12
0
votes
1 answer

How to set the seed value to a specific number globally? Or maybe this is correct?

import statistics as stat from statistics import mean from random import seed, choice from math import hypot import random from turtle import * import statistics from statistics import stdev seed(20190101) def random_walk(n): x = 0 y = 0 …
Oklol2958
  • 21
  • 1
  • 8
0
votes
1 answer

How can I successfully complete the random walk problem?

I was looking for help writing this code for a program that simulates a random walk of 25 steps. The (person) can either walk East or West. The program has to compute and output to the screen the following: The average distance from the starting…
0
votes
1 answer

I am trying to measure the distribution of the magnitudes of the total displacement of random walks

the error returned is "IndexError: index 1 is out of bounds for axis 0 with size 1" I am not sure how to fix this, please help I am very new to python nsteps7 = 1 def randomwalk7(nsteps7): position = 0 walk7 = [position] x =…
Tefers
  • 1
  • 1
0
votes
1 answer

Seeds in relation to random walks in python

What’s the purpose of this seed when running this for loop? import numpy as np np.random.seed(123) outcomes = [] for x in range(10): coin = np.random.randint(0,2) if coin == 0: outcomes.append(“heads”) else: …
saberfan7
  • 35
  • 6
0
votes
1 answer

Variance in random Walk with Matlab

I'm new to the forum and a beginner in programming. I have the task to program a random walk in Matlab (1D or 2D) with a variance that I can adjust. I found the code for the random walk, but I'm really confused where to put the variance. I thought…
MikeH
  • 47
  • 10
0
votes
1 answer

adding a custom forecast function that extends snaive

I would like to extend snaive from the forecast package (or maybe lagwalk?) and add a custom forecast function custom_snaive. I would like it to get as a parameter a list of desired_lags and forecast a simple average of their values. E.g. for hourly…
ihadanny
  • 4,377
  • 7
  • 45
  • 76
0
votes
1 answer

Random walk in matlab, how to count how many ‘particles’ end in the same y column (and stack on top of each other)?

I have created a function that generates N particles to do a random walk, 1 at a time. I have tracked the end location of each particle ('result'). However, I would like to keep the particle in the end position (which is when y=99). When the new…
Lauren
  • 9
  • 2
0
votes
1 answer

Perform a RandomWalk step with Tensorflow Probability's RandomWalkMetropolis function

I am new to Tensorflow Probability and would like to do a RandomWalk Montecarlo simulation. Let's say I have tensor r that represents a state. I want the tfp.mcmc.RandomWalkMetropolis function to return a proposal for a new state r'.…
0
votes
0 answers

How to store a very long random walk with low memory cost

I want to perform graph isomorphism tests for a very long random walk with fixed windows. That is given a target graph, say a triangle, I want to find how many consecutive 3 nodes in the random walk induce a triangle. Graph isomorphism test is very…
0
votes
1 answer

How to speed up drawing plots in Matplotlib?

I'm playing with random walk, I have two points. First one is walking randomly, second one is trying to escape from his area, which is given by formula e^(-t), where t is the distance between the two points. In my opinion it is not a difficult…
padar
  • 13
  • 4
0
votes
1 answer

How to get the path with relationships from randomWalk call in Cypher?

I am using Neo4j randomWalk algorithm on a base 2 types of nodes (N1 and N2) and one type of relationship (R1). The random walk algorithm returns a list of NodeId. The issue here is that I'd like to get the relationships R1 between the nodes of each…
Syndo rik
  • 755
  • 1
  • 7
  • 15