f(x) = 1/(1+25x?) 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. Task: Do the following: 1. Write a function that takes an array containing n +1 distinct points and returns the coefficients a, 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 coefficients of the polynomial and a point x and evaluates P(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: (a) Using the 21 uniformly spaced nodes Xk = -1+ k(.1), k = 0, 1, ... , 20 have your program compute the error at r = .985 and also at r = 0.1. (b) Using 21 nodes given by 2k + 1 Ik = Cos k = 0, 1, ..., 20. 2(20+1) have your program compute the error at x = 0.985 and also at x = 0.1.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
f(x) = 1/(1 + 25.a?)
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.
Task: Do the following:
1. Write a function that takes an array containing n+1 distinct points and returns the
coefficients a, 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 coefficients of the polynomial and a point r and
evaluates P,(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:
(a) Using the 21 uniformly spaced nodes
-1+ k(.1),
0, 1,... , 20
have your program compute the error at x = .985 and also at x = 0.1.
(b) Using 21 nodes given by
2k + 1
Xk = COS
k = 0, 1, ... , 20.
2(20 + 1)
have
your program comnpute the error at x =
0.985 and also at r = 0.1.
C L
Transcribed Image Text:f(x) = 1/(1 + 25.a?) 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. Task: Do the following: 1. Write a function that takes an array containing n+1 distinct points and returns the coefficients a, 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 coefficients of the polynomial and a point r and evaluates P,(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: (a) Using the 21 uniformly spaced nodes -1+ k(.1), 0, 1,... , 20 have your program compute the error at x = .985 and also at x = 0.1. (b) Using 21 nodes given by 2k + 1 Xk = COS k = 0, 1, ... , 20. 2(20 + 1) have your program comnpute the error at x = 0.985 and also at r = 0.1. C L
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.
4. 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.
Transcribed Image Text: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. 4. 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education