• Non ci sono risultati.

on [−1, 1] for k = 2, 4, 6. As degree of the polynomial of best approximation take n ≤ k.

N/A
N/A
Protected

Academic year: 2022

Condividi "on [−1, 1] for k = 2, 4, 6. As degree of the polynomial of best approximation take n ≤ k."

Copied!
2
0
0

Testo completo

(1)

Master degree course on

Approximation Theory and Applications,

Lab exercises

Prof. Stefano De Marchi

1. Using the chebfun http://www.chebfun.org/examples/approx/BestApprox.html code, remez.m, compute the BPA of f (x) = x

k+1

on [−1, 1] for k = 2, 4, 6. As degree of the polynomial of best approximation take n ≤ k.

Repeat for the function f (x) = sin((2k + 1)x). What do we see?

%--- function [p,err] = remez(f,n); % compute deg n BA to chebfun f

iter = 1; delta = 1; deltamin = delta;

[a,b] = domain(f);

xk = chebpts(n+2); xo = xk; % initial reference sigma = (-1).^[0:n+1]; % alternating signs normf = norm(f);

while (delta/normf > 1e-14) & iter <= 20

fk = feval(f,xk); % function values

w = bary_weights(xk); % compute barycentric weights h = (w*fk)/(w*sigma); % levelled reference error if h==0, h = 1e-19; end % perturb error if necessary pk = fk - h*sigma; % polynomial vals in the p=chebfun(@(x)bary(x,pk,xk,w),n+1); % reference chebfun of trial

e = f - p; % polynomial chebfun of the

[xk,err] = exchange(xk,e,h,2); % error replace reference

if err/normf > 1e5 % if overshoot, recompute with [xk,err] = exchange(xo,e,h,1);% one-point exchange

end xo = xk;

delta = err - abs(h); % stopping value

if delta < deltamin, % store poly with minimal norm deltamin = delta;

pmin = p; errmin = err;

end

iter = iter + 1;

end

p = pmin; err = errmin;

%--- 2. Leja sequences

Definition 1. On [a, b] take the point x1. The point xs∈ [a, b], s = 2, 3, . . . , N s.t.

s−1

Y

k=1

|xs− xk| = max

x∈[a,b]

s−1

Y

k=1

|x − xk| . (1)

is called a Leja sequence for [a, b].

1

(2)

Write a Matlab code that constructs the sequence and then use it for constructing the interpolating polynomial in Newton form of the function f (x) = sin(x) + cos(x), x ∈ [0, π].

2

Riferimenti

Documenti correlati

Voglio dedicare questo sudato lavoro di tesi a tutti coloro che mi sono stati vicino in questi lunghi sette mesi, confortandomi e supportandomi sempre senza perdere mai la fiducia

[r]

The number e is transcendental, that is it does not satisfy any algebraic equation of integer

In this section we briefly outline a disctretization of Lissajous curves that allows one to construct a so-called Hyperinterpolation operator, based on a discrete set of

These formulas are used to construct trivariate hyperinterpolation polynomi- als via a single 1-d Fast Chebyshev Transform (by the Chebfun pack- age), and to compute discrete

Polynomial optimization on suitable grids is a well-known technique, that has been developed for example by uniform rational sampling in the simplex and the hypercube; see, e.g.,

Given a planar compact set Ω where a weakly admissible mesh (WAM) is known, we compute WAMs and the corresponding discrete extremal sets for polynomial interpolation on solid

Sia k il numero di eccedenze strette di 0 (peraltro uguale al numero di eccedenze strette di ). Proseguendo, dopo esattamente k passaggi di mano tutti hanno il loro diploma.