College

We appreciate your visit to Call the random number generator 50 000 times and bin the values into 100 intervals on 0 1 In most cases you need to start. This page offers clear insights and highlights the essential aspects of the topic. Our goal is to provide a helpful and engaging learning experience. Explore the content and find the answers you need!

Call the random number generator 50,000 times and bin the values into 100 intervals on [0, 1]. In most cases, you need to start calling a random number generator by giving a "seed" to initiate it. If you obtain the numbers in an array [tex]r[1], r[2], \ldots, r[50000][/tex], write a small program as follows:

```plaintext
integer i, j
real r[1:50000], distribution[0:100]

do j
end do

do i = 1, 50000, 1
j = int(r[i] * 100)
distribution[j] = distribution[j] + 1
end do

do j = 0, 100, 1
distribution[j] = distribution[j] / 50000
end do
```

The distribution you obtain is known as the histogram of the 50,000 data points. What you should observe is that the distribution from your random number generator is a uniform distribution on the interval [0, 1].

Next, for every return of the random number [tex]r[/tex], compute [tex]s = -T \ln(r)[/tex]. What do you expect for the distribution of [tex]s[/tex]? To investigate this question, change your program to:

```plaintext
integer i, j, n
real S
real r[1:50000], distribution[0:100]

do j = 0, 100, 1
distribution[j] = 0.0
end do
n = 0

do i = 1, 50000, 1
S = -3 * log(r[i])
j = int(S * 10)
if (j .le. 100) then
distribution[j] = distribution[j] + 1
n = n + 1
end if
end do

do j = 0, 100, 1
distribution[j] = distribution[j] / n
end do
```

In this program, [tex]T = 3[/tex]. Note, since [tex]r[/tex] can be a very small number, [tex]s[/tex] can be very large. In fact, [tex]s \rightarrow \infty[/tex] as [tex]r \rightarrow 0[/tex]. So in the program, you need to be careful when the value of [tex]s[/tex] goes outside your last bin. The total number of [tex]s[/tex]'s that are less than 10, [tex]n[/tex], will be less than 50,000.

On your computer, run the iteration [tex]x_{n+1} = \lambda x_n (1-x_n)[/tex] with [tex]\lambda = 0.9, 2.9, 3.1, \text{ and } 3.5[/tex]. Choose different initial values [tex]x_0[/tex], but always inside [0, 1], and see what you obtain when [tex]n[/tex] is sufficiently large. You should be able to reproduce all the figures in the book.

Now for [tex]\lambda = 4[/tex], run the iteration [tex]x_{n+1} = 4 x_n (1-x_n)[/tex] for 50,000 steps, and plot the histogram of the data. You might want to use high precision for the real value [tex]x[/tex]; otherwise, when it becomes too small (or too close to 1), it will be treated as 0 (or 1).

What happens if you start with an initial value of [tex]x_0 = \frac{5+\sqrt{5}}{8}[/tex] or [tex]x_0 = \frac{5-\sqrt{5}}{8}[/tex]?

Are there other special values?

Answer :

After computing s = -T ln(r), the distribution of s is exponential. The exponential distribution has a parameter of λ = T.

The exponential distribution is a continuous probability distribution that describes the time between events in a Poisson process. It has one parameter, λ (lambda), which represents the rate of occurrence of the events. The probability density function of the exponential distribution is given by: f(x) = λe^(-λx)for x ≥ 0 and λ > 0. The mean and variance of the exponential distribution are both equal to 1/λ.

Therefore, after computing s = -T ln(r), the distribution of s is exponential with a parameter of λ = T. This is because T is a constant and r follows a uniform distribution on the interval [0,1], therefore it is easy to see that the s will follow an exponential distribution with parameter λ = T.

Learn more about variance here:

https://brainly.com/question/29727198

#SPJ11

Thanks for taking the time to read Call the random number generator 50 000 times and bin the values into 100 intervals on 0 1 In most cases you need to start. We hope the insights shared have been valuable and enhanced your understanding of the topic. Don�t hesitate to browse our website for more informative and engaging content!

Rewritten by : Barada