Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
MATH256 Individual Project 2023
Immediate checks
• Your name and student number should be shown above.
• You should have one question related to each of the following topics:
▶ polynomial interpolation
▶ quadrature
Contact the lecturer immediately if there are problems with your assignment file. Extensions
will not be given to students who belatedly report such issues.
General Instructions
• This work will count for 50% of your final mark for MATH256.
• A total of 100 marks are available.
• Make sure you save your work regularly. Executing incorrect codes may cause Maple to
become trapped in an infinite loop. If this happens, you can try pressing the interrupt button
( ), but you may be forced to close the application and reload your work.
• Submit your work in the form of either a single pdf file or a single pdf file for each question
(two in total). See the module handbook for instructions on merging and rearranging pdf
files.
• Invalid submissions (e.g. files in formats other than pdf) will be deleted. Students who make
invalid submissions will be given another chance to submit, but this will be treated as late,
and subject to standard university penalties (5% deduction for each day, and a mark of zero
after five days).
• You must answer the questions in this assignment. No marks will be awarded for
answering other questions.
Student Name
Student number
1. In the chapter on polynomial interpolation, we investigated the construction of cubic splines to
interpolate the data set {
(x0, y0), (x1, y1), . . . , (xn, yn)
}
. (∗)
In this question, we use simpler quadratic splines of the form
Qj(x) = αj(x− xj)2 + βj(x− xj) + γj, xj ≤ x ≤ xj+1, j = 0, 1, . . . , n− 1.
The function Q(x) is formed from the union of the individual splines, and the notation hj = xj+1−xj
is used throughout.
(a) (i) Given that Q(x) has a continuous first derivative, how many equations are available to
determine the coefficients αj, βj and γj? How many coefficients will be left undetermined
when these have been applied? Justify your answers.
(ii) Determine γj, and show that
2αjhj + βj = βj+1 and βj+1 = 2y[xj, xj+1]− βj.
(iii) In view of the above results, what is the main advantage of quadratic splines over cubic
splines?
(b) Calculate the magnitude of the discontinuity in the curvature of Q(x) at x = xj. Simplify
your answer as far as possible.
(c) To use quadratic splines, we must choose a value for the coefficient β0. Here we try to
determine a good choice by using the Newton polynomial through the three points (x0, y0),
(x1, y1) and (x2, y2), which we denote by P (x).
(i) Show that setting Q′0(x0) = P ′(x0) yields β0 = y[x0, x1]− y[x1, x2] + y[x0, x2].
(ii) By considering the roots of the difference d(x) = P (x)−Q0(x), prove that, with this
choice for β0, P (x) and Q0(x) are representations of the same function.
(iii) Verify algebraically that d(x) = 0 for all x (still with β0 defined as in part (i)). Hint: write
α0 as a second divided difference.
2. The Om quadrature rule for [−1, 1] has nodes
tq = −1 + 2q − 1
m
, q = 1, 2, . . . ,m,
where m is a positive integer.
(a) Write down the node locations for the Om rule in the cases m = 2, 3, 4 and 5. Why do you
think the rule is designed to place half-sized spaces between −1 and t1 and between tm and 1?
(b) Suppose now that the O5 rule is applied to the integral
I =
∫ b
a
f(x) dx,
using N subintervals, each of width ∆x.
(i) Find exact values for the weights w1, . . . , w5.
(ii) Write down the O5 quadrature formula for a subinterval of width ∆x.
(iii) Calculate the first nonzero coefficient Sp, and hence find the leading-order error for the
O5 rule on a single subinterval of width ∆x.
(c) (i) Make a fair comparison between the O5 rule and the five-point Newton–Cotes rule
considered in the lecture notes. Which method do you expect to perform better in
general, and by what (approximate) factor will the errors differ?
(ii) What effect do you expect doubling the number of subintervals to have on the errors for
the whole interval? Justify your answer.
(d) (i) Write a Maple procedure that takes as its arguments a function f , real numbers a and b,
and N , the number of subintervals. The procedure should return the approximate value
of the integral I, computed using the O5 rule, as its result.
(ii) Apply the O5 quadrature rule to the integral
I1 =
∫ π/4
−π/4
(1 + x) tan x
x2 + 3 dx
using 10 subintervals (don’t forget to apply evalf to obtain a numerical value for π).
Recalculate the integral using the five-point Newton–Cotes rule, with the number of
subintervals adjusted to ensure a fair comparison, and obtain numerical values for the
absolute errors in these approximations. Confirm that the ratio of the errors in the two
rules is in agreement with your analysis in part (c). Repeat this calculation for a second,
arbitrarily chosen integral (don’t use a polynomial, but make sure there is no possibility
of division by zero, etc.).
The numerical methods package provides a five point Newton–Cotes procedure; you can also
download the procedure code from Canvas (five_pt_NC.mw).