# Matlab代写 | Assignment 3 of MTH2051/3051

### Matlab代写 | Assignment 3 of MTH2051/3051

issues in the discussion forum.

i) The submission deadline is 6pm on Tuesday of week 10.

ii) Please complete the template files provided through Moodle. Do not

iii) Your code is not required to check whether a hypothetical user of your
code provides reasonable inputs.

iv) Symbolic computation and high-level Matlab commands are prohib-
ited and result in zero marks for the task in which they were used.

v) The marking scheme is full marks for a correct implementation and
no marks for an incorrect implementation.

vi) Submit a zip-file called firstname_surname_assignment_3.zip con-
taining all your Matlab files through Moodle.

Assignment 3.1. (polynomial interpolation, 8 marks)

In this exercise, you will see how polynomial interpolation behaves in com-
putational examples, and why we often use splines instead.

a) Complete the file myNewtonCoefficients.m by implementing an al-
gorithm that computes the scheme of divided differences. Recall that
the divided differences can be organised in a lower triangular matrix
as explained in Remark 5.7, and that the Newton coefficients can be
obtained as in Theorem 5.9.

b) Complete the file myEvaluateNewtonPolynomial.m by implementing
the Horner-type algorithm from remark 4.14.

c) Run the script wrapper_3_1.m, and relate the behaviour of the in-
terpolation polynomials generated by the wrapper to Theorem 5.13.
Compute the derivatives of the functions f used as test cases by the
wrapper to explain the output you see. (nothing to submit, not marked)

Assignment 3.2. (numerical differentiation, 2 marks)
In this exercise, you will see the interplay between the theoretical trunca-
tion error and the effect of round-o errors on the behaviour of numerical
dierentiation.

a) Complete the file myForwardDQ.m by implementing the forward differ-
ence quotient from Example 6.2.

b) Complete the file myCentralDQ.m by implementing the central differ-
ence quotient from Example 6.2.

c) Run the script wrapper_3_2.m, and explain as much of the output as
you can, based on statements from the lecture notes and exercises you
have completed. You cannot explain every detail, but most of what
you see in the plot. (nothing to submit, not marked)

Assignment 3.3. (numerical integration, 6 marks)

In this exercise, you will see in a computational example how composite
divided into more and more subintervals.

a) Complete the file myTrapezoidal.m by implementing trapezoidal rule.

b) Complete the file mySimpson.m by implementing Simpson rule.

c) Complete the file myCompTrapezoidal.m by implementing the compos-
ite trapezoidal rule.

d) Complete the file myCompSimpson.m by implementing the composite
Simpson rule.

e) Run the script wrapper_3_3.m, and explain its output by referring to
the corresponding error estimates in the lecture notes. (nothing to
submit, not marked)