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

Published by Essaygrid on

Purpose: After doing this project you will

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

Problem: Consider the function


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:

  1. Write a function that takes an array containing distinct points and returns the coefficient ak, 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.
  2. Write a function that takes the Newton coefficient of the polynomial and a point x and evaluates Pn(x). This should be the nested product form that is similar to Horner’s method.
  3. 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

Xk = -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

xk=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.

  1. 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.
  2. 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.

Buy this Python Code for $150

essay writing service

Topic suggestion tool

Instantly find great topics for your essay

Categories: Questions

Open chat
You need help?