Hi everyone,

First, thanks to authors for such nicely paced yet simple lectures.

I have question regarding *simulate Loan repayment* function. It appears in Quantecon Datascience Lectures - Scientific Computing - Randomness section (For easy access to readers).

In function *def simulate_loan_repayments_slow* each value in the array *repayment_sims* is present valued using code line *repayment_sims[i] = (1 / (1 + r)) * repaid*.

However, in the vectorized version *def simulate_loan_repayments*, no such discounting is conducted for both repayment_sims arrays.

Have I missed any subtlety?

Also, while defining full in the vectorized version *def simulate_loan_repayments*, Bitwise NOT (~) was used(full = ~partial & (random_numbers <= 0.95). How exactly this operation works in this function? For, as I understand, this bitwise inversion works only on integral numbers whereas code generates random numbers between 0 and 1.

Also, correlated question is, how the vectorized function *def simulate_loan_repayments* covers entire range of 95% probability of both full and partial repayments, when it returns repayment_sims?.

Thank You for your assistance and I apologize if this is all very trivial.