Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needs to build and run wil rate! 1. Numerical differentiation and integration via Lagrange interpolation For any function f and n+1 distinct nodes co, ,

Needs to build and run

wil rate!

image text in transcribed

1. Numerical differentiation and integration via Lagrange interpolation For any function f and n+1 distinct nodes co, , Vn, Lagrange interpolation factors f- P+ R where Tt 72 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)])); a-a+ Y(i) * aa / polyval (aa, X (i)); end represents P(x) :0 akat as its coefficients a-[an, an-1, , al, ao ; see Worksheet 4. Question 1(a) (a) Understand how the given function lagrange_interp works. Mention a possible disadvantage of expressing P in terms of its coefficients (b) Write a Matlab function that uses P to approximate f(x) for any positive integer d and real number x. 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 So f(x)da 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 co, , Vn, Lagrange interpolation factors f- P+ R where Tt 72 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)])); a-a+ Y(i) * aa / polyval (aa, X (i)); end represents P(x) :0 akat as its coefficients a-[an, an-1, , al, ao ; see Worksheet 4. Question 1(a) (a) Understand how the given function lagrange_interp works. Mention a possible disadvantage of expressing P in terms of its coefficients (b) Write a Matlab function that uses P to approximate f(x) for any positive integer d and real number x. 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 So f(x)da 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

Define pay equity.

Answered: 1 week ago

Question

List out some inventory management techniques.

Answered: 1 week ago