Docsity

Exercise Session 2: Linear Algebra & Geometry - Function Approximation & Interpolation - P, Esercizi di Algebra Lineare e Geometria Analitica

Toggle sidebar
bg1
Linear Algebra and Geometry - Scientific Computing
Exercise session 2
Topics: data and functions approximation
1. Find polynomials of degree n= 5,9,13 interpolating the Runge function f(x) = 1/(1 + x2) at equally
spaced nodes in the interval [−5,5]. Graphically represent the Runge Function, the interpolating
polynomials and interpolation data. Repeat the exercise using Chebyshev nodes:
ti=−cos (2i−1)π
2(n+ 1) , i = 1, ..., n + 1
defined on the interval [−1,1] properly scaled in the generic interval [a, b] by means of the change
of variable xi=b−a
2ti+b+a
2. Which of the two choices of nodes leads to an increasingly accurate
approximation as the polynomial degree goes up?
2. Approximate with interpolating polynomials of degree n= 5,10,15 the following functions:
f1(x) = sin(x),over [0, π],
f2(x) = 1
1 + x2,over [−2π, 2π].
Use both equally spaced and Chebyshev-Lobatto nodes:
ti=−cos (i−1)π
n), i = 1,..., n + 1
properly scaled in the interval of interest. For each ngraphically represent the interpolation absolute
error at 100 equally spaced points in the considered interval and print the maximum absolute error.
For each function compare the graphs reporting the error of the two sets of nodes and deduce tre most
advantageous choice of nodes.
3. Graphically represent the not-a-knot cubic spline interpolating f(x)=1/(1 + x2) over 6, 10, 14 equally
spaced nodes in the interval [−5,5]. Compare the graphs with the ones of Exercise 1 and comment the
results.
4. Use the Matlab function spline to construct cubic splines:
S3(x) fulfilling not-a-knot condition,
¯
S3(x) fulfilling ¯
S0
3(x0) = f0(x0) and ¯
S0
3(xn) = f0(xn)
interpolating f(x) = (1 −x2)5/2over the nodes xi=−1+2i/n,i= 0,1, ..., n,n= 2k,k= 2,3,4,5.
Graphically represent interpolation errors linked to S3(x) and ¯
S3(x) at 100 equally spaced points in
the interpolation interval [−1,1]. Find which of the two gives more accurate result. Print maximum
absolute error for each value of kand deduce which of the two approximations is more accurate (justify
your answer).
5. According to the air quality database of Regione Piemonte, on November 13, 2015 the control unit
placed near Lingotto, detected the following nitrous oxides concentration in the air (micrograms/cubic
meters) at hourly intervals starting from 13:00 untill 8:00 of next day. Find an approximation of nitrous
oxides concentration levels at 14:30 and at 7:30 by means of linear spline.
1
pf2

Anteprima parziale del testo

Scarica Exercise Session 2: Linear Algebra & Geometry - Function Approximation & Interpolation - P e più Esercizi in PDF di Algebra Lineare e Geometria Analitica solo su Docsity!

Linear Algebra and Geometry - Scientific Computing

Exercise session 2

Topics: data and functions approximation

  1. Find polynomials of degree n = 5, 9 , 13 interpolating the Runge function f (x) = 1/(1 + x^2 ) at equally spaced nodes in the interval [− 5 , 5]. Graphically represent the Runge Function, the interpolating polynomials and interpolation data. Repeat the exercise using Chebyshev nodes:

ti = −cos

(2i − 1)π 2(n + 1)

, i = 1, ..., n + 1

defined on the interval [− 1 , 1] properly scaled in the generic interval [a, b] by means of the change of variable xi = b− 2 ati + b+ 2 a. Which of the two choices of nodes leads to an increasingly accurate approximation as the polynomial degree goes up?

  1. Approximate with interpolating polynomials of degree n = 5, 10 , 15 the following functions:

f 1 (x) = sin(x), over [0, π],

f 2 (x) =

1 + x^2

, over [− 2 π, 2 π].

Use both equally spaced and Chebyshev-Lobatto nodes:

ti = −cos

(i − 1)π n)

, i = 1, ..., n + 1

properly scaled in the interval of interest. For each n graphically represent the interpolation absolute error at 100 equally spaced points in the considered interval and print the maximum absolute error. For each function compare the graphs reporting the error of the two sets of nodes and deduce tre most advantageous choice of nodes.

  1. Graphically represent the not-a-knot cubic spline interpolating f (x) = 1/(1 + x^2 ) over 6, 10, 14 equally spaced nodes in the interval [− 5 , 5]. Compare the graphs with the ones of Exercise 1 and comment the results.
  2. Use the Matlab function spline to construct cubic splines:

S 3 (x) fulfilling not-a-knot condition,

S¯ 3 (x) fulfilling S¯ 3 ′(x 0 ) = f ′(x 0 ) and S¯ 3 ′(xn) = f ′(xn)

interpolating f (x) = (1 − x^2 )^5 /^2 over the nodes xi = −1 + 2i/n, i = 0, 1 , ..., n, n = 2k, k = 2, 3 , 4 , 5. Graphically represent interpolation errors linked to S 3 (x) and S¯ 3 (x) at 100 equally spaced points in the interpolation interval [− 1 , 1]. Find which of the two gives more accurate result. Print maximum absolute error for each value of k and deduce which of the two approximations is more accurate (justify your answer).

  1. According to the air quality database of Regione Piemonte, on November 13, 2015 the control unit placed near Lingotto, detected the following nitrous oxides concentration in the air (micrograms/cubic meters) at hourly intervals starting from 13:00 untill 8:00 of next day. Find an approximation of nitrous oxides concentration levels at 14:30 and at 7:30 by means of linear spline.

hour nitrous oxides hour nitrous oxides 1 243 11 138 2 209 12 95 3 181 13 56 4 179 14 32 5 180 15 21 6 166 16 12 7 163 17 11 8 157 18 61 9 187 19 146 10 192 20 186