1.Suppose you wish to select 3 numbers randomly from {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Explain how you would do this. (You’re selecting three different numbers.)

2.

Suppose I execute the following code:

P[0] = 0; P[1] = .1; P[2] = .5; P[3] = .7; P[4] = .75; P[5] = 1;

X[1] = 3; X[2] = 5; X[3] = -1; X[4] = 10; X[5] = 20;

U = MTUinform (0);

for (i = 1; i <= 5; i++) {

if (U <= P[i]) {

Y = X[i];

break;

}

}

Here all the variables are integers except for U and the P array, which are a doubles. What is the probability mass function for the random variable Y?

3.Write code that does the same thing (as question 2) more efficiently

4.

Suppose I execute the following code:

a[1] = a[2] = a[3] = a[4] = .5; a[5] = 1;

accepted = 0;

while (!accepted) {

U = MTUniform (0); V = MTUniform (0);

Xtilde = 1 + (int) (5 * U);

if (V <= a[Xtilde]) {

X = Xtilde;

accepted = 1;

}

}

Here all the variables are integers except U, V, and the array, which are doubles. What is the probability mass function for the random variable X that is generated?

5.

Suppose we execute the following code:

U = MTUniform (0);

X = sqrt(U);

Here both U and X are doubles. What is the density function of X?

Subject | Computer |

Due By (Pacific Time) | 03/22/2015 12:00 am |

Tutor | Rating |
---|---|

pallavi Chat Now! |
out of 1971 reviews More.. |

amosmm Chat Now! |
out of 766 reviews More.. |

PhyzKyd Chat Now! |
out of 1164 reviews More.. |

rajdeep77 Chat Now! |
out of 721 reviews More.. |

sctys Chat Now! |
out of 1600 reviews More.. |

sharadgreen Chat Now! |
out of 770 reviews More.. |

topnotcher Chat Now! |
out of 766 reviews More.. |

XXXIAO Chat Now! |
out of 680 reviews More.. |