PAPER CODE NO.
MATH 371
EXAMINER: Dr H. Assa TEL.NO. 44367
DEPARTMENT: Mathematical Sciences
MAY 2019 EXAMINATIONS
Numerical Analysis for Financial Mathematics
Time allowed: Two and a half hours
INSTRUCTIONS TO CANDIDATES: Full marks will be awarded
but only the best four will be taken into account.
Paper Code MATH 371 Page 1 of 7 CONTINUED
1. (a) (i) Consider a function f : [a, b] → [0,∞). Using polynomial interpo-
lation and Lagrange polynomials, derive the trapezoidal rule.
[5 marks]
(ii) Now, for a partition of n+ 1 equally spaced points
a = x0 < x1 < · · · < xn−1 < xn = b,
derive the formula for the composite trapezoidal rule.
[5 marks]
(iii) Consider the function f : [0, 1]→ [0,∞), f(x) = x2. Find the exact
value of the integral ∫ 1
0
f(x) dx
and a general formula for the approximate integral using the com-
posite trapezoidal rule. Also find the limit of the approximate in-
tegral as n→∞.
[10 marks]
(b) Read the program below. Briefly explain the purpose of the program,
and answer the questions within the program.
[5 marks]
[email protected](x) (1/(1+x) - exp(x)+1);
a=0;
b=0.6;
delta=10^(-7);
%%%%% What is the purpose of delta?
while(abs(f(a))>delta)
%%%%% What is the purpose of the line above?
c=(a+b)/2;
%%%%% What is the purpose of the line above?
if f(a)*f(c)<0
%%%%% What is the purpose of the line above?
b=c;
else
a=c;
end
end
Paper Code MATH 371 Page 2 of 7 CONTINUED
2. For fixed a, α, β ∈ R, consider the following system of linear equation
ax1 + αx4 = β,
ax2 = 0,
ax3 = 0,
αx1 + ax4 = β.
(1)
(i) Write this system of equations in matrix form
A~xT = ~b,
determining A, ~xT and ~b.
[5 marks]
(ii) Decompose A into lower triangular, upper triangular and diagonal ma-
trices L,U and D, respectively.
[5 marks]
(iii) The Jacobi method leads to a function that has a fixed point at the
exact solution to the system (1). Derive this function.
[5 marks]
(iv) Denoting the sequence produced by the Jacobi method by
{~x = (xk1, xk2, xk3, xk4)}k=0,1,2,...,
write ~xk+1 in terms of ~xk.
[5 marks]
(v) Using part (iv) above, show that
xk+11 =
βa− αβ + α2xk−11
a2
,
xk+14 =
βa− αβ + α2xk−14
a2
.
Using these relations and part (iv), deduce the solution to the linear
sustem (1).
[5 marks]
Paper Code MATH 371 Page 3 of 7 CONTINUED
3. Assume a true continuous model St for a stock price is
ln
(
St+δt
St
)
∼ N
((
r − σ
2
2
)
δt, σ2δt
)
.
Consider a binomial model defined by
St+δt =
{
Ste
p
Ste
− 1− p .
(i) Matching the first and second moments of the log price Xt = log(St),
find formulas p and .
[15 marks]
(ii) Given δt = 1,
dXt = Xt+δt −Xt =
{
0.3 p
−0.3 1− p ,
with r = 0.045 and σ = 0.3, evaluate p and .
[10 marks]
Paper Code MATH 371 Page 4 of 7 CONTINUED
4. Assume X is a non-negative random variable whose probability density func-
tion (PDF) is given by
g(x) =
L
x2
1 + x6
, if x ≥ 0,
0, otherwise
,
where
L =
1∫ ∞
0
x2
1 + x6
dx
.
(i) Denoting the cumulative density function (CDF) of X by GX and its
inverse by G−1X , find G
−1
X . Then explain how one can generate a random
sample with CDF equal to Gx, given a U(0, 1) sample u1, . . . , un.
[7 marks]
0
1
1 + x2
dx =
pi
2
.
(ii) Assume there is another PDF defined by
f(x) =
ax2
x6 +

1 + x2
, x ≥ 0.
Let
c = min{b > 0 | ∀x ≥ 0, f(x)/g(x) < b}.
Show that c = a/L.
[7 marks]
(iii) Assuming it is possible to generate independent U(0, 1) samples, use
the acceptance-rejection method for f(x)/(cg(x)) to design an algorithm
which generates random samples with PDF f(x).
[7 marks]
(iv) Now consider the following cases: we generate two independent U(0, 1)
samples with
u1 = 1/3, u2 = 5/12, u3 = 1/2, u4 = 7/12, u5 = 2/3,
and
v1 = v3 = v5 = 0, v2 = v4 = 1.
Generate a random sample with PDF g(x) and a random sample with
PDF f(x).
[4 marks]
Paper Code MATH 371 Page 5 of 7 CONTINUED
5. (a) In what followsX denotes a random variable whose expectation is known
and Y denotes a random variable whose expectation is to be estimated
using Monte Carlo methods. Let
Y (b) := Y − b(X − E(X))
be the control variate estimator with parameter b, and
σb := Var(Y (b))
1/2, σY := Var(Y )
1/2, σX := Var(X)
1/2, ρXY :=
Cov(X, Y )
σXσY
.
Show that E(Y (b)) = E(Y ) and then prove there exists b∗ such that
σ2b∗ = σ
2
Y (1− ρ2XY ).
[15 marks]
(b) Consider the Black-Scholes framework:
dSu = rSudu+ σSudWu, St = S.
Here, (Wu)u∈[t,T ] is a Wiener process in the risk neutral measure. Ex-
plain, in detail, how e−r(T−t)ST can be used as a control variate to im-
prove the Monte Carlo estimate for the price of a European call option.
[10 marks]
Paper Code MATH 371 Page 6 of 7 CONTINUED
6. Assume the return of a stock is denoted by r and its dynamics is given by
dXt = µ(t,Xt) ds+ σ(t,Xt) dWt, 0 ≤ t ≤ T, X0 ∈ R,
where µ(t, x) and σ(t, x) > 0 are real functions and (Ws)s≥0 is a Brownian
motion. Fix a natural number N and define ti = (i/N)t, i = 0, . . . , N .
(a) Find the discretization of Xt and use it to find an ordinary differential
equation (ODE) for xt = E(Xt). Then show that
x′ = E(µ(t,Xt)), x0 = X0.
[10 marks]
(b) Now, consider the following stochastic differential equation (SDE)
dXt = (1−Xt) dt+

Xt dWt, X0 > 0.
(i) Assuming that Xt > 0, use the Itoˆ calculus to find an SDE that is
satisfied by St = 1/Xt.
[7 marks]
(ii) Find an ODE that is satisfied by z¯t = E(St) by discretization.
[8 marks]
Paper Code MATH 371 Page 7 of 7 END
PAPER CODE NO.
MATH 371
EXAMINER: Dr Assa, TEL.NO. 44367
DEPARTMENT: Mathematical Sciences
JUNE 2019 FINAL EXAMINATION
NUMERICAL ANALYSIS FOR FINANCIAL
MATHEMATICS
Time allowed: Two and a half hours
INSTRUCTIONS TO CANDIDATES: Full marks will be awarded for complete
answers to four questions. All answers will be assessed but only the best four will be taken into account.
Paper Code MATH 371 Page 1 of 7 CONTINUED
1. a) Let us say we want to approximate the integral of f(x) = sin (pix) on
[0, 1].
i) Find the Cubic spline, for x0 = 0, x1 = 0.5, x2 = 1.
Hint: for cubic spline you may use the following form
Sk(x) =
mk
6hk
(xk+1 − x)3 + mk+1
6hk
(x− xk)3 + pk(xk+1 − x) + qk(x− xk).
[10 marks]
ii) Find the integral using cubic spline over [0, 1]. [5 marks]
iii) Find the integral by using composite trapezoidal rule over [0, 1]. [5 marks]
b) The following program is using the Newton method to find the root of f(x) =
x2 − 1
4
at the accuracy rate 0.0000001, and finally display it. There are some
missing parts that you need to fill in the suggested places, and an error that you
need to find. [5 marks]
[email protected]( x ) ( xˆ2−1/4);
f [email protected]( x)%%%%Suggested p lace 1
a =.6 ;
%%%%Suggested p lace 2
%%%%In the f o l l o w i n g f i n d an e r r o r
whi l e ( abs ( f ( a))< de l t a )
a = a − f ( a )/ %%%%Suggested p lace 3
end
%%%%Suggested p lace 4
Paper Code MATH 371 Page 2 of 7 CONTINUED
2. a) Let us assume that we want to minimize a function f : R2 → R by using
the Nelder-Mead method. Let us assume that we start from an initial simplex
B,G,W ∈ R2 where f (B) ≤ f (G) ≤ f (W ). Let us name the mid-point between
B and G by M . Now let us assume that we want to present the first iteration
of the Nelder-Mead method. Name the four operators which are used in this
method in the order that they must be checked. Explain them by drawing the
updated simplexes. [12 marks]
b) Consider we want to find the minimum of f(x, y) = exp (x2 + y2), start-
ing from an initial simplex (0, 1), (1, 0), (0, 0). Using the Nelder-Mead method,
present the first iteration in full details and update the simplex. If one continues
to iterate the Nelder-Mead method, which point do you expect always to belong
to the updated simplex, and why?
[13 marks]
Paper Code MATH 371 Page 3 of 7 CONTINUED
3. Let us assume a true continuous model St for a stock price is ln
(
St+δt
St
)

