Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a simple symmetric random walk (S n) 20 with So = 0, we define the following random variables: 0 The total number of periods

image text in transcribedimage text in transcribed
Given a simple symmetric random walk (S n) "20 with So = 0, we define the following random variables: 0 The total number of periods from 0 to 2N the random walk spends above zero: CZN = |{n e {1, ...,2N} :8\" > on. . The time of the last visit to 0 before time 2N: L2N=max{05n52N:Sn=0}. . The time when the random walk reaches its maximum value between time 0 and 2N: MzN = argmax{S,, :0 S n S 2N}. Problem 2 (6 points) Write three functions which take a path (= realization) of the random walk as an input and then compute a value (= realization) of the random variables C2N, L2N, M2N, respectively, as defined above. 1. Function: timeAboveZero(...) Input: . path: Realization of the random walk from the function randomWalk(2N) Output: . result: Realization of the random variable C2N In [ ]: def timeAboveZero(path): ## WRITE YOUR OWN CODE HERE ## HINT: USE numpy.sum() AND A LOGICAL OPERATION return result In [ ]: ## TEST YOUR FUNCTION HERE path = randomWalk(20) print(path) timeAboveZero(path)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus (Single Variable)

Authors: Michael Sullivan

1st Edition

1464142912, 9781464142918

More Books

Students also viewed these Mathematics questions

Question

Always show respect for the other person or persons.

Answered: 1 week ago

Question

Self-awareness is linked to the businesss results.

Answered: 1 week ago