Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MATH256  Problem Sheet 7

7.1 Throughout this question,

s(t) = Tn (t) - t.

(a)  Use Maple to plot a graph of s(t), for -1.1 < t < 1.1.  Try several different values for the index n, and in each case count the number of roots. In general, how many roots do you think s(t) has on the interval [-1, 1], for n 2 2?

Hint: assign a value to n and use the command

plot(  ChebyshevT( n  , t  )  - t  , t  =  -1 .1 . .1 .1  )

to make the plots.

(b)  Let χj   represent the extrema of Tn (t) on the interval  [-1, 1], as in

§4.8.3 of the lecture notes.  In general, what can be said about

(i) s(χ0 ),    (ii) s(χn ),    (iii) s(χj ) for j = 1, . . . , n - 1?

(c)  Based on your answers to part (b), formulate an argument to show that your general results from part (a) is always true.

Hint: consider odd and even n separately.

(d)   (i) Starting from the fact that Tn (cos θ) = cos(nθ), find two sequences of points {θ} and {θ-j} at which Tn (t) - t = 0.

Hint: use the identity

cos(a - b) - cos(a + b) = 2 sin a sin b.

(ii)  (Tricky) Determine ranges for the indices in your two sequences that ensure each root of s(t) appears precisely once.


7.2   (a)  Let n be a positive integer, and


f(x) =     1   

1 + x2 .

Using Maple, generate an array of equally spaced nodes x0 , . . . xn , with x0 = -5 and xn = 5, and a second array containing corresponding values obtained from the function f, i.e. yj  = f(xj ). Form the interpolating polynomial Pn  of degree n such that Pn (xj ) = f(xj ) and calculate Pn (1 +^10).  Check that everything is working by creating a plot showing the points (xj , yj ) and the graph of f(x). on the same axes. Use the following code (or similar) to create the plot.

pd  :=  dataplot(  X  ,  Y  ,  points  ,  style  =  point  )  :

pf  :=  plot(  f  ,  -5  . .  5  ,  size  =  [  500  ,  500  ]  )  : plots[display](  pd  ,  pf  )  ;

(b)  Now experiment with different values for n. Does it appear that

Pn (1 +^10) → f(1 +^10)   as   n → o?

What do you think causes the behaviour of the results?


(c)  Change the code you wrote in part a so that it uses Chebyshev nodes, and then repeat your experiment with n and Pn (1 +^10). What do you notice?

7.3 As noted in §4.9, the requirements for splines do not produce enough equations to determine all the coefficients of the cubic functions that make up the spline curve. Two extra conditions, called closure assumptions are needed. In the notes, we simply assumed that β0 = βn = 0.

(a) Assuming instead that the second derivative of the spline curve is given by a single linear function for x0  < x < x2 , obtain an expression for β0 in terms of β0  and β1 . Use a similar approach to express βn  in terms of βn-1  and βn-2 .

(b)  How must the linear system for the coefficients βj  be changed in order to apply the closure assumption from part (a)?

7.4   (a)  Edit the cubic_spline_coeffs procedure from splines .mw so that is take a second argument, natural, which is of type boolean. ‘Natural’ splines are obtained by setting βn = β0 = 0, so if natural is true the function of the procedure should be unchanged from the original version. However, if natural is false, then it should use the alternative closure assumptions from problem 7.3.


(b) Test the modified procedure by checking that the splines do indeed pass through a set of arbitrary data points (look at the end of splines .mw to see how to do this).

7.5 The Excel le liverpool_population .xlsx contains population data for the city of Liverpool, from 1950 to 2020. Download this from Canvas.

(a)  Generate an array containing the years and a second array containing the corresponding population gures.   Note that the indices of the arrays should start at zero.  You can do this manually, or using the ExcelTools package. In the latter case, you will need to do your own research to find out how to use the package. You will need to set the working directory to the folder containing the data, either by clicking at the foot of the window as shown below, or using the currentdir command.

 

You can check that the import has worked by setting rtablesize to infinity and then converting the arrays to vectors.

(b)  Use the modified splines procedure to generate plots tting the data using natural splines, and also using the alternative closure assump-tion  from  problem  7 .3 .   Then  plot  the  difference  between  the  two approximations.

(c) Where is the largest difference between the two approximations? Why do you think this happens? Do you think the difference is significant?