Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We proved in class that where pn is the interpolating polynomial of f at the nod

ID: 3183828 • Letter: W

Question

We proved in class that where pn is the interpolating polynomial of f at the nodes zo,... , Tn, pf is the best approximation of f, in the supremum (infinity) norm, by a polynomial of degree at most n, and An is the Lebesgue constant, i.e. An- Ln |oo, where (a) Write a computer code to evaluate the Lebesgue function (2) associated to a given set of pairwise distinct nodes co,... ,^, (b) Consider the equidistributed points x,--1+3(2/n) for j = 0, . . . , n. Write a com- puter code that uses (a) to evaluate and plot Ln(x) (evaluate Ln(r) at a large number of points Ck to have a good plotting resolution, e.g. Tk--1+ k(2/ne), k -0,...,ne, with ne 1000) for n -4, 10, and 20. Estimate An for these three values of n. (c) Repeat (b) for the Chebyshev nodes ay-cos( ), j 0 , n. Contrast the behavior of L (x) and An with those corresponding to the equidistributed points in

Explanation / Answer

function [L,Lconst] = lebesgue(x,varargin) % L = LEBESGUE(X), where X is a set of points in [-1,1], % returns the Lebesgue function associated with polynomial % interpolation in those points. % % L = LEBESGUE(X,D), where D is a domain and X is a set of points % in D, returns the Lebesgue function associated with polynomial % interpolation in those points in that domain. % % L = LEBESGUE(X,a,b) or LEBESGUE(X,[a,b]) does the same with % D = domain(a,b). % % [L,Lconst] = LEBESGUE(X) etc. also returns the Lebesgue constant. % % For example, these commands compare the Lebesgue functions and % constants for 8 Chebyshev, Legendre, and equispaced points in [-1,1]: % % n = 8; % [L,c] = lebesgue(chebpts(n)); % subplot(1,3,1), plot(L), title(['Chebyshev: ' num2str(c)]) % grid on, axis([-1 1 0 8]) % [L,c] = lebesgue(legpts(n)); % subplot(1,3,2), plot(L), title(['Legendre: ' num2str(c)]) % grid on, axis([-1 1 0 8]) % [L,c] = lebesgue(linspace(-1,1,n)); % subplot(1,3,3), plot(L), title(['Equispaced: ' num2str(c)]) % grid on, axis([-1 1 0 8]) if nargin==1 d = [-1,1]; elseif nargin==2 d = varargin{1}; if isa(d,'domain'), d = d.ends; end elseif nargin==3 d = [varargin{1},varargin{2}]; else error('CHEBFUN:lebesgue:inputs','Wrong number of arguments in lebesgue'); end % barycentric weights w = bary_weights(x); % set preferences pref = chebfunpref; pref.sampletest = false; pref.maxdegree = length(x)-1; pref.minsamples = min(pref.minsamples,pref.maxdegree); % ill-conditioned computations may prevent convergence to high accuracy. warnstate = warning('off','CHEBFUN:auto'); % Lebesgue function (breakpoints at interpolation nodes) L = chebfun(@(t) lebfun(t,x(:),w), unique([x(:);d.']), pref); warning(warnstate) % Lebesgue constant if nargout==2, Lconst = norm(L,inf); end function L = lebfun(t,xk,w) % Lebesgue function: xk are nodes, w are weights, t evaluation points % Based on barycentric formula. L = ones(size(t)); % Note: L(xk) = 1 mem = ismember(t,xk); for i = 1:numel(t) if ~mem(i) xx = w./(t(i)-xk); L(i) = sum(abs(xx))/abs(sum(xx)); end end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote