Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given a simple symmetric random walk ()0(Sn)n0 with 0=0S0=0, we define the following random variables: The total number of periods from 00 to 22N the
Given a simple symmetric random walk ()0(Sn)n0 with 0=0S0=0, we define the following random variables:
- The total number of periods from 00 to 22N the random walk spends above zero:
2:=|{{1,,2}:>0}|.C2N:=|{n{1,,2N}:Sn>0}|.
- The time of the last visit to 00 before time 22N:
2:=max{02:=0}.L2N:=max{0n2N:Sn=0}.
- The time when the random walk reaches its unique maximum value between time 00 and 22N:
2:=argmax{:02}(this notation means that 2=max{:02}.
Problem 2 (6 points) Write three Python functions which take a path of a random walk as an input and then compute the values of the random variables C2n, L2N, M2n, respectively, as defined above: ]: ### Insert your code here for total time spend above zero def timeAboveZero (path): ## Write your own code here return result ]: ### Insert your code here for last time the random walk visited zero def TimeofLastvisitofZero (path): ## Write your own code here return result ]: ### Insert your code here for the time when the random walk hits its maximum def timeHitMax(randomWalk): ## Write your own code here return resultStep by Step Solution
There are 3 Steps involved in it
Step: 1
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