# blatt11.pdf

```Florin A. Radu
MAT260: Numerical Algorithms II
Spring semester 2013
11. Sheet of exercises
Exercise 48 Let {pk |k = 0, 1, ...} be an orthogonal system of polynomials
w.r.t. a strictly positive weight function ω on [−1, 1] (with kpk kω 6= 0 for all
k ∈ N). Show that pn has n distinct roots in [−1, 1].
Exercise 49 Let f : R → R be a real valued, periodic function. Consider
the Fourier polynomial given by
fn (x) = a0 + 2
n
X
ak cos(kx) + 2
k=1
n
X
bk sin(kx),
(1)
k=1
1 R 2π
1 R 2π
f
(x)cos(kx)dx
and
b
:=
f (x)sin(kx)dx.
k
2π 0
2π 0
Consider the functions
with ak :=
a) f (x) = |x|, x ∈ [−π, π) and f (x + 2π) = f (x) for all x ∈ R.
b) f (x) = x2 , x ∈ [0, 2π) and f (x + 2π) = f (x) for all x ∈ R.
i) Compute in each case the Fourier coefficients ak and bk .
ii) Implement the polynomials fn for n = 3, 5, 7 and 9. Plot the polynomials
and the function (for each function separately) in the same plot for every n.
iii) Show that the following series is convergent and compute its limit:
∞
X
1
.
k2
k=1
Exercise 50 i) Write a matlab program to compute the coefficients (ak , bk )
of the system of polynomials as given in the recursive formula
pk+1 := (x − ak )pk − bk pk−1
hxpk , pk i
hxpk , pk−1 i
and bk =
, b0 arbitrarly, and
hp
hpk−1 , pk−1 i
R 1k , pk i
:= 0. hf, gi := −1 f (x)g(x)dx.
for all k ≥ 0, where ak =
p0 := 1, p−1
1
ii) Write a Matlab program to compute the Jacobi matrix Jn associated with
the polynomial pn , i.e.


√
a
b
0
.
.
.
.
.
.
0
1
 √b1 a1 √b2

0
...


Jn =  ..
.
 .

p
bn−1 an−1
0
...
0
iii) Write a Matlab program to compute the nodes and the weights of the
Gauss quadrature for 2, 3 and 4 points (i.e. n = 1, 2 or 3 and the roots
are given by the eigenvalues of J2 , J3 and J4 respectively) associated with the
system of polynomial defined above. Use the Matlab command eig to get the
eigenvalues.
R1
R1
iv) Compute the integrals I1 = −1 ex dx and I2 = −1 x2 ex dx by using the
values of the integrals and with approximation by using the trapezoidal rule.
v) Compute for n = 1, 2 or 3 and f (x) = ex the polynomial fn∗ which is the
discrete approximation of the Fouries polynomial fn obtained by using the
(n + 1) - points Gauss quadrature associated with the system of polynomials
defined above. Plot the function and the obtained polynomial approximations
in one plot.
2
```