Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let pi be the probability of being absorbed by the lower absorbing barrier when nsteps is very large (i.e., absorption occurs). Similarly, let p
Let pi be the probability of being absorbed by the lower absorbing barrier when nsteps is very large (i.e., absorption occurs). Similarly, let p be the probability of being absorbed by the lower absorbing barrier when nsteps is very large. When -y = yh, we have p = Ph = 0.5. (Recall that y < 0 and y > 0; if they are the same distance from y = 0, they're equally likely to absorb a random walk.) hand by the higher barrier the probability More generally, let w = y y. Then the probability of being absorbed by the lower barrier is Pi = Y is ph w Write the function sim_random_walks(yl, yh, ntries, N) which runs ntries many random walks with absorbing barriers at y = y < 0 and at y = y > 0, and returns the pair (p, p) which estimates the values of p, and ph respectively. Set the default value of N, the number of steps per walk, to a very large number so that absorption is very likely. How do you count the random walks that don't get absorbed? Try sim_random_walks(-5, 5, ntries) with increasingly large number of tries. Do your probability estimates appear to converge to p, and Ph?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Algorithm of the code Import the random module for generating random numbers Define the simrandomwalks function with the following parameters yl The lower absorbing barrier position yh The higher abso...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started