Question: DONE IN PYTHON 3.6 PLEASE One dimensional random walk. The most straightforward random walk is in 1 dimension. We start a particle at the origin

DONE IN PYTHON 3.6 PLEASE

DONE IN PYTHON 3.6 PLEASE One dimensional random walk. The most straightforwardrandom walk is in 1 dimension. We start a particle at the

One dimensional random walk. The most straightforward random walk is in 1 dimension. We start a particle at the origin and at each time step, it moves 1 step to the left or to the right. The direction it moves is random at each step and doesn't depend upon where it is, or where it last moved. a) Write a program to evolve a 1-dimensional random walk for 10,000 time steps. At each time step, decide which way to go based on picking a random number between 0 and 1. If the number is less than 0.5 move left (-1), if it's greater than 0.5 move right (+1) b) Generate 5 random walks of length 10,000 and make a plot of the position vs time for each of them (on the same graph). Include the plot c) Growth of random walks. i. Calculate the maximum distance from the origin (either positive or negative) as a function of time. Hint: For an array x, the command y - maximum.accumulate(x) will return an array y which gives a running maximum of the array x (the largest entry in x up to this point). ii Make a plot of the maximum distance from the origin (either positive or negative) as a function of time for each of your five random walks. By plotting this with linear/semilog/log axes, find a scale that makes the plot an approximately straight line. ii. Include the plot with the appropriate axis scale. Looking at the plot, estimate the rate at which the maximum excursion increases as a function of time Gaussian random walk. A Gaussian random walk is a generalization to the one dimensional random walk discussed above. In a Gaussian random walk, the size of the step is a random number taken from a Gaussian distribution. As before, the direction and size of step doesn't depend upon where it is, or where it last moved. d) Write a program to evolve a 1-dimensional Gaussian random walk for 10,000 time steps. At each time step, generate a random number from a Gaussian (normal) distribution with zero mean and unit variance. Add this to the previous position to determine the new position. e) Generate 5 random walks of length 10,000 and make a plot of the position vs time for each of them (on the same graph). Include the plot One dimensional random walk. The most straightforward random walk is in 1 dimension. We start a particle at the origin and at each time step, it moves 1 step to the left or to the right. The direction it moves is random at each step and doesn't depend upon where it is, or where it last moved. a) Write a program to evolve a 1-dimensional random walk for 10,000 time steps. At each time step, decide which way to go based on picking a random number between 0 and 1. If the number is less than 0.5 move left (-1), if it's greater than 0.5 move right (+1) b) Generate 5 random walks of length 10,000 and make a plot of the position vs time for each of them (on the same graph). Include the plot c) Growth of random walks. i. Calculate the maximum distance from the origin (either positive or negative) as a function of time. Hint: For an array x, the command y - maximum.accumulate(x) will return an array y which gives a running maximum of the array x (the largest entry in x up to this point). ii Make a plot of the maximum distance from the origin (either positive or negative) as a function of time for each of your five random walks. By plotting this with linear/semilog/log axes, find a scale that makes the plot an approximately straight line. ii. Include the plot with the appropriate axis scale. Looking at the plot, estimate the rate at which the maximum excursion increases as a function of time Gaussian random walk. A Gaussian random walk is a generalization to the one dimensional random walk discussed above. In a Gaussian random walk, the size of the step is a random number taken from a Gaussian distribution. As before, the direction and size of step doesn't depend upon where it is, or where it last moved. d) Write a program to evolve a 1-dimensional Gaussian random walk for 10,000 time steps. At each time step, generate a random number from a Gaussian (normal) distribution with zero mean and unit variance. Add this to the previous position to determine the new position. e) Generate 5 random walks of length 10,000 and make a plot of the position vs time for each of them (on the same graph). Include the plot

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!