python this is connected to the last problem - the second part of the question is added. my attempt on this problem shows that the part b) (approaches N*NH) is not really wokring.. a) (answered) with a function “harmonic(n)” that computes the n-th harmonic number, write a function “harmonic_all(n)” that returns the number of values generated until all values are obtained as a function of the range of possible values n, then write a function “harmonic_sim(n)” that repeats “harmonic_all(n)” a total of n_sim = 100 times. (Attaching the code from the answer for a) d) Show that as n increases (e.g., with a doubling experiment), from n = 2 to n_max = 1,000, the value of “coupon_sim(n)” approaches “n * Hn”.
python
this is connected to the last problem - the second part of the question is added. my attempt on this problem shows that the part b) (approaches N*NH) is not really wokring..
a) (answered) with a function “harmonic(n)” that computes the n-th harmonic number, write a function “harmonic_all(n)” that returns the number of values generated until all values are obtained as a function of the range of possible values n, then write a function “harmonic_sim(n)” that repeats “harmonic_all(n)” a total of n_sim = 100 times.
(Attaching the code from the answer for a)
d) Show that as n increases (e.g., with a doubling experiment), from n = 2 to n_max = 1,000, the value of “coupon_sim(n)” approaches “n * Hn”.
Task :
- Using the given set of values of n from 2 to 1000 :
- show that harmonic_sim(n) approaches n*H(n).
Step by step
Solved in 3 steps with 3 images