Вы находитесь на странице: 1из 2

Homework #15 Solutions

cs349 -- Networks
Chapter 5
23) In a normal distribution, what is the probability of a value
that is 3.14 standard deviations above the mean or more?
According to a table of the normal distribution, the
cumulative probability of 3.14 is about 0.99915, leaving
about 0.09% left over.
25) I wrote the following program:
public static void main (String[] args) {
double est = 4.0;
double dev = 4.0;
double sample = 1.0;
double d = 1.0/8.0;
double to;
for (int i=1; i<30; i++) {
double diff = sample - est;
est = est + d * diff;
dev = dev + d * (Math.abs(diff) - dev);
to = est + 4 * dev;
System.out.println (i + "\t" + to);
}
}
After 22 rounds, TO fell below 4. If the initial value
of dev is 8, it takes 24 rounds. If it is 2, it takes
20, so the result is not particularly sensitive to our
guess about the initial value.
26) I modified the program...
public static void main (String[] args) {
double est = 1.0;
double dev = 1.0;
double sample = 1.0;
double d = 1.0/8.0;
int n=8;
double to;
for (int i=1; i<1000; i++) {
if (i%n == 0) sample = 4.0;
else sample = 1.0;
double diff = sample - est;
est = est + d * diff;
dev = dev + d * (Math.abs(diff) - dev);
to = est + 4 * dev;
System.out.println (i + "\t" + to);
}
}
...and plotted the result. I found that when n=6 and the
system reaches steady state, TO varies between 4.4 and 5.6,
so there will be no timeouts.

When n=7, the range is 3.8 to 5.2, so the occasional round


trip time of 4 will cause a timeout.

Вам также может понравиться