Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Have Fizzy bounce as she hits a wall. Fizzy will always bounce back in the oppos

ID: 3834520 • Letter: H

Question

Have Fizzy bounce as she hits a wall. Fizzy will always bounce back in the opposite direction she was travelling. When Fizzy reaches a wall, she will change her direction of movement and she will change the direction she is pointing as well. One quarter of the marks for this section are for changing direction of movement, another quarter for changing the direction she is pointing. Fizzy must always point the direction that she is moving if you are to get these marks. An example will be posted in the class forums. The second half of the marks for this part are for having Fizzy respond to user input as well. When the user presses 'w', Fizzy should turn and move up, 'a' will make Fizzy turn and move left, 's' will turn fizzy to face down the screen and 'd' will make Fizzy move right. Thus Fizzy will now be able to move in four separate directions controlled by the 'w', 's', 'a', and 'd' keys.

Explanation / Answer

In this chapter, we shall first consider chance experiments with a finite number of possible outcomes 1, 2, . . . , n. For example, we roll a die and the possible outcomes are 1, 2, 3, 4, 5, 6 corresponding to the side that turns up. We toss a coin with possible outcomes H (heads) and T (tails). It is frequently useful to be able to refer to an outcome of an experiment. For example, we might want to write the mathematical expression which gives the sum of four rolls of a die. To do this, we could let Xi , i = 1, 2, 3, 4, represent the values of the outcomes of the four rolls, and then we could write the expression X1 + X2 + X3 + X4 for the sum of the four rolls. The Xi ’s are called random variables. A random variable is simply an expression whose value is the outcome of a particular experiment. Just as in the case of other types of variables in mathematics, random variables can take on different values. Let X be the random variable which represents the roll of one die. We shall assign probabilities to the possible outcomes of this experiment. We do this by assigning to each outcome j a nonnegative number m(j ) in such a way that m(1) + m(2) + · · · + m(6) = 1 . The function m(j ) is called the distribution function of the random variable X. For the case of the roll of the die we would assign equal probabilities or probabilities 1/6 to each of the outcomes. With this assignment of probabilities, one could write P(X 4) = 2 3 1 2 CHAPTER 1. DISCRETE PROBABILITY DISTRIBUTIONS to mean that the probability is 2/3 that a roll of a die will have a value which does not exceed 4. Let Y be the random variable which represents the toss of a coin. In this case, there are two possible outcomes, which we can label as H and T. Unless we have reason to suspect that the coin comes up one way more often than the other way, it is natural to assign the probability of 1/2 to each of the two outcomes. In both of the above experiments, each outcome is assigned an equal probability. This would certainly not be the case in general. For example, if a drug is found to be effective 30 percent of the time it is used, we might assign a probability .3 that the drug is effective the next time it is used and .7 that it is not effective. This last example illustrates the intuitive frequency concept of probability. That is, if we have a probability p that an experiment will result in outcome A, then if we repeat this experiment a large number of times we should expect that the fraction of times that A will occur is about p. To check intuitive ideas like this, we shall find it helpful to look at some of these problems experimentally. We could, for example, toss a coin a large number of times and see if the fraction of times heads turns up is about 1/2. We could also simulate this experiment on a computer. Simulation We want to be able to perform an experiment that corresponds to a given set of probabilities; for example, m(1) = 1/2, m(2) = 1/3, and m(3) = 1/6. In this case, one could mark three faces of a six-sided die with an 1, two faces with an 2, and one face with an 3. In the general case we assume that m(1), m(2), . . . , m(n) are all rational numbers, with least common denominator n. If n > 2, we can imagine a long cylindrical die with a cross-section that is a regular n-gon. If m(j ) = nj/n, then we can label nj of the long faces of the cylinder with an j , and if one of the end faces comes up, we can just roll the die again. If n = 2, a coin could be used to perform the experiment. We will be particularly interested in repeating a chance experiment a large number of times. Although the cylindrical die would be a convenient way to carry out a few repetitions, it would be difficult to carry out a large number of experiments. Since the modern computer can do a large number of operations in a very short time, it is natural to turn to the computer for this task. Random Numbers We must first find a computer analog of rolling a die. This is done on the computer by means of a random number generator. Depending upon the particular software package, the computer can be asked for a real number between 0 and 1, or an integer in a given set of consecutive integers. In the first case, the real numbers are chosen in such a way that the probability that the number lies in any particular subinterval of this unit interval is equal to the length of the subinterval. In the second case, each integer has the same probability of being chosen. 1.1. SIMULATION OF DISCRETE PROBABILITIES 3 .203309 .762057 .151121 .623868 .932052 .415178 .716719 .967412 .069664 .670982 .352320 .049723 .750216 .784810 .089734 .966730 .946708 .380365 .027381 .900794 Table 1.1: Sample output of the program RandomNumbers. Let X be a random variable with distribution function m(), where is in the set {1, 2, 3}, and m(1) = 1/2, m(2) = 1/3, and m(3) = 1/6. If our computer package can return a random integer in the set {1, 2, ..., 6}, then we simply ask it to do so, and make 1, 2, and 3 correspond to 1, 4 and 5 correspond to 2, and 6 correspond to 3. If our computer package returns a random real number r in the interval (0, 1), then the expression b6rc + 1 will be a random integer between 1 and 6. (The notation bxc means the greatest integer not exceeding x, and is read “floor of x.”) The method by which random real numbers are generated on a computer is described in the historical discussion at the end of this section. The following example gives sample output of the program RandomNumbers.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote