MATH256 Individual Project 2
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
MATH256 Individual Project
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αj hj + β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 Q0(′)(x) = 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.
(d) (i) Write a Maple procedure that takes three arguments: arrays containing the x and y values from the data set (∗) and a boolean newton. If newton is true, then the value for β0 obtained in part (c) should be used. Otherwise, set β0 = 0 . The procedure should return an array containing the coefficients for interpolating quadratic splines as its result. This array should have the constant, linear and quadratic coefficients for the splines (i.e. γj , βj and αj ) in columns 0, 1 and 2, respectively.
(ii) Define the function
f (x) = cos(x2 )ex .
Generate a set of quadratic splines with β0 = 0 , fitting to the function f (x) at eleven equally spaced data points, with x0 = 0 and x10 = 2. Plot the splines along with f (x) on the same graph.
(iii) Repeat part (ii), now setting newton to true, so that the value for β0 obtained in part
(c) is used. What do you notice?
You can plot the splines by loading the NumericalMethods package and using
plot( ’eval_spline’( t , X , s ) , t = 0 . . 2 ) ;
Here, X is the array containing the nodes xj and s is the array returned by your procedure. Make sure the latter has the correct structure, as set out in part (i).
2. The Cn quadrature rule for the interval [ −1, 1] uses the points at which Tn −1 (t) = ±1 as its nodes (here Tn −1 is the Chebyshev polynomial of degree n − 1). The C3 rule is just Simpson’s rule because T2 (t) = 2t2 − 1 .
(a) (i) Find the nodes and weights for the C5 quadrature rule.
(ii) Determine the first nonzero coefficient Sj for the C5 rule.
(iii) If the C5 rule and the five-point Newton– Cotes rule are applied on the same number of
subintervals, what approximate relationship do you expect the two errors to satisfy? (iv) Suppose that the C5 rule has been applied on N subintervals, and that all of the function
evaluations have been stored. How many new function evaluations are required to apply the C9 rule on the same set of subintervals? Justify your answer.
(b) Consider the approximation
−11 g(t) dt ≈ wq g(tq ).
where tq and wq are the nodes and weights for the Cn quadrature rule. Assume that n is odd, and let k = (n − 1)/2 .
(i) Set g(t) = T2j(t), and then make the substitution t = cos θ to evaluate the integral. Hence show that
− = wq cos !, j = 0, 1, . . . , k .
(ii) Consider the operator
Sk [cj ] = − + cj .
j=0
It can be shown (proof: exercise for fun) that
Sk "cos !# = 0, for q = 2, . . . , n − 1.
Use this fact to show that
w1 =
1 |
4k2 − 1 . |
This result should agree with your calculation from part (i).
2022-05-06