MATH256 Individual Project 2023

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.

Programming Help
1. In the chapter on polynomial interpolation, we investigated the construction of cubic splines to
interpolate the data set
n(x0,y0), (x1,y1), …, (xn,yn)o. (∗) 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. This problem is concerned with integrals of the form
(a) Consider the case where h(x) = 1 for all x, so that the integrand is just f(x) = ln(x).
(i) Obtain a simplified form of the general formula for quadrature error in this case. Write
the error for the whole interval in terms of the function
φ(N,p)=XN 1. j=1 (2j − 1)p
You may assume that S1 = 0, since this is the case for all nontrivial quadrature rules.
(ii) Include the following table in your submission, and fill in the results with values accurate
to at least three significant figures.
p φ(1, p) φ(2, p) φ(5, p) limN →∞ φ(N, p) 2
(iii) Suppose that I is estimated twice using the same quadrature rule, first with N and then 2N subintervals of equal size. What relationship do you expect the errors in the two estimates to (approximately) satisfy? Justify your answer.
(iv) What do you think is the cause of this?
(b) Another way to compute I (for arbitrary h) is to use a substitution to remove the singularity.
f (x) dx, where f (x) = ln(x)h(x). (∗) Here, b > 0 and h(0) exists but is not equal to zero, so that f(x) unbounded in the limit x → 0.
(i) Make the substitution x = be1−1/u in the integral I. Simplify the result as far as possible. (ii) Show that the resulting integrand, which is a function of u, vanishes as u → 0.
(iii) Another type of integral that is not directly amenable to numerical quadrature is
Z b q(x) J= √dx,
where q(0) exists but is not equal to zero. Suggest a method that can be used to compute
accurate values for J.
(i) Using the three-point Gaussian quadrature procedure from solutions9.mw or your own
version, estimate I for the case
h(x) = cos(x) and b = 2,
with N = 20 and then with N = 40. Obtain numerical estimates for the absolute errors in your approximations. Are the results consistent with your analysis in part (a)? Why (or why not)?
(ii) Choose another function h(x) and another value for b and repeat the calculations from part (i). Don’t use a polynomial for h, but make sure there is no possibility of division by zero, etc.
Programming Help, Add QQ: 749389476
(i) Write a Maple procedure that approximates integrals of the form (∗) using the analysis from part (b). The procedure should takes as its arguments a function h, a positive number b and a natural number N. It should calculate the approximation by applying Simpson’s rule on N subintervals to the integral over u and return the resulting estimate as its result.
(ii) Test your procedure with the same choices for h, b and N that you used in part (c). Obtain numerical estimates for the absolute errors in the approximations, and check what happens when the number of subintervals is doubled.
Note: you may need to double the number of subintervals several times before you see consistent behaviour.
CS Help, Email: tutorcs@163.com