Mathematica

madelinemiles
NA1.pdf

FOR THE CUBIC SPLINE QUESTION.

9.Find the clamped cubic spline that interpolates f(x)=lnxf(x)=lnx at five evenly spaced points in [1, 3], including the endpoints. Empirically find the maximum interpolation error on [1, 3]. 10.Find the number of interpolation nodes in Computer Problem 9 required to make

the maximum interpolation error at most 0.5×10−70.5×10−7.

FOR THE LAGRANGEFILE

Use the method of divided differences to find the degree 4 interpolating

polynomial P4(x)P4(x) for the data (0.6, 1.433329), (0.7, 1.632316), (0.8, 1.896481), (0.9,

2.247908) and (1.0, 2.718282). (b) Calculate P4(0.82)P4(0.82)and P4(0.98)P4(0.98).

(c) The preceding data come from the function f(x)=ex2f(x)=ex2. Use the interpolation error

formula to find upper bounds for the error at x=0.82x=0.82 and x=0.98x=0.98, and compare the bounds with the actual error. (d) Plot the actual interpolation

error ex2−P(x)ex2−P(x) on the intervals [0.5,1] and [0, 2].

MODIFICATION-Instead of divided differences use the Lagrange module in LagrangeInterpolation.nb. Create the data list for this problem and call the module to build the polynomial (see the examples in LagrangeInterpolation.nb). Hint: To compute a value of a polynomial or a function at a point x=c, use the substitution

operator pN=pN/.x->c (x in the polynomial pN will be replaced by c). FOR THE CHEBYSHEV

Let f(x)=e|x|f(x)=e|x|. Compare evenly spaced interpolation with Chebyshev interpolation by plotting degree npolynomials of both types on the interval [−1,1][−1,1], for n=10n=10 and 20. For evenly spaced interpolation, the left and right interpolation base points should

be −1−1 and 1. By sampling at a 0.01 step size, create the empirical interpolation errors for each type, and plot a comparison. Can the Runge phenomenon be observed in this problem? You can modify example 1 in Interpolation_ChebyshevNodes.nb to accomodate the given f(x) and n=10, 20 points. Also, by replacing the expression for t_k there with the expression for evenly spaced points you can generate the polynomial based on these points. It is not necessary to plot the errors, although this would be nice to show. You may instead plot the function and the polynomials on the same screen or on several screens; the objective is to demonstrate vizually that Chebyshev polynomials are better interpolants of the function.