Вы находитесь на странице: 1из 3

T0

Numerical Analysis 2, lecture 5:

Chebyshev polynomials

!1

Chebyshev polynomials
are defined by a three-term recursion

T0

!1

Tn+1 (x) = 2xTn (x) ! Tn!1 (x) (n = 1, 2,)

T1

(textbook sections 9.7 & 9.9)

T1

T2 (x) = 2x 2 ! 1, T3 (x) = 4 x 3 ! 3x, T4 (x) = 8x 4 ! 8x 2 + 1,

LS approximation
interpolation
minimax approximation

T2

T2

Basic facts
degTn = n

T3

T2n is an even function, T2n+1 is an odd function


1-n

T0 (x) = 1, Tn (x) = 2

T4

T3

Tn (x) (for n ! 1) are monic polynomials

Clenshaws algorithm (exercise E5)


n

" ckTk (x) = u0 ! xu1 where un = cn ,

k =0

T4
un!1 = cn!1 + 2xun ,

and u j = c j + 2xu j +1 ! u j +2 for j = n ! 2, n ! 1, , 0.


Numerical Analysis 2, lecture 5, slide! 2

A change of variables converts a Chebyshev


polynomial into a trigonometric polynomial

Chebyshev polynomials can be used


for least-squares approximation

example (p. 272, modified)

Tn (x) = cos(n arccos x) (!1 " x " 1)

Find the polynomial p of degree ! 2 that minimizes

"1

! n

max Tn (x) = 1
2i ! 1
" ) (i = 1, 2,, n)
2n

k
Tn ( x! k ) = 1 at x! k = cos( ! ) (k = 0,1, 2,, n)
n
1

!1

2 !1 2

1 " x2

c0 = 0, c2 = 0, c1 =

!1" x"1

" (1 ! x

( p(x) " sin(# x 2))2 dx

Solution: p(x) = c0T0 (x) + c1T1 (x) + c2T2 (x)

more basic facts

the n zeros of Tn are cos(

%'0
T j (x)Tk (x) dx = &$ 2
'($

j#k
j=k#0
j=k=0

T0 (x) = 1, T1 (x) = x,

( f ,T1 )
1
x " sin(! x 2)
=
$ 1 # x 2 dx = 2J1(! 2) % 1.1336
(T1,T1 ) ! 2 #1

0.15

Chebyshev nodes
f (x) ! c1T1 (x)

extrema
0

orthogonality
!0.15
!1
Numerical Analysis 2, lecture 5, slide! 3

1
Numerical Analysis 2, lecture 5, slide! 4

Chebyshev nodes are good for interpolation

Interpolation with Chebyshev nodes


is easily computed in Matlab

polynomial interpolation error

>>
>>
>>
>>
>>
>>
>>

1
! P( x)
=
f ( x)
( x ! x0 )( x ! x1 )!( x ! xn ) f (n+1) (" )
(n + 1)!

max f (x) ! P(x) "

!1" x"1

1
max (x ! x0 )(x ! x1 )!(x ! xn ) max f (n+1) (x)
!1" x"1
(n + 1)! !1" x"1

" 2 j +1 %
x j = cos $
!
# 2n + 2 '&

max f (x) ) P(x) *

)1* x*1

2 )n
max f (n+1) (x)
(n + 1)! )1* x*1

f = @(x) 1./(1+25*x.^2);
n = 11;
xe = linspace(-1,1,n);
xc = cos((2*(1:n)-1)*pi/2/n);
t = -1:.01:1;
plot(t,f(t),'b',t,neville(xe,f(xe),t),'r',xe,f(xe),o)
plot(t,f(t),'b',t,neville(xc,f(xc),t),'r',xc,f(xc),o)

waterbed theorem p.286


For any monic polynomial p of degree n + 1,
0
!1

max p(x) # max 2 !n Tn+1 (x) = 2 !n

!1" x"1

!1" x"1

0
!1

Numerical Analysis 2, lecture 5, slide! 5

Numerical Analysis 2, lecture 5, slide! 6

Chebyshev-node interpolant
can be computed using Clenshaws formula

theorem (thm 9.8.1, page 288)

Chebyshev interpolation with Clenshaws


