introduction to computation and programming using python%2c revised - guttag%2c john v..189

1
172 Chapter 12. Stochastic Programs, Probability, and Statistics This is an example of exponential decay. In practice, exponential decay is often talked about in terms of half-life, i.e., the expected time required for the initial value to decay by 50%. One can also talk about the half-life of a single item. For example, the half-life of a single radioactive atom is the time at which the probability of that atom having decayed is 0.5. Notice that as time increases the number of remaining molecules approaches zero. But it will never quite get there. This should not be interpreted as suggesting that a fraction of a molecule remains. Rather it should be interpreted as saying that since the system is probabilistic, one can never guarantee that all of the molecules have been cleared. What happens if we make the y-axis logarithmic (by using pylab.semilogy)? We get the plot above and on the right. The values on the y-axis are changing exponentially quickly relative to the values on the x-axis. If we make the y-axis itself change exponentially quickly, we get a straight line. The slope of that line is the rate of decay. Exponential growth is the inverse of exponential decay. It too is quite commonly seen in nature. Compound interest, the growth of algae in a swimming pool, and the chain reaction in an atomic bomb are all examples of exponential growth. Exponential distributions can easily be generated by calling random.expovariate. The geometric distribution is the discrete analog of the exponential distribution. 72 It is usually thought of as describing the number of independent attempts required to achieve a first success (or a first failure). Imagine, for example, that you have a crummy car that starts only half of the time you turn the key. A geometric distribution could be used to characterize the expected number of times you would have to attempt to start the car before being successful. This is illustrated by the histogram on the right, which was produced by the code in Figure 12.12. The histogram implies that most of the time you’ll get the car going within a few attempts. On the other hand, the long tail suggests that on occasion you may run the risk of draining your battery before the car gets going. 72 The name “geometric distribution” arises from its similarity to a “geometric progression.” A geometric progression is any sequence of numbers in which each number other than the first is derived by multiplying the previous number by a constant nonzero number. Euclid’s Elements proves a number of interesting theorems about geometric progressions.

Upload: zhichaowang

Post on 08-Sep-2015

217 views

Category:

Documents


0 download

DESCRIPTION

f

TRANSCRIPT

  • 172 Chapter 12. Stochastic Programs, Probability, and Statistics

    This is an example of exponential decay. In practice, exponential decay is often talked about in terms of half-life, i.e., the expected time required for the initial value to decay by 50%. One can also talk about the half-life of a single item. For example, the half-life of a single radioactive atom is the time at which the probability of that atom having decayed is 0.5. Notice that as time increases the number of remaining molecules approaches zero. But it will never quite get there. This should not be interpreted as suggesting that a fraction of a molecule remains. Rather it should be interpreted as saying that since the system is probabilistic, one can never guarantee that all of the molecules have been cleared.

    What happens if we make the y-axis logarithmic (by using pylab.semilogy)? We get the plot above and on the right. The values on the y-axis are changing exponentially quickly relative to the values on the x-axis. If we make the y-axis itself change exponentially quickly, we get a straight line. The slope of that line is the rate of decay.

    Exponential growth is the inverse of exponential decay. It too is quite commonly seen in nature. Compound interest, the growth of algae in a swimming pool, and the chain reaction in an atomic bomb are all examples of exponential growth.

    Exponential distributions can easily be generated by calling random.expovariate.

    The geometric distribution is the discrete analog of the exponential distribution.72 It is usually thought of as describing the number of independent attempts required to achieve a first success (or a first failure). Imagine, for example, that you have a crummy car that starts only half of the time you turn the key. A geometric distribution could be used to characterize the expected number of times you would have to attempt to start the car before being successful. This is illustrated by the histogram on the right, which was produced by the code in Figure 12.12. The histogram implies that most of the time youll get the car going within a few attempts. On the other hand, the long tail suggests that on occasion you may run the risk of draining your battery before the car gets going.

    72 The name geometric distribution arises from its similarity to a geometric progression. A geometric progression is any sequence of numbers in which each number other than the first is derived by multiplying the previous number by a constant nonzero number. Euclids Elements proves a number of interesting theorems about geometric progressions.