This is a Computational Finance project comprising THREE (3) questions, to be completed using Python.
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
This is a Computational Finance ProjeCt comprising THREE (3) questions, to be completed using Python.
Tasks
1. Outline: Compare the Euler-Maruyama scheme, Milstein scheme and closed form solution for a Geometric Brownian motion. As an initial example you may use the following set of sample data
Todayís stock price S0 = 100
Time T = 1 year
volatility 7 = 20%
constant risk-free interest rate r = 5%
You may Önd it useful to use seed() in the random number generation. Comment on your results.
Hence use the expected value of the discounted payo§ under the risk-neutral density Q V (S;t) = e-r(T -t)BQ [fayo/] ;
for the appropriate form of payo§, to consider Asian call and put options. As a guide, include Öxed and áoating strike; discrete and continuous sampling; arithmetic and geometric averaging. Consider using the above data with,
Strike E = 100
Time to expiry (T| t) = 1 year
Then vary the data to see the a§ect on the option price. Note: There is no additional credit for calculating the greeks.
2. Outline: The model problem is
+ P (x) + Q(x)y = f (x) ;
(1)
subject to the boundary conditions y (a) = a; and y (b) = g:
Suppose a = x0 < x1 < x2 < ... < xn-1 < xn = b represents a regular partition of the interval
[a;b] : This means xi = a + ih; where i = 0; 1; 2;:::;n and ox = b n(|) a : The points
x1 = a + ox; x2 = a + 2ox;:::;xn-1 = a + (n | 1) ox
are called interior mesh points of the interval [a;b] : We can approximate the derivative terms using a Taylor series expansion. Let
yi = y (xi ) ; Pi = P (xi ) ; Qi = Q(xi ); fi = f (xi )
Using numerical approximations for each derivative term in (1) show that this can be expressed as
╱ 1 + Pi 、yi+1 +╱|2 + ox2 Qi、yi + ╱ 1 | Pi 、yi-1 = ox f2i ; i = 1;:::;n | 1: (2)
We know the boundary conditions are
yn = y (xn ) = y (b) = g: (4)
Show that (2) ; (3) and (4) can be expressed as a matrix inversion problem A! = b; and give the forms of A; ! and b for an arbitrary value n:
Use the method you have developed above; and n = 10, to solve the following di§erential equation problem
d2y dy
dx2 dx
The coe¢ cients in (2) must be generated inside your computer program using appropriate control structures. Use any Python linear systems function to solve the resulting linear system and output your results in two columns (xi ; yi) : Repeat the exercise for n = 50; 100: What do you notice? Plot a graph for varying n.
3. This question is on M。nte Cαrl。integration. Calculate the following
3
i. x2 dx 1
o
ii. exp(|x2 ) dx
1 o
iii. x4 exp(|x2 =2) dx
Compare your computed solutions to the exact values and show graphically how the error in each case behaves as the random numbers increase.
Your completed assignment should centre on a report to include, for each question:
; Brief outline of the problem and numerical procedure used
; Results - appropriate tables and comparisons.
; Any interesting observations and problems encountered.
; Conclusion and references
For a Python Jupyter Notebook, a detailed notebook will become the complete report (write- up, code, results).
Score key
2023-04-17