formula is easily computed in Matlab

orthogonality

%'0
2i ! 1
If xi = cos(
" ) (i = 1, 2,, n + 1), then # T j ( xi ) Tk ( xi ) = &(n + 1) 2
2n + 2
i=1
('n + 1
zeros of Tn+1
n+1

for 0 ) j, k ) n, and the polynomial p of degree m that minimizes

n+1

i=1

is p(x) =

m
1 n+1
2 * n+1
f (xi ) + #
#
# Tk (xi ) f (xi )/.Tk (x).
n + 1 i=1
n + 1 ,+ i=1
k
=1
!#
#"##
$
!###"###$
c0

m=n

interpolation

ck

0.15

example
2 3
sin( 3 ! 4)x " 1.129x
3

function u = chebpolval(c,x)
n = length(c);
u = c(n)*ones(size(x));
if n > 1
ujp1 = u;
u = c(n-1) + 2*x*c(n);
for j = n-2:-1:1
ujp2 = ujp1;
ujp1 = u;
u = c(j) + 2*x.*ujp1 - ujp2;
end
u = u - x.*ujp1;
end

function [c,x] = chebpolfit(fname,n)


x = cos((2*(1:n)'-1)*pi/2/n);
y = feval(fname,x);
T = [zeros(n,1) ones(n,1)];
c = [sum(y)/n zeros(1,n-1)];
a = 1;
for k = 2:n
T = [T(:,2) a*x.*T(:,2)-T(:,1)];
c(k) = sum( T(:,2) .* y)*2/n;
a = 2;
end

j$k
j=k$0
j=k=0

# ( p(xi ) ! f (xi ))

interpolates sin(! x 2) at 3 2, 0 .
!0.15
!1

Numerical Analysis 2, lecture 5, slide! 7

>>
>>
>>
>>

f = @(x) 1./(1+25*x.^2);
0
[c,x] = chebpolfit(f,11);
!1
t = -1:.01:1;
plot(t,f(t),'b',t,chebpolval(c,t),'r',x,f(x),'ok')

Numerical Analysis 2, lecture 5, slide! 8

The Chebyshev interpolant is almost


the best minimax approximation

minimax approximation
Find a polynomial p of degree ! n that minimizes max p(x) " f (x)

The minimax approximation can be computed


using the alternation principle

approx. of monotone function by straight line

a! x!b

Weierstrasss theorem
min
max p(x) " f (x) # 0 for any continuous f
!####"####$

deg( p)!n "1! x!1

En ( f )

2 -1/2

Least-squares approximation, w=(1-x )


max f (x) !

!1" x"1

+ log n) $ E ( f )
# c jT j (x) < (4
!#"#$ n
j =0

n=20

%
% 2 j +1 ((
1 n
max f (x) ! # c j T j (x) < ' 1 +
# tan &' 4(n + 1) $ )* * + En ( f )
!1" x"1
n
+
1
&
)
j =0
j =0
!#####"#####$
n

!4

Numerical Analysis 2, lecture 5, slide! 9

what happened, whats next

Chebyshev polynomials satisfy a 3-term recurrence


and are orthogonal in two ways

-nT

is the monic polynomial with

smallest weighted continuous 2-norm


smallest discrete maxnorm (with nodes at zeros of Tn+1)

almost minimax :

example (p. 300-301)

weighted continuous LS approximation


interpolation with zeros of Tn (= discrete LS approx. at zeros of Tn+1)

minimax approximation is a nonlinear problem


Next: Boundary Value Problems (10.8, 10.9, 10.11)
Numerical Analysis 2, lecture 5, slide! 11

Find p(x) = c0 + c1x


that minimizes

max p(x) " sin(# x 2)

0! x!1

!7

Chebyshev-node interpolation

n=20

Error extrema should be at end points and at an interior point.

!c0 = d
sin("# 2) ! c0 ! c1# = !d
1 ! c0 ! c1 = d
"
2

cos("# 2) ! c1 = 0

$
&
&
&
%
&
&
&'

c1 = 1

! = 0.5607
c0 = 0.1053
d = "0.1053
Numerical Analysis 2, lecture 5, slide! 10

Вам также может понравиться