Question: 1. Numerical differentiation and integration via Lagrange interpolation For any function f and n + 1 distinct nodes x0, ,xn, Lagrange interpolation factors f =

 1. Numerical differentiation and integration via Lagrange interpolation For any function

1. Numerical differentiation and integration via Lagrange interpolation For any function f and n + 1 distinct nodes x0, ,xn, Lagrange interpolation factors f = P+ R where and R is the approximation error. The following Matlab function, function a - lagrange_interp(X, Y) a - zeros (1,numel(X)); for i- 1:numel(X) aa - poly (X([1:i-1 i+1:numel(X)])); end represents P(x)--0 -1, , al, ao]; see Worksheet 4. Question 1(a) (a) Understand how the given function lagrange_interp works. Mention a possible disadvantage of expressing a^r* as its coefficients a - [an, an P in terms of its coefficients (b) Write a Matlab function that uses P to approximate fd() for any positive integer d and real number r. The function signature should be function y - num_diff(X, Y, x, d) and should invoke both lagrange_interp (see above) and Matlab's polyder What happens when d equals or exceeds the number of given interpolation nodes (n +1)? (c) Write a Matlab function that uses P to approximate Jo f()dx for any real interval [a, b]. The function signature should be function s - num int (X, Y, a, b) and should invoke lagrange_interp (see above) and Matlab's polyint rounding errors) (d) For both Parts (a) and (b), construct a test problem where you expect the answer to be exact (up to 1. Numerical differentiation and integration via Lagrange interpolation For any function f and n + 1 distinct nodes x0, ,xn, Lagrange interpolation factors f = P+ R where and R is the approximation error. The following Matlab function, function a - lagrange_interp(X, Y) a - zeros (1,numel(X)); for i- 1:numel(X) aa - poly (X([1:i-1 i+1:numel(X)])); end represents P(x)--0 -1, , al, ao]; see Worksheet 4. Question 1(a) (a) Understand how the given function lagrange_interp works. Mention a possible disadvantage of expressing a^r* as its coefficients a - [an, an P in terms of its coefficients (b) Write a Matlab function that uses P to approximate fd() for any positive integer d and real number r. The function signature should be function y - num_diff(X, Y, x, d) and should invoke both lagrange_interp (see above) and Matlab's polyder What happens when d equals or exceeds the number of given interpolation nodes (n +1)? (c) Write a Matlab function that uses P to approximate Jo f()dx for any real interval [a, b]. The function signature should be function s - num int (X, Y, a, b) and should invoke lagrange_interp (see above) and Matlab's polyint rounding errors) (d) For both Parts (a) and (b), construct a test problem where you expect the answer to be exact (up to

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!