(See Exercise 1 from "Problems on Distribution and Density Functions", m-file npr07_01.m). The class
% file npr07_01.m
% Data for Exercise 1 from "Problems on Distribution and Density Functions"
T = [1 3 2 3 4 2 1 3 5 2];
pc = 0.01*[ 8 13 6 9 14 11 12 7 11 9];
disp('Data are in T and pc')
npr07_01
Data are in T and pc
EX = T*pc'
EX = 2.7000
[X,PX] = csort(T,pc); % Alternate using X, PX
ex = X*PX'
ex = 2.7000
(See Exercise 2 from "Problems on Distribution and Density Functions", m-file npr07_02.m ). A store has eight items for sale. The prices are $3.50, $5.00, $3.50, $7.50, $5.00, $5.00, $3.50, and $7.50, respectively. A customer comes in. She purchases one of the items with probabilities 0.10, 0.15, 0.15, 0.20, 0.10 0.05, 0.10 0.15. The random variable expressing the amount of her purchase may be written
Determine the expection
% file npr07_02.m
% Data for Exercise 2 from "Problems on Distribution and Density Functions"
T = [3.5 5.0 3.5 7.5 5.0 5.0 3.5 7.5];
pc = 0.01*[10 15 15 20 10 5 10 15];
disp('Data are in T, pc')
npr07_02
Data are in T, pc
EX = T*pc'
EX = 5.3500
[X,PX] = csort(T,pc);
ex = X*PX'
ex = 5.3500
(See Exercise 12 from "Problems on Random Variables and Probabilities", and Exercise 3 from "Problems on Distribution and Density Functions," m-file npr06_12.m). The class
Determine the mathematical expection for the random variable
% file npr06_12.m
% Data for Exercise 12 from "Problems on Random Variables and Probabilities"
pm = 0.001*[5 7 6 8 9 14 22 33 21 32 50 75 86 129 201 302];
c = [1 1 1 1 0];
disp('Minterm probabilities in pm, coefficients in c')
npr06_12
Minterm probabilities in pm, coefficients in c
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities pm
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
EX = X*PX'
EX = 2.9890
T = sum(mintable(4));
[x,px] = csort(T,pm);
ex = x*px
ex = 2.9890
(See Exercise 5 from "Problems on Distribution and Density Functions"). In a thunderstorm in a national park there are 127 lightning strikes. Experience shows that the probability of of a lightning strike starting a fire is about 0.0083. Determine the expected number of fires.
(See Exercise 8 from "Problems on Distribution and Density Functions"). Two coins are flipped twenty times. Let X be the number of
matches (both heads or both tails). Determine
(See Exercise 12 from "Problems on Distribution and Density Functions"). A residential College plans to raise money by selling “chances” on
a board. Fifty chances are sold. A player pays $10 to play; he or she wins $30
with probability
Determine the expected profit
(See Exercise 19 from "Problems on Distribution and Density Functions"). The number of noise pulses arriving on a power circuit in an hour is a random quantity having Poisson (7) distribution. What is the expected number of pulses in an hour?
(See Exercise 24 and Exercise 25 from "Problems on Distribution and Density Functions"). The total operating time for the units in Exercise 24 is a
random variable
(See Exercise 41 from "Problems on Distribution and Density Functions"). Random variable X has density function
What is the expected value
Truncated exponential. Suppose
tappr
Enter matrix [a b] of x-range endpoints [0 1000]
Enter number of x approximation points 10000
Enter density as a function of t (1/50)*exp(-t/50)
Use row matrices X and PX as in the simple case
G = X.*(X<=30) + 30*(X>30);
EZ = G8PX'
EZ = 22.5594
ez = 50*(1 - exp(-30/50)) % Theoretical value
ez = 22.5594
(See Exercise 1 from "Problems On Random Vectors and Joint Distributions", m-file npr08_01.m). Two cards are selected at random,
without replacement, from a standard
deck. Let X be the number of aces and Y be the number of spades. Under the
usual assumptions, determine the joint distribution. Determine
npr08_01
Data in Pn, P, X, Y
jcalc
Enter JOINT PROBABILITIES (as on the plane) P
Enter row matrix of VALUES of X X
Enter row matrix of VALUES of Y Y
Use array operations on matrices X, Y, PX, PY, t, u, and P
EX = X*PX'
EX = 0.1538
ex = total(t.*P) % Alternate
ex = 0.1538
EY = Y*PY'
EY = 0.5000
EX2 = (X.^2)*PX'
EX2 = 0.1629
EY2 = (Y.^2)*PY'
EY2 = 0.6176
EXY = total(t.*u.*P)
EXY = 0.0769
(See Exercise 2 from "Problems On Random Vectors and Joint Distributions", m-file npr08_02.m ). Two positions for campus jobs are
open. Two sophomores, three juniors,
and three seniors apply. It is decided to select two at random (each possible pair
equally likely). Let X be the number of sophomores and Y be the number of
juniors who are selected. Determine the joint distribution for
npr08_02
Data are in X, Y,Pn, P
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 0.5000
EY = Y*PY'
EY = 0.7500
EX2 = (X.^2)*PX'
EX2 = 0.5714
EY2 = (Y.^2)*PY'
EY2 = 0.9643
EXY = total(t.*u.*P)
EXY = 0.2143
(See Exercise 3 from "Problems On Random Vectors and Joint Distributions", m-file npr08_03.m ). A die is rolled. Let X be the
number of spots that turn up.
A coin is flipped X times. Let Y be the number of heads that turn up. Determine the joint
distribution for the pair
npr08_03
Answers are in X, Y, P, PY
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 3.5000
EY = Y*PY'
EY = 1.7500
EX2 = (X.^2)*PX'
EX2 = 15.1667
EY2 = (Y.^2)*PY'
EY2 = 4.6667
EXY = total(t.*u.*P)
EXY = 7.5833
(See Exercise 4 from "Problems On Random Vectors and Joint Distributions", m-file npr08_04.m ). As a variation of Exercise 13,
suppose a pair of dice is rolled instead of a single die. Determine the joint distribution for
npr08_04
Answers are in X, Y, P
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 7
EY = Y*PY'
EY = 3.5000
EX2 = (X.^2)*PX'
EX2 = 54.8333
EY2 = (Y.^2)*PY'
EY2 = 15.4583
(See Exercise 5 from "Problems On Random Vectors and Joint Distributions", m-file npr08_05.m). Suppose a pair of dice is rolled.
Let X be the total number of spots which turn up. Roll the pair an additional X times.
Let Y be the number of sevens that are thrown on the X rolls. Determine the joint distribution
for
npr08_05
Answers are in X, Y, P, PY
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 7.0000
EY = Y*PY'
EY = 1.1667
(See Exercise 6 from "Problems On Random Vectors and Joint Distributions", m-file npr08_06.m). The pair
Determine
npr08_06
Data are in X, Y, P
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 1.3696
EY = Y*PY'
EY = 3.0344
EX2 = (X.^2)*PX'
EX2 = 9.7644
EY2 = (Y.^2)*PY'
EY2 = 11.4839
EXY = total(t.*u.*P)
EXY = 4.1423
(See Exercise 7 from "Problems On Random Vectors and Joint Distributions", m-file npr08_07.m). The pair
| t = | -3.1 | -0.5 | 1.2 | 2.4 | 3.7 | 4.9 |
| u = 7.5 | 0.0090 | 0.0396 | 0.0594 | 0.0216 | 0.0440 | 0.0203 |
| 4.1 | 0.0495 | 0 | 0.1089 | 0.0528 | 0.0363 | 0.0231 |
| -2.0 | 0.0405 | 0.1320 | 0.0891 | 0.0324 | 0.0297 | 0.0189 |
| -3.8 | 0.0510 | 0.0484 | 0.0726 | 0.0132 | 0 | 0.0077 |
Determine
npr08_07
Data are in X, Y, P
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 0.8590
EY = Y*PY'
EY = 1.1455
EX2 = (X.^2)*PX'
EX2 = 5.8495
EY2 = (Y.^2)*PY'
EY2 = 19.6115
EXY = total(t.*u.*P)
EXY = 3.6803
(See Exercise 8 from "Problems On Random Vectors and Joint Distributions", m-file npr08_08.m). The pair
| t = | 1 | 3 | 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 |
| u = 12 | 0.0156 | 0.0191 | 0.0081 | 0.0035 | 0.0091 | 0.0070 | 0.0098 | 0.0056 | 0.0091 | 0.0049 |
| 10 | 0.0064 | 0.0204 | 0.0108 | 0.0040 | 0.0054 | 0.0080 | 0.0112 | 0.0064 | 0.0104 | 0.0056 |
| 9 | 0.0196 | 0.0256 | 0.0126 | 0.0060 | 0.0156 | 0.0120 | 0.0168 | 0.0096 | 0.0056 | 0.0084 |
| 5 | 0.0112 | 0.0182 | 0.0108 | 0.0070 | 0.0182 | 0.0140 | 0.0196 | 0.0012 | 0.0182 | 0.0038 |
| 3 | 0.0060 | 0.0260 | 0.0162 | 0.0050 | 0.0160 | 0.0200 | 0.0280 | 0.0060 | 0.0160 | 0.0040 |
| -1 | 0.0096 | 0.0056 | 0.0072 | 0.0060 | 0.0256 | 0.0120 | 0.0268 | 0.0096 | 0.0256 | 0.0084 |
| -3 | 0.0044 | 0.0134 | 0.0180 | 0.0140 | 0.0234 | 0.0180 | 0.0252 | 0.0244 | 0.0234 | 0.0126 |
| -5 | 0.0072 | 0.0017 | 0.0063 | 0.0045 | 0.0167 | 0.0090 | 0.0026 | 0.0172 | 0.0217 | 0.0223 |
Determine
npr08_08
Data are in X, Y, P
jcalc
- - - - - - - - - - - - -
EX = X*PX'
EX = 10.1000
EY = Y*PY'
EY = 3.0016
EX2 = (X.^2)*PX'
EX2 = 133.0800
EY2 = (Y.^2)*PY'
EY2 = 41.5564
EXY = total(t.*u.*P)
EXY = 22.2890
(See Exercise 9 from "Problems On Random Vectors and Joint Distributions", m-file npr08_09.m). Data were kept on the effect of training time on the time to perform a job on a production line. X is the amount of training, in hours, and Y is the time to perform the task, in minutes. The data are as follows:
| t = | 1 | 1.5 | 2 | 2.5 | 3 |
| u = 5 | 0.039 | 0.011 | 0.005 | 0.001 | 0.001 |
| 4 | 0.065 | 0.070 | 0.050 | 0.015 | 0.010 |
| 3 | 0.031 | 0.061 | 0.137 | 0.051 | 0.033 |
| 2 | 0.012 | 0.049 | 0.163 | 0.058 | 0.039 |
| 1 | 0.003 | 0.009 | 0.045 | 0.025 | 0.017 |
Determine
npr08_09
Data are in X, Y, P
jcalc
- - - - - - - - - - - -
EX = X*PX'
EX = 1.9250
EY = Y*PY'
EY = 2.8050
EX2 = (X.^2)*PX'
EX2 = 4.0375
EY2 = (Y.^2)*PY' EXY = total(t.*u.*P)
EY2 = 8.9850 EXY = 5.1410
For the joint densities in Exercises 20-32 below
(See Exercise 10 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 1] [0 2] 200 400 u<=2*(1-t)
EX = 0.3333 EY = 0.6667 EX2 = 0.1667 EY2 = 0.6667
EXY = 0.1667 (use t, u, P)
(See Exercise 11 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 2] 200 200 0.5*(u<=min(t+1,3-t))&(u>= max(1-t,t-1))
EX = 1.0000 EY = 1.0002 EX2 = 1.1684 EY2 = 1.1687 EXY = 1.0002
(See Exercise 12 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 1] [0 1] 200 200 4*t.*(1-u)
EX = 0.6667 EY = 0.3333 EX2 = 0.5000 EY2 = 0.1667 EXY = 0.2222
(See Exercise 13 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 2] 200 200 (1/8)*(t+u)
EX = 1.1667 EY = 1.1667 EX2 = 1.6667 EY2 = 1.6667 EXY = 1.3333
(See Exercise 14 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 6] [0 1] 600 200 4*u.*exp(-2*t)
EX = 0.5000 EY = 0.6667 EX2 = 0.4998 EY2 = 0.5000 EXY = 0.3333
(See Exercise 15 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 3] 200 300 (3/88)*(2*t + 3*u.^2).*(u<1+t)
EX = 1.4229 EY = 1.6202 EX2 = 2.2277 EY2 = 3.1141 EXY = 2.4415
(See Exercise 16 from "Problems On Random Vectors and Joint Distributions").
tuappr: [-1 1] [0 1] 400 200 12*t.^2.*u.*(u>= max(0,t)).*(u<= min(1+t,1))
EX = 0.4035 EY = 0.7342 EX2 = 0.4016 EY2 = 0.6009 EXY = 0.4021
(See Exercise 17 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 1] 400 200 (24/11)*t.*u.*(u<=min(1,2-t))
EX = 0.9458 EY = 0.5822 EX2 = 1.0368 EY2 = 0.4004 EXY = 0.5098
(See Exercise 18 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 2] 200 200 (3/23)*(t + 2*u).*(u<=max(2-t,t))
EX = 1.1518 EY = 0.9596 EX2 = 1.7251 EY2 = 1.1417 EXY = 1.0944
(See Exercise 19 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 2] 400 400 (12/179)*(3*t.^2 + u).*(u<=min(2,3-t))
EX = 1.2923 EY = 0.8695 EX2 = 1.9119 EY2 = 1.0239 EXY = 1.0122
(See Exercise 20 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 2] 400 400 (12/227)*(3*t + 2*t.*u).*(u<=min(1+t,2))
EX = 1.3805 EY = 1.0974 EX2 = 2.0967 EY2 = 1.5120 EXY = 1.5450
(See Exercise 21 from "Problems On Random Vectors and Joint Distributions").
tuappr: [0 2] [0 2] 400 400 (2/13)*(t + 2*u).*(u<=min(2*t,3-t))
EX = 1.2309 EY = 0.9169 EX2 = 1.6849 EY2 = 1.0647 EXY = 1.1056
(See Exercise 22 from "Problems On Random Vectors and Joint Distributions").
for
tuappr [0 2] [0 1] 400 200 (3/8)*(t.^2+2*u).*(t<=1) + (9/14)*(t.^2.*u.^2).*(t > 1)
EX = 1.0848 EY = 0.6875 EX2 = 1.5286 EY2 = 0.5292 EXY = 0.7745
The class
Let
Use x and
x = [-5 -1 3 4 7];
px = 0.01*[15 20 30 25 10];
icalc
Enter row matrix of X-values x
Enter row matrix of Y-values x
Enter X probabilities px
Enter Y probabilities px
Use array operations on matrices X, Y, PX, PY, t, u, and P
G = 3*t -4*u;
[R,PR] = csort(G,P);
icalc
Enter row matrix of X-values R
Enter row matrix of Y-values x
Enter X probabilities PR
Enter Y probabilities px
Use array operations on matrices X, Y, PX, PY, t, u, and P
H = t + 2*u;
EH = total(H.*P)
EH = 1.6500
[W,PW] = csort(H,P); % Alternate
EW = W*PW'
EW = 1.6500
icalc3 % Solution with icalc3
Enter row matrix of X-values x
Enter row matrix of Y-values x
Enter row matrix of Z-values x
Enter X probabilities px
Enter Y probabilities px
Enter Z probabilities px
Use array operations on matrices X, Y, Z,
PX, PY, PZ, t, u, v, and P
K = 3*t - 4*u + 2*v;
EK = total(K.*P)
EK = 1.6500
(See Exercise 5 from "Problems on Functions of Random Variables") The cultural committee of a student organization has arranged a special deal for tickets to a concert. The agreement is that the organization will purchase ten tickets at $20 each (regardless of the number of individual buyers). Additional tickets are available according to the following schedule:
11-20, $18 each; 21-30 $16 each; 31-50, $15 each; 51-100, $13 each
If the number of purchasers is a random variable X, the total cost (in dollars) is
a random quantity
Suppose
X = 0:150;
PX = ipoisson(75,X);
G = 200 + 18*(X - 10).*(X>=10) + (16 - 18)*(X - 20).*(X>=20) + ...
(15 - 16)*(X- 30).*(X>=30) + (13 - 15)*(X - 50).*(X>=50);
[Z,PZ] = csort(G,PX);
EZ = Z*PZ'
EZ = 1.1650e+03
EZ2 = (Z.^2)*PZ'
EZ2 = 1.3699e+06
The pair
| t = | -3.1 | -0.5 | 1.2 | 2.4 | 3.7 | 4.9 |
| u = 7.5 | 0.0090 | 0.0396 | 0.0594 | 0.0216 | 0.0440 | 0.0203 |
| 4.1 | 0.0495 | 0 | 0.1089 | 0.0528 | 0.0363 | 0.0231 |
| -2.0 | 0.0405 | 0.1320 | 0.0891 | 0.0324 | 0.0297 | 0.0189 |
| -3.8 | 0.0510 | 0.0484 | 0.0726 | 0.0132 | 0 | 0.0077 |
Let
npr08_07
Data are in X, Y, P
jcalc
- - - - - - - - -
G = 3*t.^2 + 2*t.*u - u.^2;
EG = total(G.*P)
EG = 5.2975
ez2 = total(G.^2.*P)
EG2 = 1.0868e+03
[Z,PZ] = csort(G,P); % Alternate
EZ = Z*PZ'
EZ = 5.2975
EZ2 = (Z.^2)*PZ'
EZ2 = 1.0868e+03
For the pair
Determine
H = t.*(t+u<=4) + 2*u.*(t+u>4);
EH = total(H.*P)
EH = 4.7379
EH2 = total(H.^2.*P)
EH2 = 61.4351
[W,PW] = csort(H,P); % Alternate
EW = W*PW'
EW = 4.7379
EW2 = (W.^2)*PW'
EW2 = 61.4351
For the distributions in Exercises 37-41 below
tuappr: [0 2] [0 3] 200 300 (3/88)*(2*t+3*u.^2).*(u<=1+t)
G = 4*t.*(t<=1) + (t + u).*(t>1);
EG = total(G.*P)
EG = 3.2086
EG2 = total(G.^2.*P)
EG2 = 11.0872
tuappr: [0 2] [0 1] 400 200 (24/11)*t.*u.*(u<=min(1,2-t))
G = (1/2)*t.*(u>t) + u.^2.*(u<=t);
EZ = 0.2920 EZ2 = 0.1278
tuappr: [0 2] [0 2] 400 400 (3/23)*(t+2*u).*(u<=max(2-t,t))
M = max(t,u)<=1;
G = (t+u).*M + 2*u.*(1-M);
EZ = total(G.*P)
EZ = 1.9048
EZ2 = total(G.^2.*P)
EZ2 = 4.4963
tuappr: [0 2] [0 2] 400 400 (12/179)*(3*t.^2 + u).*(u <= min(2,3-t))
M = (t<=1)&(u>=1);
G = (t + u).*M + 2*u.^2.*(1 - M);
EZ = total(G.*P)
EZ = 1.5898
EZ2 = total(G.^2.*P)
EZ2 = 4.5224
tuappr: [0 2] [0 2] 400 400 (12/227)*(3*t + 2*t.*u).*(u <= min(1+t,2))
M = u <= min(1,2-t);
G = t.*M + t.*u.*(1 - M);
EZ = total(G.*P)
EZ = 1.6955
EZ2 = total(G.^2.*P)
EZ2 = 3.5659
The class
Z has distribution
| Value | -1.3 | 1.2 | 2.7 | 3.4 | 5.8 |
| Probability | 0.12 | 0.24 | 0.43 | 0.13 | 0.08 |
npr10_16
Data are in cx, pmx, cy, pmy, Z, PZ
[X,PX] = canonicf(cx,pmx);
[Y,PY] = canonicf(cy,pmy);
icalc3
input: X, Y, Z, PX, PY, PZ
- - - - - - -
Use array operations on matrices X, Y, Z,
PX, PY, PZ, t, u, v, and P
G = t.^2 + 3*t.*u.^2 - 3*v;
[W,PW] = csort(G,P);
EW = W*PW'
EW = -1.8673
EW2 = (W.^2)*PW'
EW2 = 426.8529