Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions