Ms325 C Random Processes And Simulations Open University Course Team
Ms325 C Random Processes And Simulations Open University Course Team
Ms325 C Random Processes And Simulations Open University Course Team
Ms325 C Random Processes And Simulations Open University Course Team
1. Ms325 C Random Processes And Simulations Open
University Course Team download
https://ebookbell.com/product/ms325-c-random-processes-and-
simulations-open-university-course-team-44564406
Explore and download more ebooks at ebookbell.com
2. Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Ms325 A Computer Algebra Open University Course Team
https://ebookbell.com/product/ms325-a-computer-algebra-open-
university-course-team-44564402
Ms325 B Chaos And Modern Dynamics Open University Course Team
https://ebookbell.com/product/ms325-b-chaos-and-modern-dynamics-open-
university-course-team-44564404
4. About this course
MS325 Computer algebra, chaos and simulations uses the software package MapleTM
(copyright MaplesoftTM
, a division of Waterloo Maple Inc., 2007) which is provided as part of
the course. Maple is a computer-assisted algebra package and its usage is the main subject of
Block A Computer algebra. Advice on such matters as the installation of Maple, the loading
and saving of Maple worksheets and other basic ‘getting-started’ issues is given in the
Computing Guide.
MaplesoftTM
and MapleTM
are trademarks of Waterloo Maple Inc. All other trademarks are
the property of their respective owners.
The cover image is composed of a photograph of the Saturnian moon Hyperion (courtesy of
NASA) overlaid with a time-T map (in yellow). The view of Hyperion was taken during the
close flyby of the spacecraft Cassini on 26 September 2005. Time-T maps are covered in
Block B Chaos and modern dynamics. This one shows Hyperion’s spin rate plotted against its
orientation and was generated using Maple from a mathematical model. Regions containing an
apparently random scatter of dots indicate chaotic motion in Hyperion’s spin angle, the
so-called chaotic tumbling.
This publication forms part of an Open University course. Details of this and other
Open University courses can be obtained from the Student Registration and Enquiry Service,
The Open University, PO Box 197, Milton Keynes MK7 6BJ, United Kingdom
(tel. +44 (0)845 300 6090, email general-enquiries@open.ac.uk).
Alternatively, you may visit the Open University website at www.open.ac.uk where you can
learn more about the wide range of courses and packs offered at all levels by The
Open University.
To purchase a selection of Open University course materials visit www.ouw.co.uk, or contact
Open University Worldwide, Walton Hall, Milton Keynes MK7 6AA, United Kingdom, for a
brochure (tel. +44 (0)1908 858793, fax +44 (0)1908 858787, email
ouw-customer-services@open.ac.uk).
The Open University, Walton Hall, Milton Keynes, MK7 6AA.
First published 2010.
Copyright c
� 2010 The Open University
All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system, transmitted or utilised in any form or by any means, electronic,
mechanical, photocopying, recording or otherwise, without written permission from
the publisher or a licence from the Copyright Licensing Agency Ltd. Details of such
licences (for reprographic reproduction) may be obtained from the Copyright
Licensing Agency Ltd, Saffron House, 6–10 Kirby Street, London EC1N 8TS
(website www.cla.co.uk).
Open University course materials may also be made available in electronic formats
for use by students of the University. All rights, including copyright and related
rights and database rights, in electronic course materials and their contents are
owned by or licensed to The Open University, or otherwise used by The Open
University as permitted by applicable law.
In using electronic course materials and their contents you agree that your use will
be solely for the purposes of following an Open University course of study or
otherwise as licensed by The Open University or its assigns.
Except as permitted above you undertake not to copy, store in any medium
(including electronic storage or use in a website), distribute, transmit or retransmit,
broadcast, modify or show in public such electronic materials in whole or in part
without the prior written consent of The Open University or in accordance with the
Copyright, Designs and Patents Act 1988.
Edited, designed and typeset by The Open University, using the Open University
TEX System.
Printed and bound in the United Kingdom by Hobbs the Printers Limited, Brunel
Road, Totton, Hampshire SO40 3WX.
ISBN 978 1 8487 3233 9
1.1
5. Contents
UNIT 1 Random variables 5
Study guide 5
Introduction 5
1.1 Discrete probabilities 6
1.1.1 Random variables 13
1.1.2 Special distributions 16
1.2 Continuous random variables 20
1.2.1 Special continuous distributions 22
1.2.2 Changing variables 24
1.2.3 The simulation of a continuous distribution 25
1.3 The statistics of a random variable 29
1.3.1 Maple functions for mean and variance 33
1.3.2 Mean and standard deviation of the normal
distribution 35
1.4 Population growth 36
1.4.1 A deterministic approximation 36
1.4.2 A stochastic description of population growth 38
1.4.3 Formal connection between the stochastic and
deterministic approximations 44
1.4.4 Populations with births and deaths 46
1.5 End of unit exercises 48
Learning outcomes 50
Solutions to Exercises 51
UNIT 2 Random walks and Monte Carlo integration 57
Study guide 57
Introduction 57
2.1 The addition of two random variables 61
2.1.1 The addition of Gaussian random variables 63
2.2 Random walks 65
2.2.1 Statistics of random walks 65
2.2.2 The central limit theorem 66
2.3 Monte Carlo integration 71
2.3.1 Maple implementation 75
2.3.2 Two-dimensional integrals 77
2.3.3 The many-dimensional case 80
2.4 Methods of decreasing the statistical errors 80
2.4.1 Control functions 81
2.4.2 Stratified sampling 82
2.5 End of unit exercises 92
Learning outcomes 95
Solutions to Exercises 96
UNIT 3 Simulations: standard map and disease
spreading 101
3
6. Contents
Study guide 101
Introduction 101
3.1 Stochastic behaviour in the standard map 102
3.2 Dynamics of infectious diseases 105
3.2.1 A simple model of an epidemic outbreak 106
3.2.2 Repeated epidemics in regenerating populations 114
3.2.3 Infections by external contacts 120
3.2.4 Stochastic modelling of epidemics 121
3.2.5 Age distributions 132
3.2.6 Concluding remarks 134
3.3 End of unit exercises 135
Learning outcomes 137
Solutions to Exercises 138
UNIT 4 Simulations: traffic flow and the trebuchet 157
Study guide 157
PART I: Modelling traffic flow 157
4.1 Introduction 157
4.2 Modelling traffic flow 158
4.2.1 Position and speed of cars 158
4.2.2 A circular road 159
4.2.3 Modelling the motion of cars 160
4.2.4 A first simulation 163
4.2.5 Traffic jams in a stochastic model 165
4.3 End of part exercises 168
PART II: The trebuchet 169
4.4 Introduction 169
4.5 The trebuchet 170
4.6 The trebuchet without a projectile: theory 179
4.7 The trebuchet without a projectile: numerical
investigation 186
4.7.1 The fixed and swinging counterweight timescales 186
4.7.2 The free-fall approximation 189
4.7.3 The variation of xC(τ) (optional) 194
4.7.4 The case L < 1 and the limit L = 0 (optional) 195
4.7.5 The motion for long times (optional) 197
4.8 The equations for trebuchets 198
4.8.1 Phase I motion 199
4.8.2 Calculation of the lift-off time 201
4.8.3 Phase II motion 204
4.9 Some simulations 206
4.9.1 The fixed counterweight trebuchet 207
4.9.2 The swinging counterweight trebuchet 212
4.10 End of part exercises 217
Solutions to Exercises 227
Index 239
4
7. UNIT 1 Random variables
Study guide
This unit relies on the working knowledge of Maple developed in Block A.
The sections should be studied in numerical order, and you will require
access to a computer to study most of them. Apart from reading the text
and understanding the examples, it is crucial that you work through the
exercises, as these are essential to learning the material. For solutions to
exercises that depend on generated random numbers, you may obtain
numerical results that are slightly different to those given in the text.
Introduction
In this unit we introduce the basic ideas of probability and random
numbers required for applications considered later in this block. No
assumptions about previous knowledge of probability are made. In
addition to elementary mathematical ideas we also introduce useful Maple
commands and use Maple to illustrate various important ideas. The
exercises set throughout the text are an important part of the learning
process and most should be attempted, without consulting the supplied
solutions. In this unit the Maple components of all exercise solutions are
not printed, but can be found on the course CD and website, which also
contains most of the procedures defined in this text.
There are three basic ideas introduced in Sections 1.1–1.3. In order to
provide an overview of these sections, these ideas are listed and briefly
described next. In Sections 1.1–1.3 we illustrate these ideas with examples
in order to help you develop an intuitive understanding; there is no need
for concern if you find the following descriptions too brief.
Outcomes An outcome is the result of an experiment or measurement;
for instance, the toss of a coin results in a head or a tail, which are the
two possible outcomes for this experiment; the measurement of the
number of spots on a giraffe results in an integer with unknown upper
and lower bounds.
The set of all possible outcomes of an experiment or measurement is
the fundamental object of probability theory; a particular experiment
or measurement is equivalent to choosing a member from this set. By
definition, any outcome is distinct from all others.
Probabilities There is a probability associated with each and every
outcome. Intuitively, the probability of an outcome is understood to be
the relative frequency that this outcome occurs in a large number, N,
5
8. Unit 1 Random variables
of experiments. Mathematically, we let N → ∞, and therein lies a
fundamental problem not addressed here.
Random variables The notion of a random variable is best introduced
through particular examples. A formal definition exists, but this is
practically useless until some intuition has been developed, and it is
not given in this course.
It is important to observe that randomness is a result of the underlying
measurement, and is often the result of not having control over all
significant variables.
The unit ends with a simulation of the growth of a simple population in
Section 1.4, where we introduce the ideas of deterministic and stochastic
approximations, and show when they are equivalent.
1.1 Discrete probabilities
In this section we introduce the idea of probability through simple,
common examples with a finite number of outcomes. The simplest
example is a coin toss, with only two, equally likely outcomes which are
mutually exclusive, meaning that both cannot occur simultaneously. In
N tosses, if there are respectively nh heads and nt tails, so nh + nt = N,
then for an unbiased coin we expect
nh 1 nt 1
Ph = lim = and Pt = lim = . (1.1)
N→∞ N 2 N→∞ N 2
The limit Ph is named the probability of the coin falling with the head
side up; and Pt is named the probability of the other outcome. Clearly,
since nh + nt = N, it follows that Ph + Pt = 1. It is immediately apparent
that neither of these probabilities can be measured directly because the
definition requires an infinite number of tosses. Instead, we do one of the
following.
• Compute the probabilities from first principles, in this case by
assuming that the coin is unbiased, that the toss is sufficiently
insensitive to the initial impulse, and that the result of one toss affects
no subsequent toss, to see that both outcomes are equally likely.
• Estimate the probabilities from measurements involving a finite
number of tosses. Each set of tosses is named a trial or a realisation.
Another common example is a die, a roll of which will result in one of the
six outcomes {1, 2, 3, 4, 5, 6}, all equally likely if the die is fair. So the
probability of each outcome is 1/6, that is, Pk = 1/6, k = 1, 2, . . . , 6; this is
an obvious result, derived shortly.
These two examples have the following important properties which are
shared by many other examples.
(a) Coin tosses or die rolls are unaffected by previous events.
(b) In any toss or roll, one and only one outcome can occur, so all possible
outcomes are mutually exclusive.
(c) The sum of the probabilities of all outcomes is unity.
(d) If the probability of a particular outcome o is P(o), then from (c) the
probability of this outcome not occurring is 1 − P(o).
The following definition of
dice is attributed to Ambrose
G. Bierce (1842–probably
1914), an American writer:
dice are small polka-dotted
cubes of ivory constructed like
a lawyer to lie upon any side,
commonly the wrong one.
6
9. Section 1.1 Discrete probabilities
In general, if an experiment has m possible outcomes {x1, x2, . . . , xm} and
it is performed N times with xk occurring nk times, then the
probability Pk of outcome xk is defined to be
Pk = lim
nk
. (1.2)
N→∞ N
The sum of all these probabilities is unity because n1 + n2 + · · · + nm = N
and hence
m m
nk 1
P1 + P2 + · · · + Pm = lim = lim nk = 1.
N→∞ N N→∞ N
k=1 k=1
If we know that all possible outcomes are equally likely, as for the throw of
a die or a coin toss, that is, P1 = P2 = · · · = Pm, then the above equation
gives Pk = 1/m. For a die m = 6, so Pk = 1/6 for all relevant k.
Exercise 1.1
(a) What is the probability that a roll of a die gives an even number?
(b) What is the probability that a roll of a die gives either a 3 or a 5?
(c) What is the probability of drawing the ace of hearts from a deck of
52 cards?
Probabilities of successive independent events
If two independent events e1 and e2 have probabilities P1 and P2 of
occurring separately, then the probability of both events occurring is the
product of the individual probabilities, P1P2; successive coin tosses are
examples of independent events. If the two events are connected, the rule
for the probability that both occur is more involved; in this course only
independent events are considered.
As an example, the probability of obtaining two fours from two successive
die throws is (1/6)2.
Exercise 1.2
(a) How many outcomes exist when a die is thrown twice if the order is
(i) important, or (ii) immaterial?
(b) What is the probability of throwing first a 4 and then a 3?
(c) What is the probability of throwing a 4 and a 3 in either order?
(d) What is the probability that in two throws the sum of the results is 7?
(e) What is the probability of obtaining exactly two sixes in three throws?
Simulation of throwing a die
In most circumstances, a priori calculation of probabilities is not possible
and we usually resort to estimating probabilities from finite samples, which
is the subject of much of this unit. Such calculations inevitably have errors
and these must be understood. In order to introduce the method, we use it
to estimate the probability of obtaining a particular number in a single
throw of a die.
7
10. Unit 1 Random variables
If we throw a die N times, and nk, k = 1, 2, . . . , 6, is the number of times
k occurs, then the associated probability, Pk, is formally defined by the
limit in Equation (1.2). For a fair die, all six outcomes are equally
probable and Pk = 1/6 for k = 1, 2, . . . , 6.
An experiment or a simulation that measures Pk directly can use only
finite values of N, and then Pk is estimated by the formula
Pk =
nk
, (1.3)
N
which is just the relative frequency of occurrence of the number k in
N throws. Note that we use the same symbol for the random number
nk/N as for its limiting value, which is just a number. If we perform two
or more experiments, each with N throws, we are likely to obtain different
values for nk and hence estimates of Pk. Each experiment leading to a
particular value of nk is often named a realisation of nk, because the value
of nk is a particular number drawn from a set of random numbers.
An experiment that involves actually throwing a die N times is, for
large N, too time-consuming, and a computer simulation is preferable. For
this we use a random number generator, and in Maple an appropriate
procedure for some applications is generated by rand(n..m), where m and
n are two integers with m n, which produces integers j in the interval
n ≤ j ≤ m with equal probability: since there are m − n + 1 outcomes, the
probability of obtaining any integer in this interval is 1/(m − n + 1).
Setting n = 1 and m = 6 therefore simulates a die throw.
This random number generator is produced by the command
r := rand(1..6):
The subsequent command
j := r();
j := 2
generates an integer in the interval [1, 6], each possible outcome being
equally likely, and assigns it to j. Every subsequent value of r() is
independent of previous uses, just as each throw of a die is independent of
previous throws: this means that in all examples given here, you
may obtain results that differ from those shown.
There is, however, one very important difference between a real die and a
pseudo-die simulated by Maple. If we restart the worksheet, the same
sequence of ‘random’ numbers is reproduced, whereas with a die we cannot
go back in time to restart an identical set of throws. This allows programs
to be checked more easily, but is also why the experiment of actually
throwing a die is not the same as a computer simulation, although we
expect the measurable outcomes to be the same. In addition, if a computer
is used to generate a huge set of random numbers, then subtle problems
may arise; but these difficulties do not occur in this course.
The following short procedure P(N) uses rand(1..6) to calculate the
relative frequency of occurrence of the number 1 in N die throws, that is,
P1 as defined in Equation (1.3). In P(N) the local variable n is used to
count the number of times r()=1, so n is set to zero in line #1, and the
required relative frequency, Equation (1.3), is just n/N.
8
11. Section 1.1 Discrete probabilities
restart:
r := rand(1..6):
P := proc(N)
local k,n;
n := 0: #1
for k from 1 to N do; # Start loop
if r()=1 then n:=n+1 end if; # Count occurrences of 1
od;
evalf(n/N); # Compute relative frequency #2
end proc:
Applying this procedure 12 times, that is, carrying out 12 realisations or
trials, each with N = 10 throws, gives the following relative frequencies of
the occurrence of the number 1:
z := [seq(evalf[2](P(10)),k=1..12)];
z := [0.20, 0.40, 0., 0.20, 0.40, 0.10, 0., 0.10, 0.10, 0.20, 0.10, 0.]
You will notice that these estimates of P1 fluctuate significantly, the
smallest being 0 and the largest 0.4. This is fairly typical of trials involving
relatively small sample sizes, 10 in this case; it is one problem that
bedevils opinion polls and affects simulations where small sample sizes are
imposed by physical or economic constraints.
Such fluctuations are reduced by increasing the sample size N. For
instance, with N = 1000 we obtain in 12 realisations
z := [seq(evalf[2](P(1000)),k=1..12)];
z := [0.16, 0.17, 0.17, 0.13, 0.17, 0.15, 0.16, 0.17, 0.19, 0.18, 0.18, 0.19]
and now the smallest and largest estimates are 0.13 and 0.19.
Exercise 1.3
(a) Repeat the above calculation with N = 104 and N = 105, each with
15 realisations. In each case find the minimum and maximum values in
the list z. Notice that as N increases, the spread in the values of
P1(N) decreases.
(b) Now consider the effect of increasing the number of realisations. For
N = 10 and 100, use M = 10, 100 and 1000 realisations to examine
the spread in P1(N). You should observe that the spread increases
slightly as the number of realisations increases, as might be expected.
One way of understanding these fluctuations is to fix N, the number of
throws, and repeatedly compute n1 = NP1, the number of times 1 occurs,
using different random numbers: here we use n1 rather than n1/N because
integers are easier to deal with. It is important to remember that n1 is a
random number, which may take any value in [0, N]: we shall eventually
estimate the probability that n1 takes any value in this interval and
understand how this changes with N.
Consider 20 realisations of n1, computed using the procedure P(N), but
with the expression in line #2 replaced by n, so that n1 is output rather
than n1/N. With N = 120, representative outputs are
[17, 30, 18, 27, 20, 21, 22, 26, 16, 14, 17, 18, 23, 23, 19, 17, 29, 15, 22, 23].
(1.4)
9
12. Unit 1 Random variables
In this list, various values of n1 occur with the frequencies listed in the
following table.
Value of n1 14 15 16 17 18 19 20 21 22 23 26 27 29 30
Frequency 1 1 1 3 2 1 1 1 2 3 1 1 1 1
In this set of 20 realisations, the number 1 occurs 17 times in 3 trials, and
22 times in 2 trials. Thus estimates of P(17) and P(22) are P(17) � 3/20
and P(22) � 2/20.
Such a small set of trials gives neither a clear idea of the spread of n1 nor
the frequency with which each value is produced. Indeed, in this case, the
expected value, 120/6 = 20, occurs only once; other numbers occur more
frequently. For this problem, however, a relatively simple Maple procedure
– spread, listed below – runs a variant of procedure P(N) sufficiently many
times to give a clearer picture of the variation of values of n1 and of the
probabilities P(n1).
In Figure 1.1, two such sets of data are shown, each using M = 50 000
trials. On the left N = 120, and on the right N = 600. The solid line is the
graph of the function
1 (n1 − Np)2
1
P(n1) = exp − with p = (1.5)
2πNp(1 − p) 2Np(1 − p) 6 ,
which is an approximation to the probability P(n1) valid for N � 1; the
origin of this approximation is discussed in Sections 1.1–1.3, in particular
Equation (1.16) (page 20). The abscissae are the possible values of n1; the
ordinate is the relative frequency with which a particular value of n1
occurs. For instance, with N = 120, n1 = 20 occurs 4802 times in 50 000
realisations, giving a relative frequency of 4802/50 000 = 0.096 04;
Equation (1.5) gives 0.098.
10 20 30
0
0.02
0.04
0.06
0.08
0.1
80 100 120
0
0.01
0.02
0.03
0.04
0.05
= 50 000, = 120 = 50 000, = 600
P(n
M N M N
1
)
n1
n1
P(n1
)
Figure 1.1 Graphs showing the relative frequency of occurrence of given values
of n1, in 50 000 trials of N throws of a die. On the left N = 120, and on the right
N = 600. The solid line is the graph of the function P(n1), defined in
Equation (1.5).
We expect that as N → ∞, n1/N → 1/6, but for finite values of N we
observe significant spread about this limiting value.
In the left-hand figure, where N = 120, we see that n1 = 15 and 25 occur
with about half the frequency of n1 = 20. An analysis of the raw data
shows that about 3/4 of the 50 000 trials lead to n1 in the interval 20 ± 4.
This means that in a single trial there is a 75% chance of the estimated
probability n1/N being in the range 1
± 1
, that is, in the interval
6 30
[0.13, 0.20].
10
13. Section 1.1 Discrete probabilities
In the right-hand figure, N = 600 and now n1 = 90 and 110 occur with
about half the frequency of n1 = 100. In a single trial there is a 75%
1
chance of the estimated probability being in the range 1
± , that is, in
6 60
the interval [0.15, 0.18].
Later we shall see that if N � 1, there is a 75% chance of the estimated
√
probability being in the range 1/6 ± 0.43/ N: that is, to halve the
uncertainty requires a fourfold increase in N.
This set of data shows that a single estimate of P1, that is with M = 1,
can be misleading if the number of throws N is small.
The data for this graph were computed using the procedure
spread(M,N,R) listed and described below. In essence this procedure just
counts the number of times that n1 has a given value, but there are some
necessary details that make it appear more complicated. We expect the
value of n1, denoted by n in the procedure, to be close to N/6, and there
to be few occurrences of n1 where |N/6 − n1| is large. Therefore we collect
data only if n1 is inside the interval [N/6 − R, N/6 + R], where R is a
number provided in the argument list; data outside this range are ignored.
Appropriate values of R for each N are chosen by trial and error using a
relatively small number of trial runs, that is, when M is small.
The inputs for this procedure are:
M the number of realisations or trials, that is, the number of times n1 is
computed, for the same N, with different sets of random numbers
– in Figure 1.1 this is 50 000;
N the number of die throws in each trial – in Figure 1.1 this is 120
and 600 on the left and right, respectively;
R a measure of the range of values of n1 counted.
restart:
spread := proc(M,N,R)
local k,nmin,nmax,P,n,i,r;
r := rand(1..6):
nmin := floor(N/6-R): nmax := floor(N/6+R): #1
if nmin0 then nmin:=0 fi; #2
P := Array(nmin..nmax); # Initialise probability list #3
for k from 1 to M do; # Loop round trials #4
n := 0: #5
for i from 1 to N do; # Loop round N throws #6
if r()=1 then n:=n+1 fi; # Count occurrences of 1 #7
od:
if n=nmax and n=nmin then
P[n] := P[n]+1; # Update list element #8
fi;
od; #9
[seq([k,evalf[4](P[k]/M)],k=nmin..nmax)]: #10
end proc:
We now give some notes about this procedure.
#1 Define the minimum and maximum values of n to be considered.
#2 If R N/6, nmin will be negative, and thus smaller than the
minimum possible value of n1, which is 0.
11
14. Unit 1 Random variables
#3 Here we initialise a one-dimensional Array, which is a Maple data
structure, and in this context we use it as a list, but the index starts not
at 1, but at nmin. When initialised in this way, all elements are 0. Usually
a computation with an Array is faster than the equivalent computation
with a list.
In the present case, the element P[k] is used to count the number of times
that n1 = k.
#4 This is the beginning of the loop round the Mth trial: it ends at
line #9.
#5 The counter n = n1 is set to 0 for each trial.
#6 This is the beginning of the loop round the N throws of the die.
#7 In this line n is incremented by 1 if the number 1 is thrown.
#8 If n is in a suitable range, the relevant Array element is incremented
by 1.
#10 This defines the output as a list of the lists [k,P[k]], with
k=nmin..nmax.
A typical output of this procedure, given with the command
spread(100,60,3);, where M = 100, N = 60 and R = 3, is
[[7., 0.0900], [8., 0.110], [9., 0.110], [10., 0.130],
[11., 0.100], [12., 0.120], [13., 0.120]].
The fourth element of this list, [10., 0.130], shows that the probability of n1
being 10 for N = 60 is estimated from 100 realisations to be
P(10) � 0.130; Equation (1.5) gives P(10) = 0.138. Note that other runs
with the same parameters may give different estimates because different
random numbers may be used.
In the next exercise we compare the output of spread(M,N,R) with the
function defined in Equation (1.5), which is a good approximation to
P(n1) for large N; this function is derived at the end of Subsection 1.1.2.
An important lesson of this exercise is to see how good this approximation
can be.
Exercise 1.4
Use the procedure spread to plot graphs like those in Figure 1.1 for
N = 36 and 60, with M as large as feasible on your computer. On the
same graph, plot the function defined in Equation (1.5) (page 10).
As a guide to the size of M, the solution uses M = 50 000, but you should
first find the time taken with a smaller value in order to estimate the
computational time for larger values of M.
Exercise 1.5
A coin is tossed N times, with the kth toss defining the random number xk
according to the rule xk = 1 if a head occurs and xk = −1 otherwise. We
define the random variable s by the sum
s = x1 + x2 + · · · + xN .
The possible values of s are {−N, −N + 2, . . . , N − 2, N}. Write a
procedure similar to spread(M,N,R), and plot the frequency of occurrence
of values of s for (N, R) = (10, 10), (100, 35) and (1000, 100) and a suitable
value of M. The solution uses M = 50 000, but this takes a long time, so
you should experiment, as suggested in Exercise 1.4.
12
15. Section 1.1 Discrete probabilities
Exercise 1.6
There are three political parties, P1, P2 and P3, in a country with,
respectively, 20%, 39% and 41% of the vote. A polling company takes a
survey of 1000 voters to estimate the result of the vote on polling day. Use
Maple to estimate the probability that it will predict a win for P2.
[Hint: One method is to use rand(1..100) and give votes appropriately
when random numbers fall in the intervals [1, 20], [21, 59] and [60, 100].]
1.1.1 Random variables
The outcome of a particular die roll is not predictable, although it is
known to be an integer in the interval [1, 6], each with equal likelihood.
The lifetime of an electric light bulb, the height of a randomly chosen child
from a classroom or the time taken for a regularly occurring journey also
cannot be predicted, and neither can the upper or lower limits of their
values. Such variables are named random variables.
The set of all possible values a random variable can take is named its
range. The range may contain a finite or countably infinite number of
values, in which case the random variable is said to be discrete: the
outcome of rolling a die is a discrete random variable. Or the range may
be continuous, as in the lifetime of a light bulb or the height of a child, and
then the random variable is said to be continuous. In practice, however,
there is often little difference between discrete and continuous variables
because all measurements have finite resolution; for instance, the height of
a child cannot easily be measured to within the nearest millimetre. In
general, any number representing a measurement will be an integer
multiple of the smallest number the measuring instrument can detect. It
is, however, usually convenient to make a mathematical distinction
between discrete and continuous variables, so we discuss them separately,
the latter being deferred until Section 1.2.
Discrete random variables
Consider, as an illustration, the die with k denoting the score in any
throw, so the range of k is {1, 2, 3, 4, 5, 6}. The function that specifies the
probability that k takes each value of the range is denoted by P(k) or Pk,
which is named the probability function (or probability distribution)
of k. For a die,
1
P(k) = pk = , k = 1, 2, . . . , 6. (1.6)
6
Another example is the choice of a card from a standard pack: the
probability Pp of choosing a picture card is 3 × 4/52 = 3/13, and the
probability Pn of choosing a number card is
Pn = 10 × 4/52 = 10/13 = 1 − Pp, when an ace is counted as a number
card. These probability functions can be calculated precisely, but most are
not so simple; for instance, the number of eggs in a bird’s nest varies from Here we use the notation
zero to an unknown maximum, with a probability function that can only {x1, x2, . . . , xN } to denote the
range, which is a list, rather
be approximately determined by experiment.
than [x1, x2, . . . , xN ], because
In general, if there are N distinct possible outcomes, {x1, x2, . . . , xN }, of a with just two outcomes, 0
and 1 for instance, the
process, the probability function will be a rule
notation [0, 1] could be
Pk = P(xk) = pk with 0 ≤ pk ≤ 1, k = 1, 2, . . . , N, (1.7) confused with the interval
0 ≤ x ≤ 1. Maple uses curly
associating the probability pk with each outcome xk. The range brackets to denote sets, but
{x1, x2, . . . , xN } is a list of non-repeating, distinct items, with a defined there should be no confusion.
13
16. Unit 1 Random variables
order. If the xk are numbers, then normally xk xk+1; but the range
could be {h, t} when representing the toss of a coin. By defining an order
there is a one-to-one correspondence between xk, the list element, and k,
the index, which need not start at 1. This is why either notation, P(xk)
or Pk, can be used to denote the probability function.
Since probabilities sum to unity, we must have
N
Pk = 1. (1.8)
k=1
An example of a random number with N + 1 outcomes, where N is any
integer, is the integers nk of Equation (1.3) (page 8), which vary between 0
and N, representing the number of times the face 1 appears in N throws of
a die.
Another important random number is the ratio nk/N, used in
Equation (1.3) to estimate the probability Pk. Thus we see that the limit,
defined in Equation (1.2) (page 7), is a real number but the ratio (1.3),
used to define this limit, is a random variable. This distinction is
important.
Exercise 1.7
A roulette wheel is divided into 37 sectors numbered 0–36, not in
numerical order. The segments are alternately red and black, except the
sector containing zero. What are the probabilities of the following events?
(a) The ball falls on a red segment.
(b) The ball falls on an odd number.
In the examples of a card pack, a coin or a die, the probabilities can be
determined from elementary considerations. Usually this is not possible
and it is necessary to estimate probabilities by experiment or computer
simulations. We show below how a simulation is performed for simple
examples.
The numerical estimation of probabilities
The numerical estimation of probabilities is essentially an exercise in
counting, and we illustrate the method with a simple example.
A die is rolled four times with outcomes d1, d2, d3 and d4. The random
number s is defined by the relation
1/2 1/3 1/4
s = d1 + d + d + d , (1.9)
2 3 4
where �x� denotes the integer part of x, e.g. �4.6� = 4. This random
number has the smallest value s = 4 and largest value s = 11, when all dk
are respectively 1 and 6, although these values of s are also given by other
combinations. We wish to estimate the probabilities P(s).
This can be achieved by computing s, M � 1 times, each time using four
independent random numbers in the range 1–6. If s takes the value k,
mk times with k = 4, 5, . . . , 11, then P(k) � mk/M.
With M = 104, the following estimates of the probability distribution P(s)
are obtained.
s 4 5 6 7 8 9 10 11
P(s) 0.0273 0.1200 0.1650 0.1632 0.1702 0.1702 0.1378 0.046 30
14
17. Section 1.1 Discrete probabilities
This table shows that in M = 104 trials we expect the outcome to be s = 4
about 273 times. In this example it is possible to compute P(s) exactly: in
Exercise 1.10 we see that P(4) = 1/36 � 0.0278.
The Maple procedure count(M) used to compute these values is listed
next; it has only one argument, M, the number of trials.
restart:
count := proc(M)
local P,s,k,r,i;
r := rand(1..6): # Set up random number generator
P := Array(4..11): # Initialise the Array P
for i from 1 to M do: # Start loop round M trials
Form the sum defined in Equation (1.9):
s := floor(add(r()^(1/k),k=1..4));
P[s] := P[s]+1; # Update Array elements
# Now P[s] is the number of occurrences of number s
od:
Finally, compute the probabilities and put them in a list:
[seq([j,evalf[4](P[j]/M)],j=4..11)];
end proc:
Exercise 1.8
A die is rolled 5 times in succession to give 5 random numbers dk,
k = 1, 2, . . . , 5, each in the range {1, 2, 3, 4, 5, 6}. The sum of these
numbers,
s = d1 + d2 + d3 + d4 + d5,
is another random variable, with the range {5, 6, . . . , 30}. Use Maple to
estimate the probability function P(s) and plot its graph.
Exercise 1.9
A pair of n-sided dice with outcomes {1, 2, 3, . . . , n} are thrown to produce
a pair of random integers (x1, y1) that defines a point in the Cartesian
plane. Two more points, (x2, y2) and (x3, y3), are found similarly. These
points can be joined to form a triangle, the area of which is
1
A = |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)| .
2
1 (n−1)2
This is a random number with the range 0, 2 , 1, . . . , .
2
(a) If n = 2, show that P(0) = 5
and P(1
) = 3
, exactly.
8 2 8
(b) Write a Maple procedure to estimate Pk, with xk = (k − 1)2/2, for
any n, and check that for n = 2 your procedure gives results consistent
with the exact result derived above. Use your procedure to find
approximations to the probabilities when n = 6 and n = 10.
Exercise 1.10
For the random number s defined in Equation (1.9), the number of
possibilities is 64 = 1296, so the probabilities P(k), k = 4, 5, . . . , 11, can be
computed exactly. Use Maple to perform this calculation, and show that
P(4) = 1/36 and P(6) = P(7) = P(8) = P(9).
15
18. Unit 1 Random variables
1.1.2 Special distributions
Here we describe a few useful and common distributions of discrete
random variables. In practical simulations we require sets of random
numbers drawn from given distributions, and Maple has many built-in
procedures to supply these; the simplest is rand(n..m), introduced on
page 8 and used in all previous applications.
There are many other distributions available in Maple, and we shall make
use of several throughout the remainder of this course. All are accessed
using the Statistics package, which also contains tools to manipulate
random numbers; you may obtain an overview by typing ?Stats, if you
wish, but it is not necessary at this stage. We introduce each distribution
and the various tools as necessary.
Uniform distributions
The discrete random variable x with n possible outcomes and range
{x1, x2, . . . , xn} is said to be uniformly distributed if the probability
distribution satisfies
1
P(x) = , x = xk, k = 1, 2, . . . , n, (1.10)
n
that is, all outcomes are equally likely. The toss of a coin and score of a die
throw give uniform distributions with n = 2 and 6, respectively. Random
integers uniformly distributed in the interval [n, m] are produced by the
procedure returned with the command rand(n..m), as described on
page 8. But they can also be generated using the relevant commands from
the Statistics package
restart: with(Statistics):
Once the Statistics package has been invoked, the RandomVariable
command can be used to create a random variable with a specified
distribution. For instance, a discrete uniform distribution in the interval
[1, 10] is created by
X := RandomVariable(DiscreteUniform(1,10)):
This is equivalent to the command rand(1..10) and associates X with an
integer random variable uniform in the range {1, 2, . . . , 10}. The variable X
can be used in a variety of ways. For example, the probability function of
this distribution is given with the command
p := ProbabilityFunction(X,u);
⎧
0 u 1
⎪
⎪
⎨ 1
p := u ≤ 10
⎪ 10
⎪
⎩
0 10 u
so that the value at u = 1 is given by
eval(p,u=1);
1
10
Alternatively, we can create a Maple function
p := u-ProbabilityFunction(X,u);
p := u → Statistics:-ProbabilityFunction(X, u)
and now the value at u = 2 is given by
In this procedure the limits of
the range, 1 and 10 in this
example, must be integers
otherwise, in Maple 11,
numerical errors may occur.
The argument of this function
can be a real number, not
only an integer as suggested
by the definition, although
this function should be
defined only on the integers.
16
19. Section 1.1 Discrete probabilities
p(2);
1
10
We often require a sample of random numbers from such a distribution; a
sample of 10 numbers, for instance, is given with the command
z := Sample(X,10);
z := [9., 10., 7., 8., 8., 4., 7., 2., 8., 1.]
and another execution of the command gives a different result, for instance
z := Sample(X,10);
z := [3., 1., 1., 9., 7., 4., 10., 1., 5., 4.]
As with rand(n..m), restarting the worksheet reproduces previous results.
The variable z is a Vector data type, not a list, and can usefully be used
in various functions, some of which are introduced in Subsection 1.3.1.
Bernoulli trials
Any statistical problem can be reduced to just two outcomes by grouping
all possible outcomes into two mutually exclusive sets. For instance, in a
throw of a die, one set could be the outcome 6, with probability p = 1/6,
and the other set the outcomes {1, 2, 3, 4, 5}, with probability 1 − p = 5/6.
In a horse race, for some the only significant outcomes are whether a
particular horse wins or loses.
An experiment with precisely two outcomes is named a Bernoulli trial.
These outcomes are often described as a success or a failure with
probabilities p and 1 − p, respectively.
A random variable k with range {0, 1} and with P(0) = 1 − p and
P(1) = p is said to have a Bernoulli distribution with parameter p; this
probability distribution can be written succinctly in the form
P(k) = pk
(1 − p)1−k
, k = 0 or 1. (1.11)
1
The result of a single coin toss is a Bernoulli distribution with p = .
2
Exercise 1.11
Give the probability of a success in the following Bernoulli trials.
(a) Drawing a single card from a pack of 52, a success being an ace of
spades.
(b) Drawing a single card from a pack of 52, a success being either a king
or a queen.
(c) Throwing two dice, a success being when the sum of the two outcomes
is 11.
Binomial distributions
Consider a set of n random variables xj, j = 1, 2, . . . , n, each with outcome
0 or 1, and with a Bernoulli distribution with parameter p. The sum
s = x1 + x2 + · · · + xn (1.12)
is another discrete random variable, with range {0, 1, 2, . . . , n}. The
distribution of s can be shown to be
n!
P(s) = ps
(1 − p)n−s
, s = 0, 1, . . . , n. (1.13)
s! (n − s)!
17
20. Unit 1 Random variables
It is named the binomial distribution and it has three factors with the
following meanings.
• The factor n!/(s! (n − s)!) is named the binomial coefficient. It is
the number of ways of choosing s things from a set of n things. For
instance, from a list of three items [a, b, c], there are 3!/(2! 1!) = 3 ways
of choosing any pair, [a, b], [a, c] or [b, c], when the order is immaterial.
s
• The component p is the probability that there are s ones.
• The component (1 − p)n−s is the probability that there are n − s zeros.
Note that the binomial coefficient in Equation (1.13) is so useful that it is
often denoted by one of three special symbols:
n! n
= = n
Cs = nCs.
s! (n − s)! s
We use the first of these.
The probability P(s) equals the sth term of the binomial expansion
n
n! s
bn−s
(a + b)n
= a , with a = p and b = 1 − p. (1.14)
s! (n − s)!
s=0
n
Putting a = p and b = 1 − p shows directly that P(s) = 1.
s=0
The Maple command to generate random numbers with the binomial
distribution P(s), Equation (1.13), is similar to the command for the
discrete uniform variable. There are two parameters, n and p, and a
variable s:
with(Statistics):
X := RandomVariable(Binomial(n,p)):
P := ProbabilityFunction(X,s);
0 s 0
P :=
binomial(n, s) ps (1 − p)(n−s) otherwise
where ‘binomial(n, s)’ is the Maple terminology for the binomial
n
coefficient .
s
A collection of 9 random numbers drawn from a distribution with n = 10
1
and p = is obtained as follows:
2
Y := RandomVariable(Binomial(10,0.5)):
R := Sample(Y,9);
R := [7., 6., 3., 4., 5., 8., 8., 3., 8.]
A similar set of random numbers can be produced by tossing a coin
10 times, scoring 1 for a head and 0 for a tail, and adding these 10 scores.
Since either 10 consecutive heads or 10 consecutive tails is unlikely, P(10)
and P(0) are very small. For very many tosses, n � 1, we expect the score
to be close to n/2.
Exercise 1.12
A coin is tossed n times. By associating each of the tosses with a random
variable k, with k = 1 for a head and k = 0 for a tail, use Equations (1.12)
and (1.13) to show that the probability of obtaining h heads, in any order,
is
1 n!
P(h) = .
2n h! (n − h)!
Also show that P(h) = P(n − h).
18
21. Section 1.1 Discrete probabilities
Exercise 1.13
A die is rolled four times, with a result 1–5 scoring zero and a 6 scoring
one, with the total score being the sum of these four subsidiary scores.
Show that the outcomes are {0, 1, 2, 3, 4}, and find their associated
probabilities.
Exercise 1.14
Use the Maple function defined for the binomial distribution to plot the
graphs of P(xn), 0 x 1, for:
(a) n = 10, with p = 0.1 and 0.5;
(b) n = 100, with p = 0.1 and 0.5.
Exercise 1.15
Use the Maple command sum to show that
n n
2
sP(s) = np and s2
P(s) = np + n(n − 1)p ,
s=0 s=0
where P(s) is defined in Equation (1.13).
Exercise 1.16
Use a suitable Maple procedure to obtain M � 1 random numbers xk,
k = 1, 2, . . . , M, from a binomial distribution with n = 20 and parameter
p = 0.4, and demonstrate that for large M,
1
M
xk � np.
M
k=1
Exercise 1.17
(a) By differentiating both sides of Equation (1.14) with respect to a,
show that
n
sn! s
bn−s
an(a + b)n−1
= a .
s! (n − s)!
s=0
By putting a = p and b = 1 − p, deduce that, as in Exercise 1.15,
n
sP(s) = np
s=0
where P(s) is given in Equation (1.13).
(b) Show, with a further differentiation, that
n
2
s n!
an(a + b)n−1
+ n(n − 1)a2
(a + b)n−2
= as
bn−s
, n ≥ 1,
s! (n − s)!
s=0
and deduce that
n
2
s2
P(s) = np + n(n − 1)p .
s=0
19
22. Unit 1 Random variables
For small values of n, the binomial distribution is simple to compute, but
for large n it is more difficult; more to the point, it is difficult to
understand how it behaves with n, s and p. However, for large n, s and
n − s, Stirling’s approximation to the factorial function, namely
√
k! � 2πk (k/e)k, accurate for large k, can be used to show that
Equation (1.13) can be approximated by
n!
P(s) = ps
(1 − p)n−s
s! (n − s)!
1 (s − np)2
� exp − . (1.15)
2πnp(1 − p) 2np(1 − p)
This result is derived on the course CD.
Exercise 1.18
For n = 100, make a graphical comparison of the binomial distribution
P(s) defined by Equation (1.13), for p = 0.1, 0.2 and 0.5, with the
approximation given in Equation (1.15).
The binomial distribution is important and will be used in Section 1.4 to
understand some aspects of population growth. Here we use it to
understand Figure 1.1 (page 10), which shows the distribution of n1, the
number of times that a particular side of a die falls face up in N throws.
For the kth throw, set xk = 1 for a successful throw and xk = 0 otherwise.
Then
x1 + x2 + · · · + xN = n1.
1
Since each xk has a Bernoulli distribution with p = , it follows that the
6
1
distribution of n1 is given by Equation (1.13) with p = and n = N, and
6
that for large N this is approximated by Equation (1.15) to give
6 18(n1 − N/6)2
P(n1) � √ exp − . (1.16)
10πN 5N
The graph of this function is shown by the solid lines in Figure 1.1
(page 10).
1.2 Continuous random variables
Many random variables occurring in nature are continuous; three examples
were given at the beginning of Subsection 1.1.1. Continuous random
variables pose practical problems in both the measurement of the
distribution functions and their estimation using a computer simulation.
Consider, for instance, the times of a frequently taken journey, such as to
work each day: time is, for all practical purposes, a continuous variable,
but measurement of a particular journey time will be accurate to, say,
1 minute, so all times in the interval (30, 31] minutes are considered
equivalent. Thus for practical purposes a continuous random variable is
treated exactly like a discrete variable, although there are important
mathematical niceties associated with continuous random variables.
20
23. Section 1.2 Continuous random variables
In general, a continuous random variable x has a range a ≤ x ≤ b; that is,
there are infinitely many outcomes and the probability of x having a
particular value is zero. Thus we need to consider the probability that x
lies in an interval x1 x ≤ x2, which we denote by P(x1, x2), with x2 x1.
The probability P(x1, x2) depends upon the two variables x1 and x2, but if
x2 − x1 is sufficiently small, we expect P(x1, x2) to be proportional to
δx = x2 − x1. Consider, for instance, a large barrel of assorted apples:
typically apples weigh between 100 g and 300 g, so if we choose all those
weighing between 190 g and 210 g, we should expect about half to weigh
between 190 g and 200 g, because for small intervals we expect the
distribution to be uniform.
Thus for small positive δx we expect
P(x, x + δx) � ρ(x) δx, (1.17)
where ρ(x) depends only upon x and is a non-negative function. Further,
the smaller δx, the better this approximation is expected to be. The
function ρ(x) is simpler than P(x, x + δx) because it depends upon only
one variable, x, rather than two. It is named the probability density or
density function. Notice that while the probability P(x1, x2) is
dimensionless, the density has dimensions which are the inverse of those
of x. The density is not a probability and, in particular, can exceed unity.
The interval [a, b] can be divided into M equal-length subintervals
I1 = [x0, x1] and Ik = (xk−1, xk], k = 2, 3, . . . , M, with
xk − xk−1 = (b − a)/M, x0 = a and xM = b. The probability of x being in
the interval [a, xn], n ≤ M, is, by definition, P(a, xn), and this must equal
the sum of the probabilities that x is in one of the subintervals Ik,
k = 1, 2, . . . , n, that is,
n n
b − a
P(a, xn) = P(xk−1, xk) � ρ(xk−1) δx, δx = . (1.18)
M
k=1 k=1
In the limit as M → ∞, that is, δx → 0, the second sum becomes an
integral and we obtain
x
P(a, x) = du ρ(u), a ≤ x ≤ b. (1.19)
a
If a is the left-hand limit of the range of x, it is normal and more
convenient to write P(a, x) = P(x), and henceforth we adopt this
convention. See Figure 1.2 for an illustration.
The probability P(x) is named the cumulative distribution function
and is the probability that the random variable u is in the interval [a, x].
Since the variable must lie in [a, b], we have
b
P(b) = 1 and du ρ(u) = 1. (1.20)
a
This integral is named the normalisation condition for the probability
density ρ(x).
The interval [a, b] need not be finite: it could be half the real line, [a, ∞),
or the whole real line, (−∞, ∞), for instance.
Exercise 1.19
For the density ρ(x), defined on the whole real line, express the probability
that x lies in the interval [x1, x2] in terms of the cumulative probability.
Figure 1.2 An illustration of
Equation (1.19) using the
convention P(x) = P(a, x)
21
24. Unit 1 Random variables
An example of a continuous distribution is that of the wind speed, v, at a
particular location and height, which is important in the positioning of
wind farms. It transpires that, to a good approximation, most
measurements can be fitted to the two-parameter Weibull distribution,
the density of which is defined by the formula,
β−1 β
β v v
ρw(v) = exp − , (1.21)
η η η
where η is known as the scale parameter and β the shape parameter, which
is usually about 2 in these applications. Some values of these parameters
and the mean wind speed at various locations are given in the following
table.
Average wind speed (m s−1)
Scale parameter η (m s−1)
Shape parameter β
Bala,
Wales
Brest,
France
Carcassonne,
France
Stornoway,
Scotland
Cork,
Eire
7.04
7.85
1.58
6.87
7.75
2.02
7.62
8.60
2.06
7.68
8.65
1.86
6.96
7.85
1.95
Exercise 1.20
(a) Show that the cumulative distribution of the Weibull density is
β
v
P(v) = 1 − exp − ,
η
and deduce that this distribution is normalised.
(b) Wind turbines work only in a restricted speed range; typically this is Note that in practice it is
between 5 and 25 m s−1, that is, 11 to 56 mph. Find the probability necessary to allow for the
direction of the wind, and
that the wind speed is in this interval for the sites listed in the table.
variations in this will also
decrease the availability (and
energy output).
1.2.1 Special continuous distributions
The uniform distribution
A continuous random variable x with a uniform distribution on a ≤ x ≤ b
has the density
⎧
1
⎨ , if a ≤ x ≤ b,
ρ(x) = b − a (1.22)
⎩
0, otherwise.
Random numbers from this distribution are generated with the Maple
command X := RandomVariable(Uniform(a,b)), and a Vector of M
such random numbers is produced with the command Sample(X,M),
provided that a (with b a) and M evaluate to real numbers.
22
25. Section 1.2 Continuous random variables
The exponential distribution
A non-negative random variable x with the density
ρ(x) = λe−λx
, x ≥ 0, (1.23)
where λ is any positive number, is said to have an exponential
distribution. A Vector of M random numbers from this distribution is
generated with the Maple commands
with(Statistics):
X := RandomVariable(Exponential(L)):
R := Sample(X,M);
where L = 1/λ must be a positive real number.
Exercise 1.21
Show that the cumulative distribution for the uniform and the exponential
distributions are, respectively,
x − a −λx
P(x) = , a ≤ x ≤ b, and P(x) = 1 − e , x ≥ 0.
b − a
The Gaussian or normal distribution
A random variable x with the density
1 (x − µ)2
ρ(x) = √ exp − , (1.24)
2σ2
σ 2π
where σ is a positive number, is said to be normally distributed with a
normal distribution; this is also named a Gaussian distribution. It is
an important distribution and will be discussed in a little more detail in
Subsection 1.3.2; meanwhile, note that Equation (1.15) (page 20) shows
that if n � 1, the binomial distribution is approximated by a normal
distribution with µ = np and σ2 = np(1 − p). It occurs frequently in
Unit 2.
A Vector of M random numbers with this distribution is generated with
the Maple commands
with(Statistics):
X := RandomVariable(Normal(mu,sigma)):
R := Sample(X,M):
Exercise 1.22
(a) Use Maple to plot the graph of the Gaussian distribution for µ = 0
and various values of σ, for instance σ = 0.5, 1, 2 and 5.
(b) Use the fact that
∞ ∞
2 √ 1 (x − µ)2
1
dx e−x
= π to show that √ dx exp − = 1.
2 2σ2
0 σ 2π −∞
[Hint: Define a suitable new integration variable.]
23
26. Unit 1 Random variables
1.2.2 Changing variables
It is often necessary to find the density of one variable z when it is related
to another variable x with a known density ρ(x). For instance, if x is
uniformly distributed on (0, 1), what would be the density of z if z = x2?
We show here that there is a very simple relation between the density
functions of x and z.
Suppose that z = f(x) and that f(x) is strictly monotonic increasing for
a ≤ x ≤ b, as shown in Figure 1.3, and that in this interval the density for
x is ρ(x). Because f(x) is increasing, the equation z = f(x) can be
inverted to give x in terms of z, x = g(z); for example, if z = x2, for x 0,
√
then x = z.
Consider a small interval, of length δx, along the x-axis. The probability of
x being in this interval is, by definition, ρ(x) δx. From the construction
shown with the dotted lines, this interval is projected onto an interval of
length δz along the z-axis, and the probability that z lies in this interval is
r(z) δz, where r(z) is the density of z that we need to find. These two
probabilities must be equal, hence
ρ(x) δx = r(z) δz.
Also, if the interval on the x-axis is (x, x + δx), the z-axis interval is
(f(x), f(x + δx)), and since, for small δx, f(x + δx) � f(x) + f�(x) δx, we
have δz = f�(x) δx. Thus the required density is
1
r(z) = ρ(x), where x = g(z). (1.25)
f�(x)
For instance, if f(x) = x2 and x is uniform on [0, 1], with
1, if 0 ≤ x ≤ 1,
ρ(x) =
0, otherwise,
then since f�(x) = 2x and g(z) =
√
z, Equation (1.25) gives
⎧
1
⎨ √ , if 0 z ≤ 1,
r(z) = 2 z (1.26)
⎩
0, if z 0 or z 1.
Notice that in this case the density r(z) is unbounded as z → 0, although
the probability that z lies in any finite-length subinterval of [0, 1] is less
than 1.
Exercise 1.23
(a) Confirm that r(z) in Equation (1.26) is normalised.
(b) Confirm that r(z) as given in Equation (1.25) is normalised provided
that ρ(x) is.
Exercise 1.24
Show that if z = f(x) where f(x) is a positive, strictly monotonic
decreasing function on [a, b], that is, f�(x) 0 (with possible exceptions at
isolated points where f�(x) = 0) for a ≤ x ≤ b, with inverse x = g(z), then
1
r(z) = ρ(x), x = g(z). (1.27)
|f�(x)|
This relation is the general result, valid when f(x) is strictly monotonic
increasing or decreasing.
Figure 1.3 Sketch showing
how the interval of width δx
is mapped onto an interval δz
by the monotonic increasing
function z = f(x)
Recall that f(x) is monotonic
increasing on [a, b] if
f(x1) ≤ f(x2) whenever
a ≤ x1 x2 ≤ b, whereas
f(x) is strictly monotonic
increasing on [a, b] if
f(x1) f(x2) whenever
a ≤ x1 x2 ≤ b. Similar
definitions hold for monotonic
decreasing functions.
24
27. Section 1.2 Continuous random variables
A common transformation is that of scaling a variable, so z = cx, where c
is a positive constant; then Equation (1.25) becomes r(z) = ρ(z/c)/c. For
instance, Figure 1.1 (page 10) shows the distribution function of n1, the
number of times the number 1 occurs in N die throws, and in
Equation (1.16) we give an approximate formula for this distribution.
Since n1 is roughly proportional to N, a more convenient variable is
z = n1/N, for we expect the distribution of z to have its maximum at
z = 1/6 independent of the value of N. Applying Equation (1.25) to
Equation (1.16) (page 20) with c = 1/N gives
ρ(z) = NP(zN) = 6
N
10π
exp
−
18N(z − 1/6)2
5
, z =
n1
N
. (1.28)
Exercise 1.25
A projectile is fired with moderate speed v at an angle θ to the horizontal.
Neglecting air resistance, the horizontal range is R = (v2/g) sin 2θ. If the
speed has a distribution uniform in v1 ≤ v ≤ v2, show that the distribution
of the range is
2
1 vk
ρ(R) = √ √ √ , Rk = sin 2θ, k = 1, 2.
2 R( R2 − R1) g
1.2.3 The simulation of a continuous distribution
The numerical calculation of the density ρ(x) of a continuous random
variable x is similar to that for a discrete random variable, but there is one
important difference that requires some thought. It is not usually possible
to compute ρ(x) at every point, and it is therefore necessary to divide the
range of x into suitably small intervals, which in this course are taken to
have equal length δx; we then compute the number of events falling into
each interval, which provides an approximation to ρ(x) δx. In any
application the length of the interval δx needs to be chosen carefully, for
reasons we discuss at the end of this section.
More precisely, if a ≤ x ≤ b, we define N small intervals (xk−1, xk),
k = 1, 2, . . . , N, with xk = a + k δx and N δx = b − a, so x0 = a and
xN = b, as shown in Figure 1.4 for N = 5.
Figure 1.4 Scheme for estimating ρ(x) in N = 5 equally spaced intervals
The probability of x being in (xk−1, xk) is approximately
Pk = ρ xk − 1
δx δx, k = 1, 2, . . . , N, (1.29)
2
where ρ is evaluated at the mid-point of the interval; this is a good
approximation if the interval is sufficiently small that ρ(x) varies little
across it. An estimate of Pk, k = 1, 2, . . . , N, then provides an estimate for
ρ(x) at the discrete set of N points xk − δx/2, k = 1, 2, . . . , N.
25
28. Unit 1 Random variables
The method is most easily described by applying it to a simple problem,
which we take to be a variation of the problem given in Exercise 1.9. Take
three pairs of random numbers (xi, yi), i = 1, 2, 3, with all six random
numbers uniformly distributed in [0, 1]. Each pair defines a point in the
xy-plane, and hence the three pairs define a triangle. The area A of the
triangle is
A = 1
2 |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)| ,
and this is another random variable in the interval [0, 1
2 ]; we require ρ(A),
the density of A.
In order to clarify this process, we split the calculation into simple stages.
First, we define a procedure to compute the area using six suitable random
numbers, as follows.
restart: with(Statistics):
Define the random variable
X := RandomVariable(Uniform(0,1)):
and then a procedure using X to generate 6 random numbers such that
xi = R[i] and yi = R[i+3], and then compute the area of the triangle:
A := proc()
local R;
Note that this procedure has
no input arguments.
R := Sample(X,6); # Define 6 random numbers
abs(R[1]*(R[5]-R[6])+R[2]*(R[6]-R[4])
+R[3]*(R[4]-R[5]))/2;
end proc:
A typical output from this procedure is
A();
0.01407195570
The value of A is in [0, 1
2 ], and for the purposes of this preliminary
calculation we divide this interval into N = 10 equal-length intervals
N := 10:
and define Aj = j/(2N), j = 0, 1, . . . , N = 10. Next define an Array such
that the element P[j] will be the probability that the value of A lies in the
jth interval (Aj−1, Aj); the Array P is initialised with the command
P := Array(1..N):
Now all that is necessary is to compute the area sufficiently many times
and count the number of times that A falls into each interval. In this case
0 ≤ A ≤ 1
2 , and 0 ≤ 2NA ≤ N, so we compute the value of 2NA and if
this has a value in [j, j + 1), for some integer 0 ≤ j ≤ N − 1, we increment
P[j+1] by 1; the Nth interval must also include the limit 2NA = N. The
required value of j + 1 is given with the command 1+floor(2*A*N). This
calculation is performed in the next set of commands, in which the number
of trials, M, is set to 100.
Recall that this command
assigns the value 0 to all the
elements of P.
M := 100: # Set number of trials
for k from 1 to M do: # Loop round trials
j := 1+floor(2*A()*N); # Compute the interval label
if jN then j:=N fi; #1
P[j] := P[j]+1; # Increment relevant Array element
od:
26
29. Section 1.2 Continuous random variables
Line #1 deals with the case A = 1
2 , for which the previous term gives
j = N + 1, which would lead to an error when trying to access the Array
element P[N+1]. Also, numerical errors could lead to values of A slightly
larger than 1
2.
The probabilities of A being in each interval are obtained by dividing each
element of P by M, the number of trials:
[seq(evalf[3](P[k]/M),k=1..N)];
[0.540, 0.240, 0.130, 0.0500, 0.0100, 0.0200, 0., 0.0100, 0., 0.]
Thus the probability that 0 ≤ A 1/20 is about 0.54, as given by the first
element of this list. These probabilities are related to the density ρ(A) by
the formula ρ(A) δA = P, and since δA = 1/(2N) this gives
δA 2N δA 1 1
ρ Aj − = Pj, Aj − = j − . (1.30)
2 M 2 2 2N
In the following command we create a list of the lists
[Aj − δA/2, ρ(Aj − δA/2)], suitable for plotting a graph of ρ(A):
rho := [seq([(j-1/2)/(2*N),evalf[3](2*N*P[j]/M)],j=1..N)];
1 3 1 7 9
ρ := , 10.8 , , 4.80 , , 2.60 , , 1. , , 0.200 ,
40 40 8 40 40
11 13 3 17 19
, 0.400 , , 0. , , 0.200 , , 0. , , 0.
40 40 8 40 40
The following command will plot the graph of this function, as a solid line
and the set of points where it is actually calculated.
with(plots):
plot([rho,rho],style=[point,line],colour=[black,red],
symbol=cross);
This gives the curve shown in Figure 1.5 with the crosses. The other curve,
passing through the circles, is obtained with N = 100 intervals and
M = 50 000 trials, which provides a more accurate estimate of ρ(A).
Figure 1.5 Graphs of the estimated values of the density ρ(A) computed using
N = 10 intervals and M = 100 samples (crosses), and 100 intervals with 50 000
samples (circles)
The calculation of ρ(A) involves choosing values for two independent
parameters: N, the number of intervals, and M, the number of trials.
The interval size is proportional to 1/N, and since ρ(A) is a continuous
function, large values of N provide a smoother approximation to ρ,
particularly if it changes rapidly. This suggests that we make N as large as
possible.
The number of trials m that lead to A falling into a given interval is
proportional to M and inversely proportional to N, i.e. m ∝ M/N. We
27
30. Unit 1 Random variables
need m to be large otherwise there will be significant fluctuations between
adjacent intervals, as seen in the data reproduced in Equation (1.4)
(page 9) showing the fluctuations in the die simulation using a small
sample. Thus for a smooth representation of ρ(A) we need m � 1, that is,
M � N.
However, in complicated applications the evaluation of each trial is often
computationally time-consuming, with each taking days or more of
computing time. So practical considerations often impose upper limits on
the number of trials M, and thus impose a lower limit on the interval size.
The consequences of changing M, with N fixed, are shown in Figure 1.6.
0 0.1 0.2 0.3 0.4 0.5
0
2
4
6
8
10
0 0.1 0.2 0.3 0.4 0.5
0
2
4
6
8
10
12
0 0.1 0.2 0.3 0.4 0.5
0
2
4
6
8
10
12
= 20, =20 = 20, =100 = 20, =1000
N M N M N M
Figure 1.6 Graphs showing how the estimates of ρ(A) change with the number of
trials M, for a fixed number of intervals N = 20. On the left, M = 20 and the
estimates in adjacent intervals fluctuate significantly. As M increases, these
fluctuations decrease in magnitude to produce a smoother line.
In the three examples shown in Figure 1.6 we fix N = 20 and increase M
from left to right: so in each case ρ(A) is estimated at Aj = (j − 1/2)/40,
j = 1, 2, . . . , 20. In the left-hand panel the number of trials equals the
number of intervals, M = N = 20, and we see significant fluctuations in
the estimates of ρ(A). In the central panel M = 100 and we see that the
fluctuations are present, but less significant. In the right-hand panel,
where M = 1000, we see this smoothing continuing and also that the
smaller values of ρ(A), near A = 0.2, are estimated more accurately. This
last approximation should be compared with the case N = 100 and
M = 50 000 shown in Figure 1.5.
In practice, the choice of the number of intervals N, and the sample
size M, is a compromise which involves judgements about the accuracy
required and the computational resources and time available.
Exercise 1.26
The logistic map xn+1 = axn(1 − xn), 0 a ≤ 4, 0 x0 1, was
considered in Block B, where it was shown to display chaotic behaviour if
a 3.6.
For a given value of x0, say x0 = 0.2, the iterates {x1, x2, . . .} all lie in
(0, 1), and the density ρ(x) is defined in terms of the relative frequency
with which these points lie in given intervals.
Write a Maple procedure to estimate this density and plot its graph for
a = 3.5, 3.6 and 3.9. For a = 4 the density can be shown to have the simple
form ρ(x) = 1/(π x(1 − x)), which can be used to check your procedure.
28
31. 1.3 The statistics of a random variable
The density gives the fullest description of a random variable, but its
accurate measurement requires very many observations so it is sometimes
convenient to describe a random variable by single numbers, or statistics,
that encapsulate important information and are easier to understand,
though great care is usually needed when drawing conclusions from a
single statistic.
For instance, in 2002 the average weekly earnings in the UK was £465 per
week; this measure is one accepted number describing the wealth of the
nation, and for some purposes is quite useful. However, the distribution of
wages is such that half the working population earned less than £383 per
week; this is named the median. The most common wage was £241 per
week; this is named the mode. The reason why the average, the median
and the mode are different is shown in Figure 1.7, which depicts an
approximation to the distribution of earnings ρ(E); from this we observe
that the average is heavily distorted by the relatively few high earners.
Figure 1.7 Graph showing an approximation to the distribution function of
weekly earnings in 2002 in the UK. Here ρ(E) is approximated at £10 intervals.
After this cautionary tale we now describe some basic statistics.
The simplest statistic is the average; for a set of N random numbers xi,
i = 1, 2, . . . , N, the sample average is defined to be
1
N
x = xi. (1.31)
N
i=1
We shall also call this the average. The average is also a random number,
but as N → ∞ we expect it to approach a definite limit. In practice, x is
computed using a finite sample of N values, and different samples will give
different estimates, as shown in the next exercise.
Exercise 1.27
Use Maple to find 100 different estimates of x with N = 10, where the xi
are drawn from a sample of integers uniformly distributed in [1, 100].
Represent your results graphically; also find the minimum and maximum
of your estimates.
29
32. Unit 1 Random variables
If the random variables in the sum (1.31) are from a set with m ≤ N
distinct outcomes {x1, x2, . . . , xm}, in a representative sample there are
nk occurrences of xk, with n1 + n2 + · · · + nm = N, so the sum may be
rearranged to the form
m m
1 nk
x = nkxk = xk. (1.32)
N N
k=1 k=1
As N → ∞, the ratio nk/N → P(xk), the probability of event xk, and this
sum becomes
m m
�x� = lim
nk
xk = xk P(xk). (1.33)
N→∞ N
k=1 k=1
This sum is a number named the mean, the distribution mean or the
expectation value of the distribution with the range {x1, x2, . . . , xm},
each xk being associated with the probability P(xk). It is important to
distinguish between the average and the mean.
• The average or sample average is a random number obtained from an
incomplete sample: it is defined in Equation (1.31) and is denoted by x.
• The mean is a number and is a statistic depending on the probability
function, Equation (1.33), and is denoted by �x�.
Some texts do not distinguish between the average and the mean.
Sometimes the term expectation value is used for the mean, but this is a
misnomer; for instance, if xk = ±1 with equal probability, then the mean is
zero, a value that cannot be expected to occur.
Exercise 1.28
(a) Show that for a die, �x� = 7/2.
(b) What is �x� for a Bernoulli distribution with parameter p?
The expression (1.33) for �x� generalises directly to continuous random
variables. For a density ρ(x), a ≤ x ≤ b, divide the interval into
N intervals of equal length δx, so xj = a + j δx and N δx = b − a, as shown
in Figure 1.8 for N = 5.
Figure 1.8
The probability Pk that an event occurs in the kth interval is, by
definition, approximately ρ(xk) δx, so Equation (1.33) becomes
N
�x� � xk ρ(xk) δx. (1.34)
k=1
30
33. Section 1.3 The statistics of a random variable
On taking the limit N → ∞, the expression on the right-hand side of this
approximation becomes an integral, thus the mean of a continuous
distribution is
b
�x� = dx x ρ(x). (1.35)
a
Exercise 1.29
Find the means of the uniform distribution, Equation (1.22), the
exponential distribution, Equation (1.23), and the normal distribution,
Equation (1.24).
The mean is not the only statistic. The kth moment, Mk, of a random
variable x is defined to be the mean value of xk and is given by the
formulae
⎧ m
⎪
⎪
⎪
⎪
⎨ xk
j Pj, for a discrete variable,
Mk = �xk
� =
⎪
j=1
b
(1.36)
⎪
⎪
⎪
⎩ dx xk
ρ(x), for a continuous variable in (a, b).
a
By putting k = 1 we see that the first moment is the mean; the next most
important moment is M2, which we discuss soon.
These formulae for the moments may be generalised to any function of x,
not just powers: thus the mean of f(x) over a random variable x is
⎧ m
⎪
⎪
⎪
⎪ f(xj) Pj, for a discrete variable,
⎨
�f(x)� = j=1 (1.37)
⎪ b
⎪
⎪
⎪
⎩ dx f(x) ρ(x), for a continuous variable in (a, b).
a
For a sample of random variables xk, k = 1, 2, . . . , M, the sample average
of a given function f(x) is defined to be the random number
1
M
f(x) = f(xk). (1.38)
M
k=1
n
The sample nth moment Mn is obtained by setting f(x) = x .
The example of earnings discussed at the beginning of this section shows
that the mean or average can be a misleading statistic. The standard
example of the man with feet in the oven and head in the fridge being, on
average, at the correct temperature illustrates the danger of ascribing too
much significance to an average.
An important additional piece of information about a distribution of a
random variable x is its standard deviation, denoted by σ, and the
related number the variance of x, Var(x) = σ2. The standard deviation is
defined in terms of the mean of (x − �x�)2, so is a measure of the spread of
the distribution about its mean value. The square of σ and the variance
are defined by the equation
σ2
= Var(x) = (x − �x�)2
. (1.39)
31
34. Unit 1 Random variables
For a continuous distribution this expression can be expressed as an
integral:
b
2
σ2
= dx x2
− 2x �x� + �x� ρ(x)
a
b b b
= dx x2
ρ(x) − 2 dx x �x� ρ(x) + dx �x�2
ρ(x).
a a a
Because �x� is a number,
b b b
2 2
dx x �x� ρ(x) = �x� dx x ρ(x) = �x� and dx �x�2
ρ(x) = �x� ,
a a a
hence
2
σ2
= Var(x) = �x2
� − �x� = M2 − M1
2
. (1.40)
The value of σ is a measure of the spread of a random variable: for small σ
the variable is more often close to its mean value.
This last expression for σ2 in terms of the first two moments is also valid
for discrete probabilities, as proved in the next exercise.
Exercise 1.30
Show that Equation (1.40) is true for the discrete random variable with
range {x1, x2, . . . , xn} and associated probabilities P(xk), k = 1, 2, . . . , n.
Exercise 1.31
If y = f(x), where x is a random variable on [a, b] with density ρ(x), show
that the mean of any function g(y) of y is given by
b
�g(y)� = dx ρ(x) g(f(x)).
a
Exercise 1.32
Show that the standard deviation of the binomial distribution,
Equation (1.13) (page 17) with parameters n and p, is given by
σ2 = np(1 − p).
[Hint: Use the results of Exercise 1.17.]
Exercise 1.33
(a) Show that the sum of the means of f(x) and g(x) is the mean of
f(x) + g(x).
(b) If x is a random variable, show that the mean of the average equals
the mean, that is,
1
N
�x� = �x� where x = xi.
N
i=1
Note that this result is not true for arbitrary functions of x: for
instance, �x2� =
� �x2� (see Exercise 1.56).
32
35. Section 1.3 The statistics of a random variable
Exercise 1.34
(a) Find the first four moments and the standard deviation of the
continuous distribution, uniform on [0, 1].
(b) Find the first four moments and the standard deviation of the random
numbers produced by a six-sided die.
(c) Sketch a graph of the density function
1
2 , −2 ≤ x ≤ −1 or 1 ≤ x ≤ 2,
ρ(x) =
0, otherwise,
and find the kth moment, its mean and standard deviation.
Exercise 1.35
The energy that can be extracted from wind by a wind turbine is This exercise is optional.
proportional to
v3, v1 ≤ v ≤ v2,
E(v) =
0, otherwise,
where v is the wind speed. Find the mean and standard deviation of E(v)
for (v1, v2) = (5, 25) m s−1, assuming that the wind speed satisfies the
Weibull distribution, Equation (1.21) (page 22), for the five cases listed in
the table after Equation (1.21).
1.3.1 Maple functions for mean and variance
The Statistics package has built-in functions to compute the average,
mean and variance of random variables, which are best described using a
specific example; for this we choose the geometric distribution, the
probability function of which is
P(s) = p(1 − p)s
, 0 p 1, s = 0, 1, 2, . . . , (1.41)
where p is a parameter and the range of s, {0, 1, 2, . . .}, is infinite. A
physical interpretation of this distribution is that if p is the probability of
success in a Bernoulli trial, then P(s) is the probability that in s + 1 trials,
the first s all fail and trial s + 1 is a success.
Before dealing with the Maple implementation of this, you should do the
following exercise.
Exercise 1.36
For the geometric probability defined by Equation (1.41), show that
∞
1 − p 1
P(s) = 1, M1 = and M2 = (1 − p)(2 − p),
2
p p
s=0
and hence find the standard deviation.
[Hint: The sum of P(s) is a geometric series; other useful sums can be
obtained from this by differentiating with respect to p.]
33
36. Unit 1 Random variables
The geometric distribution is invoked with the commands
restart: with(Statistics):
X := RandomVariable(Geometric(p)):
The Maple function Mean will find the mean of the distribution
Mean(X);
1 − p
p
and will also find the average of a sample. For instance, if p = 0.1, a
sample of 10 random numbers from this distribution is given by
Y := RandomVariable(Geometric(0.1)): R := Sample(Y,10);
R := [4., 12., 7., 4., 1., 2., 0., 15., 17., 4.]
and the average of these is given by
M1 := Mean(R);
M1 := 6.600000000
This Maple procedure takes the argument R, which must be an Array or a
Vector; but it also allows the computation of averages of functions of the
sample. For instance, the averages of R2, the second moment, and sin(Rk)
k
are given by
M2 := Mean(map(x-x^2,R));
M2 := 76.
and
Mean(map(x-sin(x),R));
−0.07103350453
There is another procedure, Moment(R,m) or Moment(X,m), which
computes the mth moment Mm of the random numbers R or the
distribution X. The Maple procedure Mean yields a mean or an average
according to the nature of its argument. There is a similar procedure that
computes the distribution variance, for example,
Variance(X);
1 − p
2
p
But for a sample of N random numbers, the same function computes the
sample variance V , defined by the equation
1
N
N N
V = (Ri − M1)2
= M2 − M2
= σ2
. (1.42)
N − 1 N − 1 1
N − 1
i=1
The sample variance V is a random number, and this definition, rather
than that given in Equation (1.40), is often used to ensure that its mean,
�V �, is equal to the distribution variance, i.e. �V � = σ2: the proof of this is
provided on the course CD. Thus the sample R has the sample variance
given by
V := Variance(R);
V := 36.04444444
whereas the first and second moments give
sig2 := M2-M1^2;
sig2 := 32.44000000
and we see that V = 10σ2/9. For large samples the difference between σ2
and V is insignificant, but in the next unit we shall encounter an
application where the difference cannot be ignored as it is in this unit.
34
37. Section 1.3 The statistics of a random variable
1.3.2 Mean and standard deviation of the normal
distribution
In many of the applications described later, the normal distribution is
important, so it is helpful to know some of its statistics. Its mean, or first
moment, is given by
∞
1 (x − µ)2
M1 = �x� = √ dx x exp − . (1.43)
2σ2
σ 2π −∞
This integral is most easily evaluated by writing x = (x − µ) + µ and
setting z = x − µ, as in the solution to Exercise 1.29, to give
∞
�x� = µ dx ρ(x) = µ. (1.44)
−∞
The second moment is
2
M2 = σ2
+ µ . (1.45)
From this relation it follows that σ is the standard deviation of the normal
distribution.
Exercise 1.37
Derive Equation (1.45).
The geometric significance of µ and σ is illustrated in Figure 1.9, showing
the graph of the normal distribution for µ = σ = 1, the solid line, and
µ = 1 and σ = 2, the dashed line. This shows that at x = µ the
distribution has a local maximum. The figure also shows when the width
of the distribution is 2σ, between x = µ ± σ, for σ = 1; the width decreases
as σ decreases.
Figure 1.9 Graph showing the meaning of the parameters µ and σ of the normal
distribution, defined in Equation (1.24) on page 23
The standard deviation is a measure of the width of the distribution. The
probability that a value of x lies in the interval (µ − σ, µ + σ) is
1 µ+σ
(x − µ)2
P1 = √ dx exp −
2σ2
σ 2π µ−σ
√
1/ 2 √
= √ dw e−w
, where x = µ + σw 2.
1 2
√
π −1/ 2
This integral is most easily evaluated numerically, and Maple gives
P1 = 0.683, that is, there is about a 68% chance of x falling within one
standard deviation of the mean. In the next exercise we show that there is
about a 95% chance of x falling within two standard deviations of the
mean.
35
38. Unit 1 Random variables
Exercise 1.38
Show that the probability of x falling in the interval (µ − kσ, µ + kσ) can
be expressed as the integral
√
k/ 2
2 2
Pk = √ dw e−w
,
π 0
and find numerical values of P1, P2 and P3.
One application of this type of analysis is to Figure 1.1 (page 10),
describing the relative frequency of one side of a die falling face up in
N � 1 throws. The binomial distribution, Equation (1.13) (page 17),
describes this phenomenon exactly, and this is approximated by a
Gaussian distribution in Equation (1.16) (page 20) with mean N/6 and
√
standard deviation σ = 5N/6, so that
1
6
1 −
5
N
≤
n1
N
≤
1
6
1 +
5
N
with probability 0.68.
This shows that to halve the width about the mean into which about 2
3 of
the throws fall requires four times as many throws: to decrease the width
by a factor of 10 requires a hundredfold increase in N.
1.4 Population growth
In this section we introduce two types of approximation commonly used to
understand population dynamics. These types of problem arise in many
guises, for instance, the genetic change in a population, the spread of
diseases, chemical and nuclear reactions; but here we concentrate on a
simple one-species population in order to isolate essential ideas.
First, we introduce a deterministic approximation to the population of a
single species, in which the population N(t) is a function of the time t and
can be determined precisely if the initial population is known.
Second, we introduce a stochastic approximation in which it is assumed
that the number of births in a given time interval is a random number
chosen from a given distribution; now the population at any given time is a
random number.
The two types of approximation appear to be fundamentally different; but
one aim is to show that under some, but not all, conditions they yield the
same results.
1.4.1 A deterministic approximation
In this type of approximation the population at time t is assumed to be a
function N(t) of t which can be determined precisely if the initial
population N(0) = N0 is known, which is why it is named a
deterministic approximation.
36
39. Section 1.4 Population growth
For a single-species population with no deaths, the only parameter
describing the population dynamics is the birth rate. If N(t) is the
population at time t, it is assumed that the increase δN, during any small
time interval δt, is proportional to the population and the time interval,
δN = b N(t) δt, (1.46)
where the parameter b is named the birth rate: it has units of (Time)−1
and may be a function of time, or the population, or both, but here we
assume it to be constant.
With this assumption, the population at t + δt is, by definition,
N(t + δt) − N(t)
N(t + δt) = N(t) + N(t) b δt, that is, = b N(t).
δt
(1.47)
On taking the limit as δt → 0, using the definition of a derivative, we
obtain the first-order differential equation
dN
= bN, N(0) = N0. (1.48)
dt
If b is a constant, this equation has the solution
bt
N(t) = N0e , (1.49)
which is the equation for a continuous, exponential population growth.
This is a deterministic approximation because if N0 and b are known, the
value of N(t) is known exactly for t ≥ 0.
Exercise 1.39
If b is not a constant but depends upon time, how do Equations (1.48)
and (1.49) change?
In the approximation leading to Equation (1.49) it was assumed that
births can occur at all times. But many species, for instance birds, breed
only during particular seasons, so the limit used to derive Equation (1.48)
is not valid. In such instances we normally measure the population at
times nT, n = 0, 1, 2, . . ., that straddle the breeding season. Thus on
setting δt = T and t = (n − 1)T, Equation (1.47) becomes
N(nT) = (1 + bT) N((n − 1)T), n = 1, 2, . . . , with N(0) = N0,
(1.50)
so that the population at time nT is a multiple of the population at time
(n − 1)T: because this multiple is larger than unity, the population
increases geometrically.
Exercise 1.40
Use Equation (1.50) to show that
N(nT) = (1 + bT)n
N0. (1.51)
Equation (1.51) describes the population growth when time needs to be
treated as a discrete variable.
37
40. Unit 1 Random variables
1.4.2 A stochastic description of population growth
The derivations of both Equations (1.48) and (1.50) assume that in given
intervals, δt for Equation (1.47) and T for Equation (1.50), the population
increase is a known proportion of the population at the beginning of the
interval. However, a real population comprises individuals making
independent decisions; hence the number of births in a given time interval
cannot be a fixed, known proportion of the population, but must include
some random variation.
The easiest way to understand the effects of this random variation is to
consider the discrete time model, the deterministic approximation being
given by Equation (1.50). Now we assume that during the breeding season
each member of the population has a probability bT of a single birth, and
a probability 1 − bT of not giving birth: no other events are allowed. We
use the same symbol, b, as for the birth rate in the previous section
because, as will be seen, they represent the same quantity.
If N0 is the (known) initial population and N1 the population at time T,
then N1 could have any value between between N0 (no births) and 2N0
(N0 births). That is,
N1 = N0 + r0, (1.52)
where r0 is a random number with range {0, 1, . . . , N0}. Notice that now
N1 is a random number and not a function of time, as in the previous
approximations, which is why we use the notation N1 and not N(T).
In general, by the same arguments, if Nk is the population at time kT, the
relation between Nk and Nk−1 is
Nk = Nk−1 + rk−1, (1.53)
where rk−1 is a random number with range {0, 1, . . . , Nk−1}. Thus starting
with a given value of N0, a realisation of the population growth is obtained
by successively adding appropriate random numbers. This is known as a
stochastic approximation.
Our aim is to understand the connection between the random numbers Nk,
k = 1, 2, . . ., and the function N(kT). First, we consider a numerical
simulation in order to make a numerical connection between these entities.
Then we formally justify the numerical results.
In order to simulate this process we need the distribution function
for rk−1; this is obtained by assuming that each member of the population
is independent, and that there are two outcomes for each member, a birth
with probability bT or no birth with probability 1 − bT. This is an
example of a Bernoulli trial (see page 17). For a population of N it follows
that the random number r has the binomial distribution
N!
P(r) = (bT)r
(1 − bT)N−r
. (1.54)
r! (N − r)!
Hence the mean increase in the population during the breeding season is
(see Exercise 1.28, page 30)
N
r P(r) = bTN,
r=0
which is the number assumed when deriving the deterministic
approximation, Equation (1.50).
With this information we can use Maple to simulate the population
growth. Here we set T = 1 and bT = 0.1 and use various values of N. If N
is large, the probability P(r) has a maximum at r = bN, as is shown in
38
41. Section 1.4 Population growth
Figure 1.10, where P(r) is shown when N = 100 and b = 0.1, 0.2 and 0.3.
0 5 10 15 20 25 30 35 40 45
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
b=0.1
b=0.2
b=0.3
r
P(r)
Figure 1.10 Graph showing values of P(r), defined in Equation (1.54), with
N = 100 and T = 1. The circles are for b = 0.1, the squares for b = 0.2 and the
diamonds for b = 0.3. Note that the maximum in P(r) is near Nb.
In order to simulate this population dynamics using Maple we first need a
random number generator that gives a binomial distribution: this is given
by the command X := RandomVariable(Binomial(N,b)), where N and b
are the parameters defined above. Then a Vector of M random numbers
from this distribution is given with the command Sample(X,M); for
example, with N = 100 and b = 0.1, a sample of 10 such random numbers
is given by the following commands.
restart: with(Statistics):
X := RandomVariable(Binomial(100,0.1)):
R := Sample(X,10);
R := [13., 14., 7., 14., 11., 6., 8., 10., 15., 16.]
It is seen that these are bunched in the neighbourhood of Nb = 10, as
expected from the data shown in Figure 1.10.
We simulate the population growth with two procedures. The first,
evol1(N,b), uses Equation (1.53) to evolve the population though one
breeding cycle. Here N is the population at the beginning of the cycle, and
b is the birth rate, taken to be 0.1 in all the following; the output is the
population immediately after the breeding period. If N = 0 there can be
no change.
evol1 := proc(N,b)
local X;
if N=0 then return 0 fi; # No change if N=0
X := RandomVariable(Binomial(N,b)): # Define generator
N+Sample(X,1)[1]; # Add the number of births
end:
Running evol1(N,0.1) 20 times with N = 1 gives
N := 1: P := [seq(evol1(N,0.1),k=1..20)];
P := [1., 2., 2., 1., 1., 1., 1., 2., 1., 2., 1., 1., 1., 2., 1., 1., 1., 1., 1., 1.]
In these 20 trials the population changes in 5 cases, rather more than
expected; other trials will yield different results. Starting with N = 1000,
we obtain
N := 1000: P := [seq(evol1(N,0.1),k=1..10)];
P := [1089., 1095., 1100., 1105., 1109., 1095., 1101., 1103., 1103., 1099.]
which shows that the population increases by about 100 every time.
39
42. Unit 1 Random variables
The growth of a particular population over K breeding cycles is given by
repeatedly using evol1. This calculation is performed in the next
procedure, evol2(K,N0,b), where N0 is the initial population N0. The
output of this procedure is a list of the lists [k, Nk], k = 1, 2, . . . , K, where
Nk is the population at time k.
evol2 := proc(K,N0,b)
local M,pop,k;
M := N0: pop := [0,M]; # Define first element of list
for k from 1 to K do;
M := evol1(M,b); # Compute population at time k
pop := pop,[k,M]; # Increment list
od:
[pop]; # Create a list of lists
end:
An example of the population growing from N0 = 1 over 10 cycles is
evol2(10,1,0.1);
[[0, 1], [1, 1.], [2, 1.], [3, 1.], [4, 2.], [5, 2.],
[6, 2.], [7, 2.], [8, 2.], [9, 2.], [10, 2.]]
This particular realisation shows a slow initial growth; others would be
different.
A clearer picture of the possible types of population growth is obtained by
setting K = 50, N0 = 1, and displaying the results graphically. The
deterministic approximation, N(kT) = N0(1 + bT)k, grows exponentially,
so it is more convenient to consider
ln N(kT) = ln N0 + k ln(1 + bT), (1.55)
which increases linearly with k (recall that T = 1 in the simulations). Thus
it is better to plot ln Nk, rather than Nk, which we expect to increase
exponentially for large k.
The following two lines of code compute the data in the relevant form. The
first line simply computes a list of [k, Nk]; the second uses this to create a
list of the coordinates [k, ln Nk] needed to plot a graph.
z := evol2(50,1,0.1):
zz := [seq([z[k][1],evalf(log(z[k][2]))],k=1..nops(z))]:
A graph of this realisation can be plotted with the command plot(zz).
Figure 1.11 shows five carefully chosen realisations of the population, with
the jagged lines; the straight, red line through the origin is the graph of
ln N(k), Equation (1.55). In the time shown it is seen that most of the
populations eventually increase exponentially, and in Exercise 1.43 you will
show that the rate of increase is close to that of the deterministic model if
N0 is large enough.
You need to execute evol1
before using this procedure.
40
43. Section 1.4 Population growth
0 10 20 30 40 50
0
1
2
3
4
5
k
ln( )
N
Figure 1.11 Graph showing five realisations, the black lines; the straight red line
represents the deterministic approximation, Equation (1.55). Here N0 = 1, b = 0.1
and T = 1.
The next three exercises explore some of the relations between the
deterministic approximation, Equation (1.50), and the stochastic
approximation, with increasing N0.
In Exercise 1.41 we see that as N0 increases, most realisations of the
stochastic population become closer to the deterministic value, that is,
N(kT) � Nk.
In Exercise 1.42 we consider the time taken for the population to grow
from N0 to N0 + 1000 and show that as N0 increases, its average tends to
that of the deterministic approximation and its variation decreases, as
would be expected from Exercise 1.41.
In Exercise 1.43 you will see that the average growth rate of the stochastic
population from N0 to N0 + 1000 tends to that of the deterministic
approximation as N0 increases, and that the variation decreases.
Exercise 1.41
Produce graphs such as those shown in Figure 1.11, but for N0 = 2, 5, 10,
100 and 500, with b = 0.1 and T = 1.
Exercise 1.42
Write a procedure to compute the time for a population to grow from an
initial value N0 to first exceed N0 + 1000. For b = 0.1 find the average and
standard deviation of this random number for a representative sample of
N0 lying in the range 1 ≤ N0 ≤ 800, and compare these values with those
given by the deterministic approximation.
[Hint: Use a relatively small number of realisations, say M = 20.]
Exercise 1.43
Write a procedure to evolve a population starting with an initial value N0, This exercise is optional.
with a given growth rate b = 0.1 and T = 1, until the population first
exceeds N0 + 1000, at time KT. The procedure should compute the rate of
growth, g, of a particular population, as defined by the deterministic
equation N0 + 1000 = (1 + gT)KN0.
Find the mean and standard deviation of g for a representative sample of
N0 lying in the range 1 ≤ N0 ≤ 800; deduce that g � b.
[Hint: Use a relatively small number of realisations, say M = 20.]
41
44. Unit 1 Random variables
The average over many realisations
Here we consider in a little more detail how the stochastic and
deterministic approximations are related, by computing the average of
many realisations. First we shall show, numerically, that
Nk � N(kT), N0 ≥ 1,
and later we shall outline a proof showing that �Nk� = N(kT) for all N0.
But we shall also demonstrate, numerically, that the standard deviation
about the mean is large if N0 is small, so we cannot assume that any
realisation will be close to the deterministic approximation, even after the
population has become large. But when N0 is large enough, the standard
deviation is sufficiently small for the deterministic theory to be a good
approximation to most realisations of the stochastic growth.
Now consider the average of M realisations of the population, each for KT
units of time; it is convenient to represent the data as an M × (K + 1)
matrix R, where each row is one realisation and the kth column is the
population of each realisation at time (k − 1)T; the first column contains
the initial population N0.
The matrix R is computed in a double loop; as an example, to compute
M = 3 realisations for 5T, we set K = 5, M = 3, T = 1 and each
population has the same initial size N0, here chosen to be 1. In this code
we assume that the procedures evol1(N,b) and evol2(K,N0,b) are
already defined; with(plots) is needed because later the display
command is used.
with(Statistics): with(plots):
M := 3: K := 5: N0 := 1:
Define the birth rate b and initialise the matrix R:
b := 0.1: R := Matrix(M,K+1):
Now compute M realisations of the system:
for j from 1 to M do: # Loop round realisations
R[j,1] := N0; # The initial population
z := evol2(K,N0,b); # Compute a realisation
for k from 2 to K+1 do:
R[j,k] := z[k][2]: # Store result
od:
od:
In this example, three possible realisations are
R; ⎡ ⎤
1 1. 1. 1. 2. 2.
⎣ ⎦
1 1. 1. 1. 1. 1.
1 2. 3. 3. 4. 4.
In this set of realisations the populations at t = 5, the sixth column, are
2, 1 and 4.
The logarithm of the average of these realisations is obtained from the
average of each column, which involves the sum of R[j,k] for j=1..M and
each k:
Av := NULL: # Null sequence for list of averages
for k from 1 to K+1 do:
s := add(R[j,k],j=1..M)/M; # Avg. of populations at (k-1)T
42
45. Section 1.4 Population growth
Av := Av,[k-1,evalf(log(s))]; # Update list
od:
which gives, in this example,
evalf[3]([Av]);
[[0., 0.], [1., 0.288], [2., 0.511], [3., 0.511], [4., 0.847], [5., 0.847]]
In this calculation the logarithm of the average at t = 3 is 0.511. The
logarithm of the deterministic population is, since here T = 1,
pd := k-log(N0)+k*log(1+b);
pd := k → log(N0) + k log(1 + b)
In Figure 1.12 this deterministic approximation is compared with the
average over 500 realisations of the stochastic approximation, both with
b = 0.1 and N0 = 1. The stochastic approximation is depicted by the red
line, but the difference between the two lines is barely distinguishable.
k
ln(N )
5
4
3
2
1
k
0
0 10 20 30 40 50
Figure 1.12 A graph comparing the deterministic approximation (dashed, black
line) with an average over 500 realisations of the stochastic approximation for
N0 = 1 and b = 0.1 (red line). The two lines are barely distinguishable.
The graphs in Figure 1.12 show that Nk � N(kT) = N0(1 + bT)k, for
N0 = 1. In the light of the few realisations shown in Figure 1.11, this is
perhaps surprising. However, if we look more carefully at the data in R we
see that the spread in Nk increases with k. This is seen by computing the
maximum value and the standard deviation of Nk for each k, a
computation performed in Exercise 1.45. The natural logarithms of these
data are shown in Figure 1.13. At k = 50 the deterministic approximation,
Equation (1.55), and the average of the 500 realisations have the values
117.4 and 113.1, respectively; but the maximum value of N50 in the sample
is 611, and the standard deviation is 102. Thus for this example we deduce
that, in spite of the result shown in Figure 1.12, the deterministic theory
will give a poor approximation to most realisations.
0 10 20 30 40 50
-2
-1
0
1
2
3
4
5
6
7
deterministic
k
ln( max(Nk
) )
logarithm of the standard deviation
approximation
Figure 1.13 A graph of the maximum value of ln(Nk) (red curve) in the
500 realisations of the stochastic approximation, the logarithms of the standard
deviation (solid black curve) and the deterministic approximation (dotted black
straight line), Equation (1.55). Here N0 = 1 and b = 0.1.
43
46. Unit 1 Random variables
If the initial population is large, the results are quite different. Figure 1.14
shows results for N0 = 1000 and b = 0.1. The two red higher curves are the
minimum and maximum values of the logarithm of the population in a
sample size M = 500; the dashed black curve in between is the
deterministic approximation. The lower solid black curve is the logarithm
of the standard deviation: at k = 20, σ = 164 � N20 = 6700.
0 5 10 15 20
2
3
4
5
6
7
8
9
k
logarithm of the standard deviation
Figure 1.14 A graph of the maximum and minimum values of ln(Nk) (red
curves) in the 500 realisations of the stochastic approximation; in between these is
a dashed black curve representing the deterministic approximation,
Equation (1.55). The logarithm of the standard deviation is depicted by the solid
black curve. Here N0 = 1000 and b = 0.1.
We infer that Nk � N(kT) for all N0, but that if N0 is small, the standard
deviation of the stochastic simulations is large, and the deterministic
approximation is unlikely to give results representative of any particular
realisation. This means that when N0 is small, it is impossible to predict
the population of a particular realisation: only statistics can be estimated.
But if N0 is large, the deterministic theory gives a good approximation to
almost all realisations. The analysis presented in Subsection 1.4.3 supports
this inference.
Exercise 1.44
Write a Maple procedure to plot graphs similar to those in Figure 1.12 for
any N0 and b.
Exercise 1.45
Write a Maple procedure to compute the average, the standard deviation
and the maximum value of Nk, in M realisations for a given N0 and b with
T = 1. Use this procedure to investigate the effect of increasing N0 from 1
to 1000, and demonstrate that
σ
Nk
�
1 − b
1 + b
1
√
N0
.
1.4.3 Formal connection between the stochastic and
deterministic approximations
In this subsection we provide a non-rigorous explanation for the behaviour
seen in Figure 1.12, which shows that the average over many realisations of
the stochastic growth is the same as the deterministic growth. The basic
idea used here is quite simple, but the notation needed to express it is
rather clumsy; for this reason this section is not assessed.
44
47. Section 1.4 Population growth
If N
(j)
is the population of the jth realisation at time kT, then this
k
realisation is defined by the relation
(j) (j) (j)
N = N + r , k = 1, 2, . . . . (1.56)
k k−1 k−1
Suppose that there are M realisations, j = 1, 2, . . . , M. Then the average
shown in Figure 1.12 is
M
1 (j)
Nk = N , (1.57)
k
M
j=1
which satisfies the relation
M
1 (j)
Nk = Nk−1 + rk−1. (1.58)
M
j=1
This is similar to the recurrence relation for each realisation because the
equations are linear. The problem is to find a simple expression for the
averages
1
M
(j)
rk = rk ,
M
j=1
where each rk
(j)
is a random number with a binomial distribution with
(j) (j)
parameters p and N . If all the N were the same, Nk, then this sum
k k
would simply be the average of random numbers which, for large M, could
be approximated by the mean, bTNk. Then Equation (1.58) becomes the
same as Equation (1.50). This result is, in fact, correct but we need a little
more care to prove it because for most j, N
(j)
�
k = Nk.
(j) (j)
Divide the set of N into m disjoint subsets in which N has the values
k k
(j1) (j2) (jm)
N , N , . . . , N , with Mjs members in the subset js, so
k k k
M = Mj1 + Mj2 + · · · + Mjm . In the subset for N
(js)
we label the random
k
(js) (is)
numbers r belonging to these realisations by R , is = 1, 2, . . . , Mjs ,
k k
and hence
M Mj1
Mj2 Mjm
(j) (i1) (i2) (im)
r = R + R + · · · + R .
k k k k
j=1 i1=1 i2=1 im=1
Each of these sums is an average of random numbers over the same
binomial distribution, with parameters (N
(js)
, bT), so that as shown in
k
Exercises 1.16 and 1.17 (page 19),
Mjs
(is) (js)
R � Mjs bTN , provided that Mjs � 1.
k k
is=1
Hence
M
(j) (j1) (j2) (jm)
r � bT Mj1 N + Mj2 N + · · · + Mjm N
k k k k
j=1
M
(j)
= bT Nk = bTMNk,
j=1
and it follows that Equation (1.58) becomes
Nk = (1 + bT)Nk−1, N0 = N0. (1.59)
This is exactly the same as Equation (1.50) with N(kT) replaced by Nk,
which is the result demonstrated in Figure 1.12.
45
48. Unit 1 Random variables
Using the same method it can be shown that the standard deviation is
given by
σ2
= N0(1 − bT)(1 + bT)k−1
(1 + bT)k
− 1 , (1.60)
k
so that, for large k,
σk 1 1 − bT
= √ . (1.61)
Nk N0 1 + bT
These results are derived on the course CD.
1.4.4 Populations with births and deaths
This subsection is optional and is not assessed.
If the population has a non-zero death rate it should be clear that when
the initial population is small, the stochastic and deterministic
approximations can yield quite different predictions: some realisations will
die out even if the birth rate is larger than the death rate.
In order to illustrate this effect, we consider an idealised population with a
short breeding season at time kT, but now we include a death rate and
assume that deaths can occur at any time. As before we first consider the
deterministic approximation.
If the birth rate is b, the increase in the population during the breeding
season kT is bTN(kT), k = 1, 2, . . .. But between these times some
members of the population will die, and if the death rate is d, the equation
describing the population change is
dN
= −dN, (1.62)
dt
so just before the kth breeding season the population is
−dT
N(kT − δ) = N((k − 1)T)e . After this season the population will be
N(kT) = (1 + bT)e−dT
N((k − 1)T),
where we assume that a negligible number of deaths occur during the
breeding season. This gives the equivalent of the recurrence relation (1.50)
(page 37) and, as in Exercise 1.40, leads to
−ndT
N0.
N(nT) = (1 + bT)n
e (1.63)
If 1 + b ed, that is, b d for small d, the deterministic approximation of
the population increases without bound.
For the stochastic approximation we assume that a death can occur at any
time between breeding seasons, so immediately prior to the kth breeding
season the population is
N�
= Nk−1 − dk−1, (1.64)
k
where dk−1 is a random number from a binomial distribution with
parameters (Nk−1, d). Then immediately after the breeding season the
population will be
N� + bk, N� �= 0,
k k
Nk = (1.65)
0, N� = 0,
k
where bk is a random number from a binomial distribution with
parameters (N� , b).
k
46
49. Section 1.4 Population growth
Exercise 1.46
(a) Modify the procedures evol1(N,b) and evol2(K,N0,b) to include a
death rate d, and compare the average of M = 200, or more,
realisations with N0 = 1, T = 1, b = 0.1 and b = 0.2 with d = 0.25b,
0.5b and 0.75b, with the deterministic approximation for 0 ≤ k ≤ 50.
In each case determine the proportion of the realisations that lead to
extinction.
(b) Repeat the calculations described in part (a) for N0 = 2, 4 and 8.
The extinction ratios for the cases suggested in Exercise 1.46, computed
with 0 ≤ k ≤ 50 and 1000 realisations, are listed in Table 1.1.
Table 1.1 Extinction probabilities for b = 0.1, M = 1000 realisations and
various values of the death rate d and initial population N0
d N0 = 1 2 4 8 10 15
0.01 0.093 0.009 0 0 0 0
0.025 0.258 0.066 0.006 0 0 0
0.05 0.492 0.239 0.068 0.003 0 0
0.075 0.719 0.509 0.291 0.082 0.043 0.01
From the data in this table we see that if N0 = 1, even the smallest death
rate considered, d = 0.1b, gives a 10% probability of extinction, and this
increases to over 70% when d = 0.75b. But as N0 increases, the extinction
probability decreases dramatically.
A zero extinction probability does not, however, ensure that the
deterministic approximation, Equation (1.63), provides accurate
predictions; for this the standard deviation of the sample needs to be
small. Figure 1.15 shows how the standard deviation decreases in relation
to Nk as N0 increases. In this figure we show ln(Nk) (solid black line),
ln(min(Nk)) and ln(max(Nk)) (dashed black lines), where the minimum
and maximum values are taken from the 500 realisations used.
0 10 20 30 40 50
0
1
2
3
4
5
6
7
0 10 20 30 40 50
2
3
4
5
6
7
8
9
ln( ) ln( )
logarithm of the standard deviation logarithm of the standard deviation
0
= 20
0
= 400
k
k
k
N Nk
N N
Figure 1.15 Graphs relating to the population growth for b = 0.1, d = 0.05 for
N0 = 20 and 400, each using 500 realisations. The black lines are logarithms of
the average population (solid) and minimum and maximum values (dashed) in the
set considered. The red line is the logarithm of the standard deviation.
In the left-hand panel N0 = 20 and here max(N50
√
) = 404 and
min(N50) = 29, compared with N50 = 178; also, N0 σ50/ N50 = 1.65. In
this example the spread of the population across the 500 realisations is
large, so the deterministic approximation is invalid.
In the right-hand panel N0 = 400 and here max(N50) = 4567 and
47
50. Unit 1 Random variables
√
min(N50) = 2664, compared with N50 = 3605; also, N0 σ50/ N50 = 1.62.
In this example the deterministic approximation provides a reasonable
estimate of all realisations. These sets of data are consistent with the
√
suggestion that N0 σk/ Nk is practically independent of the initial
populations, as when d = 0.
1.5 End of unit exercises
These exercises can be used for revision.
Exercise 1.47
Find the standard deviation of the exponential distribution.
Exercise 1.48
If y = sin x and x is uniformly distributed in [0, π/2], what is the
distribution of y?
Exercise 1.49
If x is uniformly distributed in [0, 1] and y = − ln x, show that y has the
exponential distribution ρ(y) = exp(−y), y ≥ 0.
Exercise 1.50
a
(a) Show that if x is uniformly distributed in [0, 1] and y = x , a 0, then
ρ(y) = 1/(ay1−1/a), 0 ≤ y ≤ 1.
(b) Use this result to write a Maple procedure that gives N random
numbers from the distribution with density ρ(y) = 1/(2
√
y), 0 ≤ y ≤ 1,
and check your procedure by finding and comparing the mean and
average and by comparing the estimates of various moments with their
exact values.
Exercise 1.51
Find the nth moment and the standard deviation of the triangular
distribution
⎧
⎨ 1
(a − |x|), if |x| ≤ a,
2
ρ(x) = a
⎩ 0, if |x| a,
where a is a positive constant.
Exercise 1.52
The real symmetric matrix
cos2 θ 1
M =
1 sin2
θ
48
51. Section 1.5 End of unit exercises
has eigenvalues λ1(θ) and λ2(θ). If s = |λ1(θ) − λ2(θ)| and θ is a random
variable uniformly distributed on [0, π/4], show that the density of s is
√
2 s
ρ(s) = , 2 ≤ s ≤ 5.
π (5 − s2)(s2 − 4)
Exercise 1.53
The function x = x(t) is defined to be the solution of the equation
dx
= (k + εr)x, x(0) = 1,
dt
where r is a random variable uniform on [−1, 1], and k and ε are constants.
Find the solution, x, and hence show that its density is given by
1 (k−ε)t
≤ x ≤ e(k+ε)t
ρ(x) = , e .
2εxt
Show that the mean and standard deviation of x are given by
1 1
ekt
2
�x� = ekt
sinh εt and σ2
= (εt − tanh εt) sinh 2εt,
εt 2 εt
√
and that σ � �x� εt as t → ∞.
Exercise 1.54
In a game a die is rolled. If it shows 6, then a player moves three spaces
forward; if it shows 4 or 5, he moves two spaces forward; and if it shows 1,
2 or 3, he moves one space backwards.
A player starts at the origin and stops playing when he has moved a
positive distance greater than or equal to 15 spaces. Use Maple to simulate
this game and estimate the distribution function P(n) for the number of
rolls, n, to end the game. Plot the graph of P(n).
Exercise 1.55
The exponential growth of a population, as in Equation (1.49), is physically
unrealistic because eventually resources will be insufficient to sustain the
population and the birth rate must decline (or the death rate increase).
A method of introducing this effect into a deterministic approximation is
to allow a variable birth rate that tends to zero as the population reaches a
finite size M. Then Equation (1.48) (page 37) becomes
dN
= bNf(N, M), N(0) = N0 M,
dt
0, 0 ≤ N M,
where f(N, M)
= 0, N = M.
One simple example is f = 1 − N/M, so that if N � M, the equation is
˙
approximately the same as Equation (1.47), and if N � M, N � 0 and
there is little growth.
(a) Show that the solution of the deterministic equation
dN
= bN 1 −
N
, N(0) = N0 N,
dt M
is
N(t) =
M
, B =
M
− 1.
1 + B exp(−bt) N0
49
52. Unit 1 Random variables
(b) In the stochastic approximation the populations at times k − 1 and k
are related by
Nk = Nk−1 + rk−1
where rk is a random variable with the range {0, 1, 2, . . . , Nk}.
Assuming that rk has a binomial distribution with mean
bNk(1 − Nk/M), write a Maple procedure that simulates this process,
and compare the average over many realisations with the deterministic
approximation for various values of M and N0, with b = 0.1.
Exercise 1.56
If x is a random variable, show that
σ2
�x2
� = �x�2
+
N
where x is the sample average over N values.
This result is the reason why Equation (1.42) (page 34) is sometimes used
to compute the sample variance for small samples.
Learning outcomes
After studying this unit you should be able to:
• compute probabilities for simple situations, as exemplified by the
examples and exercises in the text;
• use in simple situations, common terms such as sample, trial,
realisation and probability distribution when applied to random
variables;
• recognise some common probability distributions, such as the uniform,
Bernoulli, binomial, exponential and Gaussian (or normal)
distributions;
• calculate the probability distribution of a transformed variable
z = f(x) (for f(x) monotonic) from the probability distribution ρ(x),
for simple situations;
• calculate statistical quantities such as the standard deviation and the
moments of discrete and continuous probability distributions and of
samples, in simple cases;
• use Maple to calculate samples of random variables from common
probability distributions, and to calculate the standard deviations and
the moments of the samples;
• demonstrate an understanding of the deterministic model of population
growth described in Subsection 1.4.1, by solving exercises such as those
in the text;
• use Maple to simulate the stochastic model of population growth
described in the text, averaged over many realisations, and interpret
the results.
50
54. Kepler’s whole attention was now devoted to the production of the
new tables. “Germany,” he wrote, “does not long for peace more
anxiously than I do for their publication.” But financial difficulties,
combined with civil and religious convulsions, long delayed the
accomplishment of his desires. From the 24th of June to the 29th of
August 1626, Linz was besieged, and its inhabitants reduced to the
utmost straits by bands of insurgent peasants. The pursuit of science
needed a more tranquil shelter; and on the raising of the blockade,
Kepler obtained permission to transfer his types to Ulm, where, in
September 1627, the Rudolphine Tables were at length given to the
world. Although by no means free from errors, their value appears
from the fact that they ranked for a century as the best aid to
astronomy. Appended were tables of logarithms and of refraction,
together with Tycho’s catalogue of 777 stars, enlarged by Kepler to
1005.
Kepler’s claims upon the insolvent imperial exchequer amounted
by this time to 12,000 florins. The emperor Ferdinand II., too happy
to transfer the burden, countenanced an arrangement by which
Kepler entered the service of the duke of Friedland (Wallenstein),
who assumed the full responsibility of the debt. In July 1628 Kepler
accordingly arrived with his family at Sagan in Silesia, where he
applied himself to the printing of his ephemerides up to the year
1636, and whence he issued, in 1629, a Notice to the Curious in
Things Celestial, warning astronomers of approaching transits. That
of Mercury was actually seen by Gassendi in Paris on the 7th of
November 1631 (being the first passage of a planet across the sun
ever observed); that of Venus, predicted for the 6th of December
following, was invisible in western Europe. Wallenstein’s promises to
Kepler were but imperfectly fulfilled. In lieu of the sums due, he
offered him a professorship at Rostock, which Kepler declined. An
55. expedition to Ratisbon, undertaken for the purpose of representing
his case to the diet, terminated his life. Shaken by the journey,
which he had performed entirely on horseback, he was attacked with
fever, and died at Ratisbon, on the 15th of November (N.S.), 1630,
in the fifty-ninth year of his age. An inventory of his effects showed
him to have been possessed of no inconsiderable property at the
time of his death. By his first wife he had five, and by his second
seven children, of whom only two, a son and a daughter, reached
maturity.
The character of Kepler’s genius is especially difficult to
estimate. His tendency towards mystical speculation formed a
not less fundamental quality of his mind than its strong grasp of
positive scientific truth. Without assigning to each element its
due value, no sound comprehension of his modes of thought can
be attained. His idea of the universe was essentially
Pythagorean and Platonic. He started with the conviction that
the arrangement of its parts must correspond with certain
abstract conceptions of the beautiful and harmonious. His
imagination, thus kindled, animated him to those severe labours
of which his great discoveries were the fruit. His demonstration
that the planes of all the planetary orbits pass through the
centre of the sun, coupled with his clear recognition of the sun
as the moving power of the system, entitles him to rank as the
founder of physical astronomy. But the fantastic relations
imagined by him of planetary movements and distances to
musical intervals and geometrical constructions seemed to
himself discoveries no less admirable than the achievements
which have secured his lasting fame. Outside the boundaries of
the solar system, the metaphysical side of his genius, no longer
held in check by experience, fully asserted itself. The Keplerian
56. like the Pythagorean cosmos was threefold, consisting of the
centre, or sun, the surface, represented by the sphere of the
fixed stars, and the intermediate space, filled with ethereal
matter. It is a mistake to suppose that he regarded the stars as
so many suns. He quotes indeed the opinion of Giordano Bruno
to that effect, but with dissent. Among his happy conjectures
may be mentioned that of the sun’s axial rotation, postulated by
him as the physical cause of the revolutions of the planets, and
soon after confirmed by the discovery of sun-spots; the
suggestion of a periodical variation in the obliquity of the
ecliptic; and the explanation as a solar atmospheric effect of the
radiance observed to surround the totally eclipsed sun.
It is impossible to consider without surprise the colossal
amount of work accomplished by Kepler under numerous
disadvantages. But his iron industry counted no obstacles, and
secured for him the highest triumph of genius, that of having
given to mankind the best that was in him. In private character
he was amiable and affectionate; his generosity in recognizing
the merits of others secured him against the worst shafts of
envy; and a life marked by numerous disquietudes was cheered
and ennobled by sentiments of sincere piety.
Kepler’s extensive literary remains, purchased by the empress
Catherine II. in 1724 from some Frankfort merchants, and long
inaccessibly deposited in the observatory of Pulkowa, were fully
brought to light, under the able editorship of Dr Ch. Frisch, in
the first complete edition of his works. This important
publication (Joannis Kepleri opera omnia, Frankfort, 1858-1871,
8 vols. 8vo) contains, besides the works already enumerated
and several minor treatises, a posthumous scientific satire
57. entitled Joh. Keppleri Somnium (first printed in 1634) and a vast
mass of his correspondence. A careful biography is appended,
founded mainly on his private notes and other authentic
documents. His correspondence with Herwart von Hohenburg,
unearthed by C. Anschütz at Munich, was printed at Prague in
1886.
Authorities—C. G. Reuschle, Kepler und die Astronomie
(Frankfort, 1871); Karl Goebel, Über Keplers astronomische
Anschauungen (Halle, 1871); E. F. Apelt, Johann Keplers
astronomische Weltansicht (Leipzig, 1849); J. L. C. Breitschwert,
Johann Keplers Leben und Wirken (Stuttgart, 1831); W. Förster,
Johann Kepler und die Harmonie der Sphären (Berlin, 1862); R.
Wolf, Geschichte der Astronomie (Munich, 1877); J. von Hasner,
Tycho Brahe und J. Kepler in Prag (1872); H. Brocard, Essai sur
la Météorologie de Kepler (Grenoble, 1879, 1881); Siegmund
Günther, Johannes Kepler und der tellurisch-kosmische
Magnetismus (Wien, 1888); N. Herz, Keplers Astrologie (1895);
Ludwig Günther, Keplers Traum vom Mond (1898; an annotated
translation of the Somnium); A. Müller, Johann Keppler, der
Gesetzgeber der neueren Astronomie (1903); Allgemeine
Deutsche Biographie, Bd. XV. (1882). (A. M. C.)
KEPPEL, AUGUSTUS KEPPEL, Viscount (1725-1786),
British admiral, second son of the second earl of Albemarle, was
58. born on the 25th of April 1725. He went to sea at the age of ten,
and had already five years of service to his credit when he was
appointed to the “Centurion,” and was sent with Anson round the
world in 1740. He had a narrow escape of being killed in the capture
of Paita (Nov. 13, 1741), and was named acting lieutenant in 1742.
In 1744 he was promoted to be commander and post captain. Until
the peace of 1748 he was actively employed. In 1747 he ran his ship
the “Maidstone” (50) ashore near Belleisle while chasing a French
vessel, but was honourably acquitted by a court martial, and
reappointed to another command. After peace had been signed he
was sent into the Mediterranean to persuade the dey of Algiers to
restrain the piratical operations of his subjects. The dey is said to
have complained that the king of England should have sent a
beardless boy to treat with him, and to have been told that if the
beard was the necessary qualification for an ambassador it would
have been easy to send a “Billy goat.” After trying the effect of
bullying without success, the dey made a treaty, and Keppel
returned in 1751. During the Seven Years’ War he saw constant
service. He was in North America in 1755, on the coast of France in
1756, was detached on a cruise to reduce the French settlements on
the west coast of Africa in 1758, and his ship the “Torbay” (74) was
the first to get into action in the battle of Quiberon in 1759. In 1757
he had formed part of the court martial which had condemned
Admiral Byng, and had been active among those who had
endeavoured to secure a pardon for him; but neither he nor those
who had acted with him could produce any serious reason why the
sentence should not be carried out. When Spain joined France in
1762 he was sent as second in command with Sir George Pocock in
the expedition which took Havannah. His health suffered from the
fever which carried off an immense proportion of the soldiers and
59. sailors, but the £25,000 of prize money which he received freed him
from the unpleasant position of younger son of a family ruined by
the extravagance of his father. He became rear-admiral in October
1762, was one of the Admiralty Board from July 1765 to November
1766, and was promoted vice-admiral on the 24th of October 1770.
When the Falkland Island dispute occurred in 1770 he was to have
commanded the fleet to be sent against Spain, but a settlement was
reached, and he had no occasion to hoist his flag. The most
important and the most debated period of his life belongs to the
opening years of the war of American Independence. Keppel was by
family connexion and personal preference a strong supporter of the
Whig connexion, led by the Marquess of Rockingham and the Duke
of Richmond. He shared in all the passions of his party, then
excluded from power by the resolute will of George III. As a member
of Parliament, in which he had a seat for Windsor from 1761 till
1780, and then for Surrey, he was a steady partisan, and was in
constant hostility with the “King’s Friends.” In common with them he
was prepared to believe that the king’s ministers, and in particular
Lord Sandwich, then First Lord of the Admiralty, were capable of any
villany. When therefore he was appointed to command the Western
Squadron, the main fleet prepared against France in 1778, he went
to sea predisposed to think that the First Lord would be glad to
cause him to be defeated. It was a further misfortune that when
Keppel hoisted his flag one of his subordinate admirals should have
been Sir Hugh Palliser (1723-1796), who was a member of the
Admiralty Board, a member of parliament, and in Keppel’s opinion,
which was generally shared, jointly responsible with his colleagues
for the bad state of the navy. When, therefore, the battle which
Keppel fought with the French on the 27th of July 1778 ended in a
highly unsatisfactory manner, owing mainly to his own unintelligent
60. management, but partly through the failure of Sir Hugh Palliser to
obey orders, he became convinced that he had been deliberately
betrayed. Though he praised Sir Hugh in his public despatch he
attacked him in private, and the Whig press, with the unquestionable
aid of Keppel’s friends, began a campaign of calumny to which the
ministerial papers answered in the same style, each side accusing
the other of deliberate treason. The result was a scandalous series
of scenes in parliament and of courts martial. Keppel was first tried
and acquitted in 1779, and then Palliser was also tried and
acquitted. Keppel was ordered to strike his flag in March 1779. Until
the fall of Lord North’s ministry he acted as an opposition member of
parliament. When it fell in 1782 be became First Lord, and was
created Viscount Keppel and Baron Elden. His career in office was
not distinguished, and he broke with his old political associates by
resigning as a protest against the Peace of Paris. He finally
discredited himself by joining the Coalition ministry formed by North
and Fox, and with its fall disappeared from public life. He died
unmarried on the 2nd of October 1786. Burke, who regarded him
with great affection, said that he had “something high” in his nature,
and that it was “a wild stock of pride on which the tenderest of all
hearts had grafted the milder virtues.” His popularity disappeared
entirely in his later years. His portrait was six times painted by Sir
Joshua Reynolds. The copy which belonged originally to Burke is
now in the National Gallery.
There is a full Life of Keppel (1842), by his grand-nephew, the
Rev. Thomas Keppel.
(D. H.)
61. KEPPEL, SIR HENRY (1809-1904), British admiral, son of
the 4th earl of Albemarle and of his wife Elizabeth, daughter of Lord
de Clifford, was born on the 14th of June 1809, and entered the
navy from the old naval academy of Portsmouth in 1822. His family
connexions secured him rapid promotion, at a time when the rise of
less fortunate officers was very slow. He became lieutenant in 1829
and commander in 1833. His first command in the “Childers” brig
(16) was largely passed on the coast of Spain, which was then in the
midst of the convulsions of the Carlist war. Captain Keppel had
already made himself known as a good seaman. He was engaged
with the squadron stationed on the west coast of Africa to suppress
the slave trade. In 1837 he was promoted post captain, and
appointed in 1841 to the “Dido” for service in China and against the
Malay pirates, a service which he repeated in 1847, when in
command of H.M.S. “Maeander.” The story of his two commands was
told by himself in two publications, The Expedition to Borneo of
H.M.S. “Dido” for the Suppression of Piracy (1846), and in A Visit to
the Indian Archipelago in H. M. S. “Maeander” (1853). The
substance of these books was afterwards incorporated into his
autobiography, which was published in 1809 under the title A Sailor’s
Life under four Sovereigns. In 1853 he was appointed to the
command of the “St Jean d’Acre” of 101 guns for service in the
Crimean War. But he had no opportunity to distinguish himself at sea
62. in that struggle. As commander of the naval brigade landed to co-
operate in the siege of Sevastopol, he was more fortunate, and he
had an honourable share in the latter days of the siege and
reduction of the fortress. After the Crimean War he was again sent
out to China, this time in command of the “Raleigh,” as commodore
to serve under Sir M. Seymour. The “Raleigh” was lost on an
uncharted rock near Hong-Kong, but three small vessels were
named to act as her tenders, and Commodore Keppel commanded in
them, and with the crew of the “Raleigh,” in the action with the
Chinese at Fatshan Creek (June 1, 1857). He was honourably
acquitted for the loss of the “Raleigh,” and was named to the
command of the “Alligator,” which he held till his promotion to rear-
admiral. For his share in the action at Fatshan Creek he was made
K.C.B. The prevalence of peace gave Sir Henry Keppel no further
chance of active service, but he held successive commands till his
retirement from the active list in 1879, two years after he attained
the rank of Admiral of the Fleet. He died at the age of 95 on the
17th of January 1904.
KER, JOHN (1673-1726), Scottish spy, was born in Ayrshire on
the 8th of August 1673. His true name was Crawfurd, his father
being Alexander Crawfurd of Crawfurdland; but having married
Anna, younger daughter of Robert Ker, of Kersland, Ayrshire, whose
only son Daniel Ker was killed at the battle of Steinkirk in 1692, he
63. assumed the name and arms of Ker in 1697, after buying the family
estates from his wife’s elder sister. Having become a leader among
the extreme Covenanters, he made use of his influence to relieve his
pecuniary embarrassments, selling his support at one time to the
Jacobites, at another to the government, and whenever possible to
both parties at the same time. He held a licence from the
government in 1707 permitting him to associate with those whose
disloyalty was known or suspected, proving that he was at that date
the government’s paid spy; and in his Memoirs Ker asserts that he
had a number of other spies and agents working under his orders in
different parts of the country. He entered into correspondence with
Catholic priests and Jacobite conspirators, whose schemes, so far as
he could make himself cognisant of them, he betrayed to the
government. But he was known to be a man of the worst character,
and it is improbable that he succeeded in gaining the confidence of
people of any importance. The duchess of Gordon was for a time, it
is true, one of his correspondents, but in 1707 she had discovered
him to be “a knave.” He went to London in 1709, where he seems to
have extracted considerable sums of money from politicians of both
parties by promising or threatening, as the case might be, to expose
Godolphin’s relations with the Jacobites. In 1713, if his own story is
to be believed, business of a semi-diplomatic nature took Ker to
Vienna, where, although he failed in the principal object of his
errand, the emperor made him a present of his portrait set in jewels.
Ker also occupied his time in Vienna, he says, by gathering
information which he forwarded to the electress Sophia; and in the
following year on his way home he stopped at Hanover to give some
advice to the future king of England as to the best way to govern the
English. Although in his own opinion Ker materially assisted in
placing George I. on the English throne, his services were
64. unrewarded, owing, he would have us believe, to the incorruptibility
of his character. Similar ingratitude was the recompense for his
revelations of the Jacobite intentions in 1715; and as he was no
more successful in making money out of the East India Company,
nor in certain commercial schemes which engaged his ingenuity
during the next few years, he died in a debtors’ prison, on the 8th of
July 1726. While in the King’s Bench he sold to Edmund Curll the
bookseller, a fellow-prisoner, who was serving a sentence of five
months for publishing obscene books, the manuscript of (or possibly
only the materials on which were based) the Memoirs of John Ker of
Kersland, which Curll published in 1726 in three parts, the last of
which appeared after Ker’s death. For issuing the first part of the
Memoirs, which purported to make disclosures damaging to the
government, but which Curll in self-justification described as
“vindicating the memory of Queen Anne,” the publisher was
sentenced to the pillory at Charing Cross; and he added to the third
part of the Memoirs the indictment on which he had been convicted.
See the above-mentioned Memoirs (London, 1726-1727), and
in particular the “preface” to part i.; George Lockhart, The
Lockhart Papers (2 vols., London, 1817); Nathaniel Hooke,
Correspondence, edited by W. D. Macray (Roxburghe Club, 2
vols., London, 1870), in which Ker is referred to under several
pseudonyms, such as “Wicks,” “Trustie,” “The Cameronian
Mealmonger,” c.
65. KERAK, a town in eastern Palestine, 10 m. E. of the southern
angle of the Lisan promontory of the Dead Sea, on the top of a
rocky hill about 3000 ft. above sea-level. It stands on a platform
forming an irregular triangle with sides about 3000 ft. in length, and
separated by deep ravines from the ranges around on all sides but
one. The population is estimated at 6000 Moslems and 1800
Orthodox Greek Christians. Kerak is identified with the Moabite town
of Kir-Hareseth (destroyed by the Hebrew-Edomite coalition, 2 Kings
iii. 25), and denounced by Isaiah under the name Kir of Moab (xv.
1), Kir-Hareseth (xvi. 7) or Kir-Heres (xvi. 11): Jeremiah also refers
to it by the last name (xxxix. 31, 36). The modern name, in the form
Χάραξ, appears in 2 Macc. xii. 17. Later, Kerak was the seat of the
archbishop of Petra. The Latin kings of Jerusalem, recognizing its
importance as the key of the E. Jordan region, fortified it in 1142;
from 1183 it was attacked desperately by Saladin, to whom at last it
yielded in 1188. The Arabian Ayyubite princes fortified the town, as
did the Egyptian Mameluke sultans. The fortifications were repaired
by Bibars in the 13th century. For a long time after the Turkish
occupation of Palestine and Egypt it enjoyed a semi-independence,
but in 1893 a Turkish governor with a strong garrison was
established there, which has greatly contributed to secure the safety
of travellers and the general quiet of the district. The town is an
irregular congeries of flat mud-roofed houses. In the Christian
66. quarter is the church of St George; the mosque also is a building of
Christian origin. The town is surrounded by a wall with five towers;
entrance now is obtained through breaches in the wall, but formerly
it was accessible only by means of tunnels cut in the rocky
substratum. The castle, now used as the headquarters of the
garrison and closed to visitors, is a remarkably fine example of a
crusaders’ fortress.
(R. A. S. M.)
KERALA, or Chera, the name of one of the three ancient
Dravidian kingdoms of the Tamil country of southern India, the other
two being the Chola and the Pandya. Its original territory comprised
the country now contained in the Malabar district, with Travancore
and Cochin, and later the country included in the Coimbatore district
and a part of Salem. The boundaries, however, naturally varied much
from time to time. The earliest references to this kingdom appear in
the edicts of Asoka, where it is called Keralaputra (i.e. son of Kerala),
a name which in a slightly corrupt form is known to Pliny and the
author of the Periplus. There is evidence of a lively trade carried on
by sea with the Roman empire in the early centuries of the Christian
era, but of the political history of the Kerala kingdom nothing is
known beyond a list of rajas compiled from inscriptions, until in the
10th century the struggle began with the Cholas, by whom it was
conquered and held till their overthrow by the Mahommedans in
1310. These in their turn were driven out by a Hindu confederation
67. headed by the chiefs of Vijayanagar, and Kerala was absorbed in the
Vijayanagar empire until its destruction by the Mahommedans in
1565. For about 80 years it seems to have preserved a precarious
independence under the naiks of Madura, but in 1640 was
conquered by the Adil Shah dynasty of Bijapur and in 1652 seized by
the king of Mysore.
See V. A. Smith, Early Hist. of India, chap. xvi. (2nd ed.,
Oxford, 1908).
KERASUND (anc. Choerades, Pharnacia, Cerasus), a town on
the N. coast of Asia Minor, in the Trebizond vilayet, and the port—an
exposed roadstead—of Kara-Hissar Sharki, with which it is connected
by a carriage road. Pop. just under 10,000, Moslems being in a slight
minority. The town is situated on a rocky promontory, crowned by a
Byzantine fortress, and has a growing trade. It exports filberts (for
which product it is the centre), walnuts, hides and timber. Cerasus
was the place from which the wild cherry was introduced into Italy
by Lucullus and so to Europe (hence Fr. cerise, “cherry”).
68. KÉRATRY, AUGUSTE HILARION, Comte de (1769-1859),
French writer and politician, was born at Rennes on the 28th of
December 1769. Coming to Paris in 1790, he associated himself with
Bernardin de St Pierre. After being twice imprisoned during the
Terror he retired to Brittany, where he devoted himself to literature
till 1814. In 1818 he returned to Paris as deputy for Finistère, and
sat in the Chamber till 1824, becoming one of the recognized liberal
leaders. He was re-elected in 1827, took an active part in the
establishment of the July monarchy, was appointed a councillor of
state (1830), and in 1837 was made a peer of France. After the coup
d’état of 1851 he retired from public life. Among his publications
were Contes et Idylles (1791); Lysus et Cydippe, a poem (1801);
Inductions morales et physiologiques (1817); Documents pour servir
à l’histoire de France (1820); Du Beau dans les arts d’imitation
(1822); Le Dernier des Beaumanoir (1824). His last work, Clarisse
(1854), a novel, was written when he was eighty-five. He died at
Port-Marly on the 7th of November 1859.
His son, comte Emile de Kératry (1832- ), became deputy for
Finistère in 1869, and strongly supported the war with Germany in
1870. He was in Paris during part of the siege, but escaped in a
balloon, and joined Gambetta. In 1871 Thiers appointed him to the
prefecture, first of the Haute-Garonne, and subsequently of the
Bouches-du-Rhône, but he resigned in the following year. He is the
69. author of La Contre-guérilla française au Mexique (1868); L’Élévation
et la chute de l’empereur Maximilien (1867); Le Quatre-septembre et
le gouvernement de la défense nationale (1872); Mourad V. (1878),
and some volumes of memories.
KERBELA, or Meshed-Ḥosain, a town of Asiatic Turkey, the
capital of a sanjak of the Bagdad vilayet, situated on the extreme
western edge of the alluvial river plain, about 60 m. S.S.W. of
Bagdad and 20 m. W. of the Euphrates, from which a canal extends
almost to the town. The surrounding territory is fertile and well
cultivated, especially in fruit gardens and palm-groves. The newer
parts of the city are built with broad streets and sidewalks,
presenting an almost European appearance. The inner town,
surrounded by a dilapidated brick wall, at the gates of which octroi
duties are still levied, is a dirty Oriental city, with the usual narrow
streets. Kerbela owes its existence to the fact that Ḥosain, a son of
‘Ali, the fourth caliph, was slain here by the soldiers of Yazid, the
rival aspirant to the caliphate, on the 10th of October a.d. 680 (see
Caliphate, sec. B, § 2). The most important feature of the town is the
great shrine of Ḥosain, containing the tomb of the martyr, with its
golden dome and triple minarets, two of which are glided. Kerbela is
a place of pilgrimage of the Shi’ite Moslems, and is only less sacred
to them than Meshed ‘Ali and Mecca. Some 200,000 pilgrims from
the Shi’ite portions of Islam are said to journey annually to Kerbela,
70. many of them carrying the bones of their relatives to be buried in its
sacred soil, or bringing their sick and aged to die there in the odour
of sanctity. The mullahs, who fix the burial fees, derive an enormous
revenue from the faithful. Formerly Kerbela was a self-governing
hierarchy and constituted an inviolable sanctuary for criminals; but in
1843 the Turkish government undertook to deprive the city of some
of these liberties and to enforce conscription. The Kerbelese resisted,
and Kerbela was bombarded (hence the ruined condition of the old
walls) and reduced with great slaughter. Since then it has formed an
integral part of the Turkish administration of Irak. The enormous
influx of pilgrims naturally creates a brisk trade in Kerbela and the
towns along the route from Persia to that place and beyond to Nejef.
The population of Kerbela, necessarily fluctuating, is estimated at
something over 60,000, of whom the principal part are Shi’ites,
chiefly Persians, with a goodly mixture of British Indians. No Jews or
Christians are allowed to reside there.
See Chodzko, Théâtre persan (Paris, 1878); J. P. Peters,
Nippur (1897).
(J. P. Pe.)
KERCH, or Kertch, a seaport of S. Russia, in the government of
Taurida, on the Strait of Kerch or Yenikale, 60 m. E.N.E. of
Theodosia, in 45° 21′ N. and 36° 30′ E. Pop. (1897), 31,702. It
stands on the site of the ancient Panticapaeum, and, like most towns
71. built by the ancient Greek colonists in this part of the world,
occupies a beautiful situation, clustering round the foot and climbing
up the sides of the hill (called after Mithradates) on which stood the
ancient citadel or acropolis. The church of St John the Baptist,
founded in 717, is a good example of the early Byzantine style. That
of Alexander Nevsky was formerly the Kerch museum of antiquities,
founded in 1825. The more valuable objects were subsequently
removed to the Hermitage at St Petersburg, while those that
remained at Kerch were scattered during the English occupation in
the Crimean War. The existing museum is a small collection in a
private house. Among the products of local industry are leather,
tobacco, cement, beer, aerated waters, lime, candles and soap.
Fishing is carried on, and there are steam saw-mills and flour-mills.
A rich deposit of iron ore was discovered close to Kerch in 1895, and
since then mining and blasting have been actively prosecuted. The
mineral mud-baths, one of which is in the town itself and the other
beside Lake Chokrak (9 m. distant), are much frequented.
Notwithstanding the deepening of the strait, so that ships are now
able to enter the Sea of Azov, Kerch retains its importance for the
export trade in wheat, brought thither by coasting vessels. Grain,
fish, linseed, rapeseed, wool and hides are also exported. About 6
m. N.E. are the town and old Turkish fortress of Yenikale,
administratively united with Kerch. Two and a half miles to the south
are strong fortified works defending the entrance to the Sea of Azov.
The Greek colony of Panticapaeum was founded about the middle
of the 6th century b.c., by the town of Miletus. From about 438 b.c.
till the conquest of this region by Mithradates the Great, king of
Pontus, about 100 b.c., the town and territory formed the kingdom
of the Bosporus, ruled over by an independent dynasty. Phanaces,
the son of Mithradates, became the founder of a new line under the
72. protection of the Romans, which continued to exist till the middle of
the 4th century a.d., and extended its power over the maritime parts
of Tauris. After that the town—which had already begun to be
known as Bospora—passed successively into the hands of the
Eastern empire, of the Khazars, and of various barbarian tribes. In
1318, the Tatars, who had come into possession in the previous
century, ceded the town to the Genoese, who soon raised it into new
importance as a commercial centre. They usually called the place
Cerchio, a corruption of the Russian name K’rtchev (whence Kerch),
which appears in the 11th century inscription of Tmutarakan (a
Russian principality at the north foot of the Caucasus). Under the
Turks, whose rule dates from the end of the 15th century, Kerch was
a military port; and as such it plays a part in the Russo-Turkish wars.
Captured by the Russians under Dolgorukov in 1771, it was ceded to
them along with Yenikale by the peace of Kuchuk-Kainarji, and it
became a centre of Russian naval activity. Its importance was greatly
impaired by the rise of Odessa and Taganrog; and in 1820 the
fortress was dismantled. Kerch suffered severely during the Crimean
War.
Archaeologically Kerch is of particular interest, the kurgans or
sepulchral mounds of the town and vicinity having yielded a rich
variety of the most beautiful works of art. Since 1825 a large
number of tombs have been opened. In the Altun or Zolotai-oba
(Golden Mound) was found a great stone vault similar in style to
an Egyptian pyramid; and within, among many objects of minor
note, were golden dishes adorned with griffins and beautiful
arabesques. In the Kul-oba, or Mound of Cinders (opened in
1830-1831), was a similar tomb, in which were found what
would appear to be the remains of one of the kings of Bosporus,
of his queen, his horse and his groom. The ornaments and
73. furniture were of the most costly kind; the king’s bow and
buckler were of gold; his very whip intertwined with gold; the
queen had golden diadems, necklace and breast-jewels, and at
her feet lay a golden vase. In the Pavlovskoi kurgan (opened in
1858) was the tomb of a Greek lady, containing among other
articles of dress and decoration a pair of fine leather boots (a
unique discovery) and a beautiful vase on which is painted the
return of Persephone from Hades and the setting out of
Triptolemus for Attica. In a neighbouring tomb was what is
believed to be “the oldest Greek mural painting which has come
down to us,” dating probably from the 4th century b.c. Among
the minor objects discovered in the kurgans perhaps the most
noteworthy are the fragments of engraved boxwood, the only
examples known of the art taught by the Sicyonian painter
Pamphilus.
Very important finds of old Greek art continue to be made in
the neighbourhood, as well as at Tamañ, on the east side of the
Strait of Kerch. The catacombs on the northern slope of
Mithradates Hill, of which nearly 200 have been explored since
1859, possess considerable interest, not only for the relics of old
Greek art which some of them contain (although most were
plundered in earlier times), but especially as material for the
history and ethnography of the Cimmerian Bosporus. In 1890
the first Christian catacomb bearing a distinct date (491) was
discovered. Its walls were covered with Greek inscriptions and
crosses.
See H. D. Seymour’s Russia on the Black Sea and Sea of Azoff
(London, 1855); J. B. Telfer, The Crimea (London, 1876); P.
Bruhn, Tchernomore, 1852-1877 (Odessa, 1878); Gilles,
74. Antiquités du Bosphore Cimmérien (1854); D. Macpherson,
Antiquities of Kertch (London, 1857); Compte rendu de la
Commission Imp. Archéologique (St Petersburg); L. Stephani,
Die Alterthümer vom Kertsch (St Petersburg, 1880); C. T.
Newton, Essays on Art and Archaeology (London, 1880);
Reports of the [Russian] Imp. Archaeological Commission;
Izvestia (Bulletin) of the Archives Commission for Taurida;
Antiquités du Bosphore Cimmérien, conservées au Musée
Impérial de l’Ermitage (St Petersburg, 1854); Inscriptiones
antiquae orae septentrionalis Ponti Euxini graecae et latinae,
with a preface by V. V. Latyshev (St Petersburg, 1890); Materials
for the Archaeology of Russia, published by the Imp. Arch.
Commission (No. 6, St Petersburg, 1891). (P. A. K.; J. T. Be.)
KERCKHOVEN, JAN POLYANDER VAN DEN (1568-
1646), Dutch Protestant divine, was born at Metz, in 1568. He
became French preacher at Dort in 1591, and afterwards succeeded
Franz Gomarus as professor of theology at Leiden. He was invited by
the States General of Holland to revise the Dutch translation of the
Bible, and it was he who edited the canons of the synod of Dort
(1618-1619).
His many published works include Responsio ad sophismata A.
Cocheletii doctoris surbonnistae (1610), Dispute contre
75. l’adoration des reliques des Saincts trespassés (1611), Explicatio
somae prophetae (1625).
KERGUELEN ISLAND, Kerguelen’s Land, or Desolation Island,
an island in the Southern Ocean, to the S.E. of the Cape of Good
Hope, and S.W. of Australia, and nearly half-way between them.
Kerguelen lies between 48° 39′ and 49° 44′ S. and 68° 42′ and 70°
35′ E. Its extreme length is about 85 m., but the area is only about
1400 sq. m. The island is throughout mountainous, presenting from
the sea in some directions the appearance of a series of jagged
peaks. The various ridges and mountain masses are separated by
steep-sided valleys, which run down to the sea, forming deep fjords,
so that no part of the interior is more than 12 m. from the sea. The
chief summits are Mounts Ross (6120 ft.), Richards (4000), Crozier
(3251), Wyville Thomson (3160), Hooker (2600), Moseley (2400).
The coast-line is extremely irregular, and the fjords, at least on the
north, east and south, form a series of well-sheltered harbours. As
the prevailing winds are westerly, the safest anchorage is on the
north-east. Christmas Harbour on the north and Royal Sound on the
south are noble harbours, the latter with a labyrinth of islets
interspersed over upwards of 20 m. of land-locked waters. The
scenery is generally magnificent. A district of considerable extent in
the centre of the island is occupied by snowfields, whence glaciers
descend east and west to the sea. The whole island, exclusive of the
76. snowfields, abounds in freshwater lakes and pools in the hills and
lower ground. Hidden deep mudholes are frequent.
Kerguelen Island is of undoubted volcanic origin, the
prevailing rock being basaltic lavas, intersected occasionally by
dikes, and an active volcano and hot springs are said to exist in
the south-west of the island. Judging from the abundant fossil
remains of trees, the island must have been thickly clothed with
woods and other vegetation of which it has no doubt been
denuded by volcanic action and submergence, and possibly by
changes of climate. It presents evidences of having been
subjected to powerful glaciation, and to subsequent immersion
and immense denudation. The soundings made by the
“Challenger” and “Gazelle” and the affinities which in certain
respects exist between the islands, seem to point to the
existence at one time of an extensive land area in this quarter,
of which Kerguelen, Prince Edward’s Islands, the Crozets, St Paul
and Amsterdam are the remains. The Kerguelen plateau rises in
many parts to within 1500 fathoms of the surface of the sea.
Beds of coal and of red earth are found in some places. The
summits of the flat-topped hills about Betsy Cove, in the south-
east of the island, are formed of caps of basalt.
According to Sir J. D. Hooker the vegetation of Kerguelen
Island is of great antiquity; and may have originally reached it
from the American continent; it has no affinities with Africa. The
present climate is not favourable to permanent vegetation; the
island lies within the belt of rain at all seasons of the year, and is
reached by no drying winds; its temperature is kept down by the
surrounding vast expanse of sea, and it lies within the line of the
cold Antarctic drift. The temperature, however, is equable. The
77. mean annual temperature is about 39° F., while the summer
temperature has been observed to approach 70°. Tempests and
squalls are frequent, and the weather is rarely calm. On the
lower slopes of the mountains a rank vegetation exists, which,
from the conditions mentioned, is constantly saturated with
moisture. A rank grass, Festuca Cookii, grows thickly in places
up to 300 ft., with Azorella, Cotula plumosa, c. Sir J. D. Hooker
enumerated twenty-one species of flowering plants, and seven
of ferns, lycopods, and Characeae; at least seventy-four species
of mosses, twenty-five of Hepaticae, and sixty-one of lichens are
known, and there are probably many more. Several of the
marine and many species of freshwater algae are peculiar to the
island. The characteristic feature of the vegetation, the
Kerguelen’s Land cabbage, was formerly abundant, but has been
greatly reduced by rabbits introduced on to the island. Fur-seals
are still found in Kerguelen, though their numbers have been
reduced by reckless slaughter. The sea-elephant and sea-leopard
are characteristic. Penguins of various kinds are abundant; a teal
(Querquedula Eatoni) peculiar to Kerguelen and the Crozets is
also found in considerable numbers, and petrels, especially the
giant petrel (Ossifraga gigantea), skuas, gulls, sheath-bills
(Chionis minor), albatross, terns, cormorants and Cape pigeons
frequent the island. There is a considerable variety of insects,
many of them with remarkable peculiarities of structure, and
with a predominance of forms incapable of flying.
The island was discovered by the French navigator, Yves Joseph
de Kerguelen-Trémarec, a Breton noble (1745-1797), on the 13th of
February 1772, and partly surveyed by him in the following year. He
was one of those explorers who had been attracted by the belief in a
rich southern land, and this island, the South France of his first
78. discovery, was afterwards called by him Desolation Land in his
disappointment. Captain Cook visited the island in 1776, and, among
other expeditions, the “Challenger” spent some time here, and its
staff visited and surveyed various parts of it in January 1874. It was
occupied from October 1874 to February 1875 by the expeditions
sent from England, Germany and the United States to observe the
transit of Venus. The German South Polar expedition in 1901-1902
established a meteorological and magnetic station at Royal Sound,
under Dr Enzensperger, who died there. In January 1893 Kerguelen
was annexed by France, and its commercial exploitation was
assigned to a private company.
See Y. J. de Kerguelen-Trémarec, Relation de deux voyages
dans les mers australes (Paris, 1782); Narratives of the Voyages
of Captain Cook and the “Challenger” Expedition; Phil. Trans.,
vol. 168, containing account of the collections made in
Kerguelen by the British transit of Venus expedition in 1874-
1875; Lieutard, “Mission aux îles Kerguelen,” c., Annales
hydrographiques (Paris, 1893).
KERGUELEN’S LAND CABBAGE, in botany, Pringlea
antiscorbutica (natural order Cruciferae), a plant resembling in habit,
and belonging to the same family as, the common cabbage (Brassica
oleracea). The cabbage-like heads of leaves abound in a pale yellow
79. highly pungent essential oil, which gives the plant a peculiar flavour
but renders it extremely wholesome. It was discovered by Captain
Cook during his first voyage, but the first account of it was published
by (Sir) Joseph Hooker in The Botany of the Antarctic Voyage of the
“Erebus” and “Terror” in 1839-1843. During the stay of the latter
expedition on the island, daily use was made of this vegetable either
cooked by itself or boiled with the ship’s beef, pork or pea-soup.
Hooker observes of it, “This is perhaps the most interesting plant
procured during the whole of the voyage performed in the Antarctic
Sea, growing as it does upon an island the remotest of any from a
continent, and yielding, besides this esculent, only seventeen other
flowering plants.”
KERKUK, or Qerqūq, the chief town of a sanjak in the Mosul
vilayet of Asiatic Turkey, situated among the foot hills of the
Kurdistan Mountains at an elevation of about 1100 ft. on both banks
of the Khassa Chai, a tributary of the Tigris, known in its lower
course as Adhem. Pop. estimated at 12,000 to 15,000, chiefly
Mahommedan Kurds. Owing to its position at the junction of several
routes, Kerkuk has a brisk transit trade in hides, Persian silks and
cottons, colouring materials, fruit and timber; but it owes its
principal importance to its petroleum and naphtha springs. There are
also natural warm springs at Kerkuk, used to supply baths and
reputed to have valuable medical properties. In the neighbourhood
80. Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com