Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
|
Module code and Title |
DTS104TC NumericaI Methods |
|
|
School Title |
SchooI of ArtificiaI InteIIigence and Advanced Computing |
|
|
Assignment Title |
Assignment 1 |
|
LEARNING OUTCOMES
This assessment tests your ability to:
A. Apply numerical methods in a number of different contexts.
B. Solve systems of linear and nonlinear algebraic equations to specified precision.
C. Compute eigenvalues and eigenvectors by the power method.
D. Solve boundary value and initial problems to finite precision.
E. Develop quadrature methods for numerical integration.
INSTRUCTIONS
1. The weighting of this assignment is 80% of the final mark.
2. The marking criteria sheet is provided as a supplementary document.
3. Your submission should only be in English.
4. When you fill out Tables in your Answer Sheet, you can add or delete rows if it is needed.
5. Where required, Matlab code should be attached as .m files.
a) State the relevant .m file name in Answer Sheet to each question.
b) It is allowed to make use of multiple .m files as functions and inputs.
c) User-defined functions are allowed and all relevant functions of all questions should be
submitted in a single folder. The final answers to each question should be displayed in an executable .m file named after each question.
d) You should add comments on functions,for loops, while loops and variables used in your .m files to get full marks.
e) In some questions, please show your process of derivation before you use your Matlab codes to get full marks.
6. Answers to questions should be typed on the Assignment1 Answer Sheet as Word files. The
assignment must be submitted in a Zip file with your Answer Sheet and all .m files (Check all
documents needed in the Zip file in your Assignment1 Answer Sheet) via Learning Mall Online to the correct drop box. Only electronic submissions are accepted and no hard copy submissions are permitted.
7. In this assignment, you are strictly prohibited from using ChatGPT or other similar natural
language processing tools to attempt to directly solve problems in the assignments. Once detected, the corresponding parts will be marked as 0 point.
8. All students must download their file and check that it is viewable after submission. Documents may become corrupted during the uploading process (e.g. due to slow internet connections). However, students themselves are responsible for submitting a functional and correct file for their assessments.
Question – 1 (3/100)
Consider the following equation: Equation (1)
(a) Assume the initial interval of x is set as [0,0.5]. Solving x for the following case: y=0 for a relative error of 0.01 using Bisection method using Matlab. Find out how many iterations are required to determine the value of x and fill out Table-1 in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerOne.m. (3 marks)
Submission requirements:
.All relevant Matlab code should be copied & pasted into the Answer Sheet.
.Attach your Matlab code as .m files in your submission.
Question – 2 (8/100)
Consider the following equation: Equation (2)
(a) Solving x for the following case: y = 0 for an relative error of 0.01 using Newton-Raphson method in Matlab (Set the initial guess x as 0.5). Find out how many iterations are required to determine the value of x and fill out Table-2 in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerTwo.m. (3 marks)
(b) If we set the initial guess x to 1.45, what would happen? Run your code and discuss the root cause of this phenomenon. (5 marks)
Submission requirements:
.All relevant Matlab code should be copied & pasted into the Answer Sheet.
.Attach your Matlab code as .m files in your submission.
Question – 3 (4/100)
Using the Secant method to find the cube root of 2025 (Given that the cube root of 2025 lies between 10 and 15), with a requirement that the relative error be within 0.01. Find out how many iterations are required to determine the root and fill out Table-3 in your Answer Sheet. The final answer should be computed and submitted in Matlab, using a file named AnswerThree.m. (4 marks)
Submission requirements:
.All relevant Matlab code should be copied & pasted into the Answer Sheet.
.Attach your Matlab code as .m files in your submission.
Question – 4 (14/100)
Consider the system of linear algebraic equations: Equation (3)
(a) Implement the Jacobi method in Matlab. Set the initial guess [x1;x2;x3] as [0; 0; 0] and compute the solutions for Equation (3) for a relative error of 0.1. Fill out Table-4 (a) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerFourA.m. (4 marks)
(b) Implement the Gauss-Seidel method in Matlab. Set the initial guess [x1;x2;x3] as [0; 0; 0] and compute the solutions for Equation (3) for a relative error of 0.001. Fill out Table-4 (b) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerFourB.m. (4 marks)
(c) Implement the LU Decomposition method in Matlab and compute the solutions for Equation (3). Fill out Table-4 (c) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerFourC.m. (2 marks)
(d) Compare the answers from Question (a), Question (b), and Question (c), then discuss your findings. (4 marks)
Submission requirements:
. All relevant Matlab code should be copied & pasted into the Answer Sheet.
. Include Matlab code as .m files as part of your submission.
Question – 5 (13/100)
Consider the system of linear algebraic equations: Equation (4)
(a) Implement the Jacobi method in Matlab. Set the initial guess [x1;x2;x3;x4;x5;x6] as [0; 0; 0; 0; 0; 0] and compute the solutions for Equation (4) for a tolerance of 0.001. Fill out Table-5 (a) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerFiveA.m. (5 marks)
(b) Implement the Gauss-Seidel method in Matlab. Set the initial guess [x1;x2;x3;x4;x5;x6] as [0; 0; 0; 0; 0; 0] and compute the solutions for Equation (4) for a tolerance of 0.001. Fill out Table-5 (b) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerFiveB.m. (5 marks)
(c) Discuss your findings from Question (a) and Question (b). (3 marks)
Submission requirements:
. All relevant Matlab code should be copied & pasted into the Answer Sheet.
. Include Matlab code as .m files as part of your submission.
Question – 6 (16/100)
Consider the the Matrix A below: Equation (5)
(a) Apply the power method to calculate the principal eigenvalue and the corresponding normalized eigenvector for the Matrix A in Matlab. Set the initial Eigenvector as [1; 1; 1; 1; 1] and the stopping criterion being that the relative error of the principal eigenvalue is less than 1%. Fill out Table-6 in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerSix.m. (10 marks)
(b) Use the MATLAB function eig() to compare with your answer in Question (a), then identify the exact principal eigenvalue of matrix A and perform calculations to verify your conclusion. Fill out Table-6 (b) in your Answer Sheet. (2 marks)
(c) In a certain place, there are five coffee manufacturing factories. Coffee factory B3 has a market share of 15%. To increase its market share, it completed a series of technological reforms at the beginning of the year. Assuming that customers in this place have a probability of changing the coffee brand they drink every day, and matrix A in equation (5) is their brand transition matrix, where aij represents the probability that a customer will purchase brand Bi given that their previous purchase was brand Bj . Please use the conclusions from the Question (a) and Question (b) to estimate the market share of coffee factory B3 at the end of the year. (4 marks)
Submission requirements:
. All relevant Matlab code should be copied & pasted in the section below.
. Attach your Matlab code as .m files in your submission.
Question – 7 (10/100)
Consider the equation below: Equation (6)
(a) Implement 4th-Order Runge-Kutta Methods to calculate the integral of function g in the interval between 0 and 0.4. The initial condition of G(x=0)=0.1 is known. Compare the results obtained with a different step size and report your findings. Fill out Table-7 in your Answer Sheet and show your process of derivation. Final answers should be computed and submitted in Matlab, using a file named AnswerSeven.m. (10 marks)
Submission requirements:
. All relevant Matlab codes should be copied and pasted on the Answer Sheet.
. Attach Matlab code as .m files in submission
Question – 8 (12/100)
Consider the equation below: Equation (7)
(a) It is known that Equation (7) is the probability density function of the standard normal distribution. Implement Euler's method with a step size of 0.1, calculate the function values at the specified points of the corresponding cumulative distribution function. Fill out Table-8 in your Answer Sheet and use MATLAB to plot the graph of the corresponding cumulative distribution function within the range of 0 to 3, then paste this graph generated by Matlab into the answer sheet. Final answers should be computed and submitted in Matlab, using a file named AnswerEight.m. (12 marks)
Submission requirements:
. All relevant Matlab codes should be copied and pasted on the Answer Sheet.
. Attach Matlab code as .m files in submission
Question – 9 (20/100)
Evaluate the rational integral expression (8) below.
(a) Set a=2 and b=3, in Matlab, calculate the approximate solution of Expression (8) using Gaussian Quadrature method with n=3. Fill out Table-9 (a) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerNineA.m. (4 marks)
(b) Use the MATLAB function integral to solve the definite integral in question (a) and consider the result as the true value. Use Matlab to test how many segments are required by the Trapezoidal method to obtain a better accuracy than Gaussian Quadrature with n = 5? Fill out Table-9 (b) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerNineB.m. (4 marks)
(c) Use Gaussian Quadrature method with n=5 to evaluate Expression (5) for a=2 and b=+∞ in Matlab. Write down your answer in your Answer Sheet. Fill out Table-9 (c) in your Answer Sheet. The final answers should be computed and submitted in Matlab, using a file named AnswerNineC.m. (10 marks)
(d) Explain why Gaussian Quadrature method is superior to Trapezoidal method; In what situation can the Trapezoidal method obtain a precise results? Present answer in your Answer Sheet. (2 marks)
Submission Requirements:
. All relevant Matlab codes should be copied and pasted on the Answer Sheet.
. Attach Matlab code as .m files in submission