# MTHM002Help With ,Help With Java/Python Programming

Methods for Stochastics and Finance MTHM002 Term 1
Coursework 2
Key:
Please attempt all questions and hand them in by 12pm MIDDAY Friday 16th De-
cember 2022 via BART.
LATE WORK will be given a mark of 0% (ZERO) unless you submit a case for mitigation
Harrison Hub if you need advice.
This is an individual coursework and your attention is drawn to the Faculty and
University guidelines on collaboration and plagiarism, which are available from the Fac-
ulty website. This means, you must do this assignment yourself, alone, without
discussing it with any other persons, as if in an invigilated exam. Suspected cases of
academic misconduct will be dealt with according to University regulations.
This is an “open book” assessment. You may use this module’s lecture notes and problem
sheets as a guide to appropriate methods. You also may use other resources, such as
methods described in textbooks or in the internet, and software to assist your computa-
tions, however in that case the onus is on you to demonstrate full understanding
of what you are doing. If you used a method adopted from an outside source, please
identify that source in your submission. If you used software to assist your calculations,
please state that in your submission and provide details of how you did it, e.g. by at-
taching a listing of the relevant computer code. Results presented without appropriate
references and explanations may be interpreted as guesswork and then earn no credit, or
as evidence of plagiarism or collusion and then incur disciplinary action.
Question 1. Suppose the function u(x, t) satisfies the partial differential equation
in the domain x ∈ R, t ∈ [0, 1]. Let u(x, 0) = f(x) and u(x, 1) = g(x), and assume that both
functions f(x) and g(x) quickly decay as x→ ±∞.
(i) Use the Fourier transform method for solving the PDE, to show that the two functions
are related by convolution,
g(x) =
∞∫

f(s)K(x s) ds
where you need to identify the convolution kernel K(·).
(ii) Determine whether it is possible to relate the two functions in the opposite direction,
that is,
f(x) =
∞∫

g(s)L(x? s) dx
for some function L(·). That is, either find L(·) or show why it is not possible. [25]
1
November 23, 2022
Question 2. Let Z be a normally distributed random variable with mean μ and variance σ2.
Consider the random variable X = eZ .
(i) Using the definition of the probability density function (PDF), find the PDF f(x) for X.
(ii) Using the PDF found in part (i) and the definition of expectation, find the moments
E(Xn), n ∈ N. In particular, find the mean E(X) and the variance Var(X).
(iii) Using the definition of a moment generating function (MGF), find the MGF MX(s) of
X, and state where it is defined. The result will have the form of an improper integral
which cannot be evaluated in a closed form, but you are expected to simplify it as much
as you can.
(iv) Suppose that MX(s) is analytic at s = 0, i.e. equal to the sum of its Taylor series, and
find this function using the results of part (ii). Compare the answer with the result you
obtained in part (iii).
[25]
Question 3. Two brothers, Nick and Dan, are enthusiastic gamblers with a taste for mathe-
matics. One day, they walk into a casino where tickets for an unusual lottery are sold. The
lottery has the following rules. A fair coin is tossed, and in the event of heads, the lottery stops
and the holder of the ticket gets the prize of ￡1. Otherwise, the coin is tossed again, and in the
event of heads, the lottery stops and the holder gets ￡2. Otherwise the coin is tossed again,
and in the event of heads, the holder gets ￡4, and so on, with the sum of the prize doubling
after each toss, and the lottery stopping on the first heads.
(i) In order to decide upon the reasonable price PN worth paying for the ticket, Nick enthu-
siastically calculates the expectation of the prize in this lottery. Assuming he does his
calculations right, what result will he get?
(ii) Nick is perplexed by the result of his calculations, and asks for Dan’s opinion. Dan
thinks it is wrong to estimate the ticket’s value by the mathematical expectation of the
prize, particularly when very high prizes are possible. He says that, for instance, a man
with a capital of ￡1bn is not necessarily 1000 times happier than a man with a capital
￡1m, as it is physically not possible to be that happy. So, argues Dan, the price of the
ticket should be obtained not from the mathematical expectation of the prize, but from
the mathematical expectation of the ‘happiness’, which is some monotonically increasing
function of the prize, h(w). Give an expression for the fair price PD of the ticket according
to Dan’s criterion. In particular, calculate the price of the ticket, rounded to the nearest
penny, if h(w) =

w.
(iii) Generalise these results for the case when the coin is not fair and the probability of heads
is p ∈ (0, 1), the prize increases after each toss by a factor of q ∈ (1,∞), and h(w) = wα,
α ∈ (0, 1). Determine the condition on p, q and α that the fair price Pg of the ticket is
finite.
[25]
2
November 23, 2022
Question 4. A phone customer service system supports a queue which may hold from 0 up
to N customers waiting to be served. The service provided may take an integer number of
minutes, and the system checks the state of the queue every minute. The length of the queue,
X(t), is an integer-valued function depending on the discrete time t. An analyst hired by the
company develops a probabilistic model of the queue. The model is in the form of a Markov
chain, with the following rules: every minute the length of the queue may increase by 1 with
probability p ∈ [0, 1], or decrease by 1 with probability q ∈ [0, 1], or otherwise stays unchanged,
with probability r = 1 ? p ? q ∈ [0, 1]. The exceptions are: when the queue is empty, X = 0,
then its length cannot decrease, and when it is at the maximal length, X = N , then its length
cannot increase.
(i) Sketch a diagram of this chain for N = 3. Write down the corresponding transition
matrix. Classify this chain:
Is this chain irreducible, and if not, what are the subchains?
Does this chain have any absorbing states and if yes, what are those?
Are any states in the chain periodic, and if yes, what are their least periods?
(ii) Still for N = 3, find the steady-state probability vector (P (j), j = 0, . . . N) for this chain
(present your answer for each component of the vector as an irreducible rational function
of p and q).
(iii) Generalise the result of (ii) for arbitrary N > 1.