Question: In Python please! Recall that Lagrange interpolating polynomial for a set of N points, (nf),-1....,N, is given by p)-p!N-(e), where p!N-)- (N-1) x), where P

In Python please! In Python please! Recall that Lagrange interpolating polynomial for a set of

Recall that Lagrange interpolating polynomial for a set of N points, (nf),-1....,N, is given by p)-p!N-(e), where p!N-)- (N-1) x), where P k+n Write a code that implements polynomial interpolation and run the tests described below. Different Orders. Letf(x) - arctan(x). Construct polynomial approximations to f(x) forxe[-10,10] Use N 2,4,8,16,32: distribute your N sample points in [-10,10] uniformly, ie, setting (for every N) x,--10+20(n-1)/(N-1), fn=f(xn): n=1, . . . , N. Plot the graphs of the original function and the approximations that you constructed in the same graph for x e [-11,11]. Discuss your observations. Different Point Locations. Consider the same function f(x) = arctan (x). Suppose we just want to use a fifth order polynomial (i.e., N = 6). Is there a way to place the sample points xn, n = 1, , 6 in some optimal way? Try a few possibilities (one of them is the uniform sampling as described above); look at the errors in max-norm, i.e., maxlf(x)-f(x)I, xeI-10,10] , where f(x) is the polynomial approximation that you constructed. Estimate the max-norm error numerically by sampling the value of lf(x) - f(x)| at a sufficiently fine resolution (mesh size about 0.1 should suffice). Plot the graphs of your approximations. Discuss your findings. Recall that Lagrange interpolating polynomial for a set of N points, (nf),-1....,N, is given by p)-p!N-(e), where p!N-)- (N-1) x), where P k+n Write a code that implements polynomial interpolation and run the tests described below. Different Orders. Letf(x) - arctan(x). Construct polynomial approximations to f(x) forxe[-10,10] Use N 2,4,8,16,32: distribute your N sample points in [-10,10] uniformly, ie, setting (for every N) x,--10+20(n-1)/(N-1), fn=f(xn): n=1, . . . , N. Plot the graphs of the original function and the approximations that you constructed in the same graph for x e [-11,11]. Discuss your observations. Different Point Locations. Consider the same function f(x) = arctan (x). Suppose we just want to use a fifth order polynomial (i.e., N = 6). Is there a way to place the sample points xn, n = 1, , 6 in some optimal way? Try a few possibilities (one of them is the uniform sampling as described above); look at the errors in max-norm, i.e., maxlf(x)-f(x)I, xeI-10,10] , where f(x) is the polynomial approximation that you constructed. Estimate the max-norm error numerically by sampling the value of lf(x) - f(x)| at a sufficiently fine resolution (mesh size about 0.1 should suffice). Plot the graphs of your approximations. Discuss your findings

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!