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.
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.
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 11E
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning