# Write a function that takes an array containing distinct points and returns the coefficient

**Purpose:** After doing this project you will

- Be able to implement and use code for Newton interpolation.
- Apply the solvers to approximate a function at a given point.
- Be able to assess the accuracy of the of the approximation in the context of different choices of interpolation modes.

**Problem: **Consider the function

f(x)=1/(1+25x^{2})

This is a somewhat famous function in numerical analysis because it displays interesting behavior when approximated using polynomial interpolation on uniformly spaced nodes.

You are going write your own code for polynomial interpolation and investigate the accuracy of two approximations.

**Tasks: **Do the following:

- Write a function that takes an array containing distinct points and returns the coefficient a
_{k, }k=0, 1, ………….., n for the Newton form of the interpolating polynomial for an arbitrary function. You can pass in either the function f(x) or an array of function values at the points. - Write a function that takes the Newton coefficient of the polynomial and a point x and evaluates
*P*. This should be the nested product form that is similar to Horner’s method._{n}(x) - Write a program that calls your two functions to compute the interpolating polynomial for the specific function f(x) given above and does the following:

- Using the 21 uniformly spaced nodes

X_{k} = -1 +k (.1), k = 0,1,…, 20

have your program compute the error at x=.985 and also at x=0.1.

- Using 21 nodes given by

x_{k}=cos(2k+1/2(20+1)pi) _{k=0,1,…………………,20. }

have your program compute the error at x=0.985 and also at x=0.1.

The output of your program should be the errors in each case. Your program should run without any additional input from me to generate the data you use in your report.

- Give an explanation of whether your results are consistent with the error bounds for each interpolation and an explanation of why you might have observed relatively large or small errors in each case. If you are using a programming language in which it is relatively easy to generate plots, you might find it informative to plot the error on the interval [-1, 1]. Plots are, however, not a required part of the project.
- In what you submit, you should have original source code files for the code you write.(e.g. .py, .m), or .java files) and a separate pdf document discussing the results.

You can send an email to us if you need the entire code and report for this project or order through the button below. Email: suport@essaygrid.com or chat with us via the chat button on the right below.