# Write MATLAB a function in the following format to implement Newton’s methods with divided dierences.

Math 435 Spring 2013 Prof. B. Datta Computer Homework 2 DUE : MARCH 19, 2013 1. Write MATLAB a function in the following format to implement Newton’s methods with divided dierences.

Document Preview:

Math 435 Spring 2013 Prof. B. Datta Computer Homework 2 DUE : MARCH 19, 2013 1. Write MATLAB a function in the following format to implement Newton’s methods with divided dierences. function [Y I;DD; PC] = newintdd (X; Y; n;XI) Inputs: 8>>>: X?? The vector containing the abscissas of the data Y ?? The vector containing the ordinates of the data n?? degree of the interpolating polynomial XI?? The vector containing the abscissas of the interpolating points Outputs: 8>>>: Y I?? The vector containing the interpolated values PC?? The vector containing the coecents of the interpolating polynomial DD?? The diagonal entries of the divided dierences table FD?? The diagonal entries of the forward dierences table Data: Interpolate f(x) = ln(x), 1 x 4 , with h = 0:5 at x = 1:9; 2:9 2. (Experiment with the Runge Function). [The purpose of this experiment is to demonstrate the fact that t he approximations obtained for the Runge function using the Chebyshev nodes and cubic splines are much more accurate than these obtained by the higher-order single interpolating polynomials.] (a) Interpolate f(x) = 1 1 + 25×2 using Newton polynomials of both degrees 5 and 10 based on equally spaced nodes over [??1; 1]. Draw the graph of f(x) and those of the interpolating polynomials in a single plot. (b) Repeat step (a) with the Chebyshev nodes (that is, with the nodes at the zeros of the Chebyshev polynomial in [??1; 1]). (c) Interpolate using a cubic spline with 11 equally spaced nodes. (Use MATLAB functions interP1).
(d) Prepare a table of interpolation errors in the following format with x = ??1 : 0:2 : 1. Newton Chebyshev Spline Newton Chebyshev Spline x f(x) P10(x) P10(x) (x) Error Error Error 8>>>>>>>: Newton P10(x)?? The value of the 10th degree Newton interpolating polynomial at x with standard nodes Chebyshev P10(x)?? The value of the 10th degree Newton interpolating polynomial with Chebyshev nodes spline (x)?? The value of the spline function at x

## "Is this question part of your assignment? We Can Help!" 