Question: Computer Science pyhton Exercise 6B (1) Write a function laggedfib(j,k,m, initlist,n) to compute a sequence of n pseudo- random numbers using the lagged Fibonacci method,
Computer Science
pyhton

Exercise 6B (1) Write a function laggedfib(j,k,m, initlist,n) to compute a sequence of n pseudo- random numbers using the lagged Fibonacci method, where initlist is a list of k initial values, and j , k,m are as in the notes. (2) Using your function with (j,k, m) = (7, 10,232) and initlist = [1,1,1,. ..,1], generate 2000 pseudorandom numbers z, in the range [0, 232). Plot r, against r , as a scatter plot. (The plot should appear when the programme is run.) (3) Generate 2000 pseudorandom numbers z, in the same range using the randint function from the random module. Plot z, against s; , as a scatter plot. (Again the plot should appear automatically, in a separate window to the previous plot.) (4) Consider a list sequence of n numbers , E [a, b]. Write a function arithmeticmean (sequence, hi, lo) to compute the arithmetic mean of such a list. Your function should take three arguments:sequence, hi (= b) and lo (= a). (The function could of course find the maximum and minimum values in sequence, by using the func- tions max () and min() - why is this not as accurate as providing a and b?). The function should return three things; the arithmetic mean of the elements of sequence, the quantity (a + 6)/2, and the ratio of the first of these to the second (which ideally should be close to 1). (5) Use your function from (4) to compare the arithmetic means of a, and s, above, writing your answer as a comment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
