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  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 L4  quadrature rule for [ −1, 1] uses four nodes: t1  = −1, t4  = 1 and t2  and t3  chosen optimally, to minimise the error.

(a) Write down the system of equations for the nodes and weights and solve this exactly. Hint: aim for an equation involving 1 + t2(2)  but not w1  or w2 .

(b) Another way to find the nodes for the L4  rule is to observe that it should integrate polynomials of degree five exactly, because it has six free parameters. Any such polynomial Q5 (t) can be expressed in the form

Q5 (t) = (t2  1)J2 (t)A1 (t) + B3 (t),

where J2 (t) = t2  + αt + β and A1 (t) and B3 (t) are polynomials of degree one and three, respectively. Here, A1  and B3  depend on Q5 , but J2  is the same in all cases. Provided J2  is such that

Z11 (t2 1)J2 (t)tr dt = 0,    for   r = 0, 1,                                     ()

the argument used to locate the nodes for Gaussian quadrature in the lecture notes will now work (you are not asked to write out the details of this argument).  Prove that there are unique values for α and β such that (∗) is satisfied, and verify that the roots of J2  are then the same as the nodes found in part (a).

(c)  Calculate the leading-order error for the L4  rule on a subinterval of width ∆x .

(d)   (i)  In view of your answer to part (c), make a fair comparison of the L4  quadrature rule and the three-point Gaussian rule.

(ii) Suppose that after performing a calculation with the L4  rule on N subintervals, a second calculation us made, this time using 2N subintervals. How many new evaluations of the integrand are required? What is the corresponding value for the three-point Gaussian rule (i.e. how many new evaluations are required to apply the rule on 2N subintervals if it has already been applied on N subintervals)? Explain your answers.