Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE ONLY USE PYTHON CODE....IF YOURE GOING TO HAND WRITE IT PLEASE BE CLEAR WITH THE WRITING. THANK YOU! Choose an m 150, 151, .

PLEASE ONLY USE PYTHON CODE....IF YOU"RE GOING TO HAND WRITE IT PLEASE BE CLEAR WITH THE WRITING. THANK YOU! image text in transcribed

Choose an m 150, 151, . ,5000} and an a {2,3,...,m 1} so that the linear congruential generator (LCG) Rn = (aRn-1) mod m has full period. [Remember that m should be prime.) Report your choice of a and m. For the seed Ro = 1, generate R1, ..., Rm-1 and define N& to be the number of the R;'s that are equal to k. More formally, Nk = #{j: R; = k; j = 1,..., m - 1} What should N. be for each k = 1, ..., m - 1? Produce a plot of Nk versus k for k = 1,...,m - 1. Different PRNGs in Python Two different PRNGs A. The LCG that you created in problem 1 [after converting to (0,1) by dividing each Rn by m). B. Python method random in the random package or in numpy, which generates a pseudorandom number uniformly' distributed on [0, 1). Numpy currently uses a permuted congruential generator (PCG), which is an elaboration of an LCG. (There is a lot to the topic of random number generation. You can learn about this more on the internet, starting with the Wikipedia page on the topic or directly in the official numpy documentation.) The PCG is also remarkably simple; you can read code for it in Wikipedia page. Demo Convince yourself that the PRNGs are deterministic. For the LCG you chose, it should be obvious how to do this. For the Python PRNG, do this by resetting the seed, as follows: set the random seed to a particular value x using the seed command in the random package (or in numpy). Now generate a collection of n random numbers from random. Then reset the seed, again, to z. Finally, generate a second collection of n random numbers from random. Compare the two collections of numbers you have generated. The law of large numbers PLEASE EXPLAIN STEP Recall that the law of large numbers (LLN) states that BY STEP 1 CLEARLY USING h(Xx) + E[h(x)] PYTHON n k=1 n as n + for any iid sequence X, X1, X2, ... for which E[h(X)] exists. So if a pseudo-random sequence U1, U2,...,Un behaves like an iid Uniform(0, 1) sequence, then we better have PLEASE EXPLAIN 1 STEP BY STEP CLEARLY USING for large n where U is Uniform(0,1). PYTHON H(Ux) E[h(U)] n k=1

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_2

Step: 3

blur-text-image_3

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

Students also viewed these Databases questions

Question

Would I say yes to this message?

Answered: 1 week ago

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago

Question

2 The role of economic theory in economics.

Answered: 1 week ago