Chebyshev Approximation - Numerical Analysis - Project 4 | MCS 471, Study Guides, Projects, Research of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Project; Class: Numerical Analysis; Subject: Mathematical Computer Science; University: University of Illinois - Chicago; Term: Fall 2005;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 07/22/2009

koofers-user-toq
koofers-user-toq 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MCS 471 Project Four due Wednesday 16 November, 3PM Fall 2005
MCS 471 Project Four: Chebyshev Approximations
The goal of this project is to study the use of Chebyshev polynomials to approximate functions. We will
use Maple in our investigations. Maple 9.5 is available in the computer labs on campus. To start working
on the project, download the companion Maple worksheet from the web pages for this course.
0. Chebyshev Series in Maple
The Chebyshev polynomials form an orthogonal basis with respect to the inner product
hf, gi=2
πZ+1
1
f(x)g(x)
1x2dx. (1)
For example, we have hTi, Tji= 0 for i6=j.
In this project we will use truncated Chebyshev series to approximate functions. A Chebyshev approx-
imation is a polynomial p(x) of degree nof the form
p(x) = a0
2+
n
X
i=1
aiTi(x),with ai=hp, Tii,for i= 0,1, . . . , n. (2)
The division by 2 of a0is made for a0=hp, T0ito hold. Geometrically, the coefficients aiare the coordinates
of pin the basis Ti,i= 0,1,...,n.
To compute a least squares approximation of any function fwith a Chebychev approximation pof
degree n, we project the function fonto the basis, computing the coordinates of the approximation via
the inner products of fwith the basis elements Ti,i= 0,1,...,n. The truncation of a Chebyshev series
expansion for fleads to a least squares approximation p.
f(x) = c0
2+
X
i=1
ciTi(x) = p(x) +
X
i=n+1
ciTi(x),with ci=hf, Tii,for i= 0,1, . . . , n. (3)
By construction, we see that the error fpis perpendicular to the basis Ti,i= 0,1, . . . , n, as is typical
for least squares approximations.
The Chebyshev polynomials are available as the procedure Tin the package orthopoly. The sequence
of commands below documented by the companion Maple worksheet on the web defines 3 func-
tions: num ip for the inner product, num prj for the projection operation, and chb for the creation of the
Chebyshev approximation.
[> with(orthopoly,T):
[> num_ip := (f,g) -> evalf(Int(f*g/sqrt(1-x^2),x=-1..1)*2/Pi);
[> num_prj := (f,n) -> seq(num_ip(f,T(i,x)),i=0..n);
[> c := num_prj(exp(x),4);
[> chb := c -> c[1]/2 + sum(c[i]*T(i-1,x),i=2..nops(c));
[> cp := chb([c]);
The polynomial cp is a truncated Chebyshev series, the following commands are plots and checks:
[> plot_f := plot(exp(x),x=-1..1,color=black):
[> plot_p := plot(cp,x=-1..1,color=red):
[> plots[display](plot_f,plot_p);
[> e := exp(x) - cp; # error of the approximation
[> num_prj(e,4); # verifies that e is perpendicular to the basis
[> plot(e,x=-1..1); # plots show typical oscillations
University of Illinois at Chicago, Department of Mathematics, Statistics and Computer Science page 1
pf2

Partial preview of the text

Download Chebyshev Approximation - Numerical Analysis - Project 4 | MCS 471 and more Study Guides, Projects, Research Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

MCS 471 Project Four due Wednesday 16 November, 3PM Fall 2005

MCS 471 Project Four: Chebyshev Approximations

The goal of this project is to study the use of Chebyshev polynomials to approximate functions. We will use Maple in our investigations. Maple 9.5 is available in the computer labs on campus. To start working on the project, download the companion Maple worksheet from the web pages for this course.

0. Chebyshev Series in Maple

The Chebyshev polynomials form an orthogonal basis with respect to the inner product

〈f, g〉 =

π

− 1

f (x)g(x) √ 1 − x^2

dx. (1)

For example, we have 〈Ti, Tj 〉 = 0 for i 6 = j. In this project we will use truncated Chebyshev series to approximate functions. A Chebyshev approx- imation is a polynomial p(x) of degree n of the form

p(x) =

a 0 2

∑^ n

i=

aiTi(x), with ai = 〈p, Ti〉, for i = 0, 1 ,... , n. (2)

The division by 2 of a 0 is made for a 0 = 〈p, T 0 〉 to hold. Geometrically, the coefficients ai are the coordinates of p in the basis Ti, i = 0, 1 ,... , n. To compute a least squares approximation of any function f with a Chebychev approximation p of degree n, we project the function f onto the basis, computing the coordinates of the approximation via the inner products of f with the basis elements Ti, i = 0, 1 ,... , n. The truncation of a Chebyshev series expansion for f leads to a least squares approximation p.

f (x) =

c 0 2

∑^ ∞

i=

ciTi(x) = p(x) +

∑^ ∞

i=n+

ciTi(x), with ci = 〈f, Ti〉, for i = 0, 1 ,... , n. (3)

By construction, we see that the error f − p is perpendicular to the basis Ti, i = 0, 1 ,... , n, as is typical for least squares approximations. The Chebyshev polynomials are available as the procedure T in the package orthopoly. The sequence of commands below — documented by the companion Maple worksheet on the web — defines 3 func- tions: num ip for the inner product, num prj for the projection operation, and chb for the creation of the Chebyshev approximation.

[> with(orthopoly,T): [> num_ip := (f,g) -> evalf(Int(fg/sqrt(1-x^2),x=-1..1)2/Pi); [> num_prj := (f,n) -> seq(num_ip(f,T(i,x)),i=0..n); [> c := num_prj(exp(x),4); [> chb := c -> c[1]/2 + sum(c[i]*T(i-1,x),i=2..nops(c)); [> cp := chb([c]);

The polynomial cp is a truncated Chebyshev series, the following commands are plots and checks:

[> plot_f := plot(exp(x),x=-1..1,color=black): [> plot_p := plot(cp,x=-1..1,color=red): [> plots[display](plot_f,plot_p); [> e := exp(x) - cp; # error of the approximation [> num_prj(e,4); # verifies that e is perpendicular to the basis [> plot(e,x=-1..1); # plots show typical oscillations

University of Illinois at Chicago, Department of Mathematics, Statistics and Computer Science page 1

MCS 471 Project Four due Wednesday 16 November, 3PM Fall 2005

1. The Accuracy of the Chebyshev Approximations

In the example above we have seen that already with a fourth degree polynomial we obtain a very accurate approximation for exp(x). The purpose of the next assignment is to verify the decrease in coefficient size as the degree of the approximation increases.

Assignment One. Compute Chebyshev approximations for exp(x) with polynomials of degree n, for

n ranging from 4 to 13. Make a table with two columns: first the degree n, and then the highest degree coefficient of p, in scientific format with four significant decimal places. Describe the relationship between the degree n and the magnitude of the highest degree coefficient of p.

2. Chebyshev Approximations over General Intervals

While we use the standard interval [− 1 , +1], we can compute Chebyshev approximations over any finite interval. The purpose of the next assignment is that you figure out a coordinate transformation which maps t ∈ [a, b] (for −∞ < a < b < ∞) to x ∈ [− 1 , +1] so that we can approximate functions f (t), for t ∈ [a, b].

Assignment Two. Compute a Chebyshev approximation for exp(x) over the interval [1, 5] with a

degree n high enough so the error is below 1e-6 everywhere on the interval [1, 5]. Verify the least squares property of the solution.

3. Chebyshev Approximations of Periodic Functions

As the Chebyshev polynomials are defined via the cosine, we could expect Chebyshev approximations to be very suitable to approximate periodic functions.

Assignment Three. Consider f (x) = 4sin(2πx) + 3sin(5πx) over the interval [− 1 , +1]. Compute

a Chebyshev approximation with a degree high enough so the error is below 1.0e-6 everywhere on the interval [− 1 , +1]. Describe the quality of the approximation. In particular, describe its quality when we replace every sin() in f (x) by cos().

4. Chebyshev Approximations for Discontinuous Functions

If the function we approximate has a discontinuous jump somewhere inside the interval [− 1 , +1], does the Chebyshev approximation then converge as the degrees increase? The purpose of the next assignment is to find out.

Assignment Four. Consider the function f defined as follows: f (x) =

− 1 if x < 0 0 if x = 0 +1 if x > 0. Compute Chebyshev approximations for increasing degrees and observe the behavior of the error function. Can you get the error as low as you like?

5. The deadline is Wednesday 16 November 2005 at 3PM

Bring your solution to the project to class. The your is emphasized to stress that your solution is the result of an individual effort. Collaborations are not permitted. Your solution should contain the following:

  1. Please write complete grammatically correct sentences.
  2. Tables summarizing the numerical experiments you have done.
  3. A print out of the Maple worksheet to show the set up of your calculations may be included as an appendix. Suppress long output with colons. Do not eMail me Maple worksheets. Also, summarize your calculations, it is not necessary to print out every single case you computed. If you have questions or difficulties with the assignments, feel free to come to my office for help.

University of Illinois at Chicago, Department of Mathematics, Statistics and Computer Science page 2