MTH116 Foundations of Financial Computing
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
MTH116
2st SEMESTER 2022/23 ASSIGNMENT 2
BACHELOR DEGREE – Year 2
Foundations of Financial Computing
INSTRUCTIONS
1. Total marks available are 100. There are in total 4 projects with 13 online test questions in this exam. You must attempt all these projects and their corresponding online test questions. Your marks are to be obtained by answering the online test questions only. However, you are required to submit the code you have developed for verification purpose via the submission link given on the LMO. You are allowed to submit up to 4 different M files containing MATLAB code only (no results or outputs of variables.)
2. The assignment is an ‘open-book’ assessment. All the learning materials on the LMO can be referenced during the exam including lecture notes, tutorial questions and solutions, lecture videos etc. However, you must complete the exam independently.
3. You need to use the software package MATLAB to do the questions through the exam.
Attempt all projects
Project 1 |
Students in a science class conduct an experiment where they suspend different weights (in grams) from an elastic band and then measure (in mm) the length of the band for each weight. Below are the experiment results. |
|
|||||||||
Mass in grams (x) |
50 |
100 |
150 |
200 |
250 |
300 |
350 |
400 |
|
||
Length of band in mm (y) |
37 |
48 |
60 |
71 |
80 |
90 |
102 |
109 |
|||
(1) Use the polyfit function to fit a linear regression model to the data set and plot the data along with the regression line. Label x and y axis. Write a title and use legend to show the data and regression line
(2) Calculate the coefficients of determination (R-squared) for the linear regression model.
(3) Plot the residuals of the linear regression model against the independent variable x. Label x and y axis. Write a title.
(4) Calculate the predicted value of y when x = 375 using the linear regression model obtained in part (a).
After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 1-3). |
Project 2 |
Solve the following differential equation using symbolic and numeric methods: y'' + 2y' + y = 2sin(x), y(0) = 0, y'(0) = 1 (1) Use dsolve to obtain the symbolic solution for y(x).
(2) Use ode45 to obtain the numeric solution for y(x) from x=0 to x=π .
(3) Plot the symbolic and numeric solutions on the same graph.
After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 4-6). |
|
Project 3 |
(1) Generate 10000 random numbers from a normal distribution with mean 5 and standard deviation 2.
(2) Use the erf function to estimate how many numbers from part (a) is greater than 7.5.
(3) Given the following data points, use linear interpolation to estimate the inflation rate at year 3. |
|||||
x (years) |
1 |
2 |
4 |
5 |
|
|
Y (inflation rate) |
2% |
3.5% |
6% |
8% |
||
(4)
x = [1, 2, 3];
y = [4, 5, 6];
z = [7, 9, 8; 10, 12, 11; 13, 14, 15];
Given the following data points, use two-dimensional interpolation to estimate the value of z at x=2.5 and y=4.5:
After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 7-10). |
Project 4 |
A numerical method for an initial value problem = fሺt, yሻ, fሺt0 ሻ = y0 is given by yn+1 = yn + ሺk1 + 2k2 + 2k3 + k4 ሻℎ
tn+1 = tn + ℎ k1 = fሺtn, yn ሻ k2 = f ൬ tn + , yn + ℎ ⃞ k3 = f ൬ tn + , yn + ℎ ⃞ k4 = fሺtn + ℎ, yn + ℎk3 ሻ
Consider the differential equation = − ty, t > 0 (1)Given that y=2 when t=0. Using the numerical method given above, write a function to find y when t |
2023-05-13