Last answered:

04 May 2024

Posted on:

17 Jun 2023

0

why is the range( 1, t_intervals + 1)

In MC: Forecasting Stock Prices, the loop uses for t in range( 1, t_intervals)

However, in MC:Euler Discretization, the loop uses for t in range( 1, t_intervals +1 )


Why do we have to add +1 for Euler and not for Stock Pricing?

2 answers ( 0 marked as helpful)
Posted on:

28 Aug 2023

0

It might be a mistake because the size of the array under Euler's method is 25-1 rows * 10000columns

Instructor
Posted on:

04 May 2024

0

Hi Ryan and Santiago!

Thanks for reaching out.
Please accept my apology for the delayed response.

It is just a matter of representation, nothing really important. It depends how many steps do you want to have randomized.

In the "Stock Prices" lecture, we did not add 1 and we referred to the formulas as shown in the video and in the lecture file. This is why the last iterated stock price is t + 999, which means you will have generated 1,000 steps.

In the "Euler" lecture, we add one, so that you don't obtain just t + 249, but t + 250.

That's all... What is important is to stick either to one or to the other.

Regarding Euler, we use t_intervals = 250 , and later we use Z = np.random.standard_normal((t_intervals + 1, iterations)) .

Please don't confuse this with obtaining 251L as a length of the S  matrix.

Hope this helps.
Kind regards,
Martin

Submit an answer