Skip to main content
留学咨询

辅导案例-MA3NAT-Assignment 2

By May 15, 2020No Comments

MA3NAT Numerical analysis II – Assignment 2 Amos S. Lawless [email protected] This assignment is worth 10% of your total mark for this module. A total of 10 marks is available for this assignment. You should answer all questions. Solutions should be submitted by 12.00 noon on Monday 2 December Solutions to Question 1 should be submitted on paper to the JJT Student Support Centre. An assessed work coversheet should be attached to your submission. Solutions to Question 2 should be submitted electronically through Blackboard. You should submit your code, which should include your student number in the comments at the top, in a form that can be run, i.e. a Matlab script or function. Code submitted in a format such as a plain text, Word or pdf document will not be marked. You should also submit a figure electronically for Question 2(b) as a JPEG file. Late submissions will be penalised in accordance with standard University policy. Question 1 Suppose that we wish to solve the equation Ax = b using a Gauss-Seidel iteration, where A =  8 −2 −2−2 8 −2 −2 −2 8  , b =  8−2 18  . (a) Calculate by hand the first two iterations of the Gauss-Seidel iteration starting from the first guess vector x(0) = 00 0  , showing your working. Give your answers to 3 decimal places. [3 marks] (b) Given that the true solution is x = 21 3  , calculate the two-norm of the error after two iterations. [1 marks] [PTO] 1 Question 2 Hint: For this question you may make use of any relevant part of the model solutions for formative problem sheet 3. These can be found under ‘Matlab code’ on Blackboard. (a) Write a Matlab function to calculate the solution of the equation Ax = b using the Jacobi over-relaxation (JOR) iteration method. The function should have as inputs the matrix A, the right hand side b, the value of ω and the number of iterations to perform. The output should be the final iterate of x. The function should use the zero vector as the starting guess. [2 marks] (b) Let A ∈ Rn×n be a tridiagonal matrix with 10 along the diagonal and -1 on the off-diagonal, A =  10 −1 0 −1 10 −1 0 0 −1 10 −1 · · · · · · · · · · · · · · · −1 −1 10  . and b ∈ Rn is given by a sine wave, as on formative problem sheet 3. Let n = 100. Write a Matlab script that solves the equation Ax = b using the JOR method by calling the function of part (a) for values of ω = 1.0, 1.05, 1.1, 1.15, 1.2, . . . , 1.35, 1.4. For each value of ω you should run JOR for 30 iterations. Calculate the two-norm of the error in the solution (defined as the difference between the JOR solution and the true solution) each time and plot the two-norm of the error against ω, using a log scale for the error.Your plot should have an appropriate title and axis labels, with your student number included in the title. You should submit both your script and a JPEG version of the figure. [4 marks] 2

admin

Author admin

More posts by admin