N
((
r − σ2
2
)
δt, σ2δt
)
. Let’s assume, S0 = K = 1, r = 0.005, σ = 0.1, δt = 1 and
T = 2.
a) Using a binomial model by matching the first and the second moment, find
the price of an American put option for expiration T . Draw the trees and every
number needed to be assigned. [10 marks]
b) Using a trinomial model by matching the first and the second moment, find
the price of an American put option for expiration T . Draw the trees and every
number needed to be assigned. [15 marks]
Paper Code MATH 371 Page 4 of 7 CONTINUED
4. a) Show that if the CDF of a random variable X, denoted by FX , is strictly
increasing then F−1X (U) for a uniform(0,1) random variable U has the same dis-
tribution as X. [4 marks]
b) Consider the following CDF on [1,∞),
FX(x) =
{
x−1
x
if x ≥ 1
0 if x < 1
.
We have generated a uniform(0,1) sample: u1 =
1
4
, u2 =
1
2
and u1 =
3
4
. Using the
inversion method find a sample for X. [10 marks]
c) Let us consider another random variable Y with the following PDF
fY (x) =
{
d√
x+x2
x ≥ 1
0 x < 1
,
where d = 1∫∞
1
1√
x+x2
dx. Find the smallest c so that fY
fX
≤ c on [1,∞). If we
generate another uniform(0,1) sample v1 = 0, v2 = 1 and v1 = 1, independent
from u1, u2, u3, using c in the acceptance-rejection method can you generate a
sample for Y ? [11 marks]
Paper Code MATH 371 Page 5 of 7 CONTINUED
5.
a) We will use Y to denote the random variable whose expectation is to esti-
mate by using Monte Carlo methods. Let us consider we have a sample Y1, ..., Yn
and then introduce a new sample Yi(b) := (Yi − b(Xi − µ)), for another sample
Xi with mean µ. Show that the sample average of this new sample Yi(b) is equal
to E (Y ). [7 marks]
b) Find the variance of the sample average of Yi(b) as a function of b and find its
minimum. [8 marks]
c) Discuss an example where this method can be readily used for option pric-
ing. Please give details. [10 marks]
Paper Code MATH 371 Page 6 of 7 CONTINUED
6. Let us assume y is a function of x and consider the following ODE{
x2y + 1
2
y′ = 0 x ≥ 0
y(0) = 1
.
Let f (x) =
∫ x
0
y (s) ds. Now introduce St = f(Xt) where Xt dynamic is given as
follows
dXt = X
2
t dt+ dWt.
a) Find the SDE for St. [10 marks]
b) Find the analytical solution to the ODE above. Use the SDE for Xt and
the ODE above to give a discretization of St. [10 marks]
c) Find V ar (ST ) (Hint: you can use the fact that V ar
(∫ T
0
σ(s, Ss)dWs
)
=∫ T
0
E (σ2(s, Ss)) ds). [5 marks]
Paper Code MATH 371 Page 7 of 7 END  Email:51zuoyejun

@gmail.com