Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.
-
Upload
david-arnold -
Category
Documents
-
view
217 -
download
0
Transcript of Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.
![Page 1: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/1.jpg)
Lecture 17 - Approximation Lecture 17 - Approximation MethodsMethods
CVEN 302
July 17, 2002
![Page 2: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/2.jpg)
Lecture’s GoalsLecture’s Goals
• Discrete Least Square Approximation(cont.)
– Nonlinear
• Continuous Least Square– Orthogonal Polynomials– Gram Schmidt -Legendre Polynomial– Tchebyshev Polynomial– Fourier Series
![Page 3: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/3.jpg)
Nonlinear Least Squared Nonlinear Least Squared Approximation MethodApproximation Method
How would you handle a problem, which is modeled as:
ax
a
b
or
b
ey
xy
![Page 4: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/4.jpg)
Nonlinear Least Squared Nonlinear Least Squared Approximation MethodApproximation Method
Take the natural log of the equations
xy
xyxy
ab
ln ablnlnb a
xy
xyey
ab
ablnlnb ax
and
![Page 5: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/5.jpg)
Least Square Fit Least Square Fit ApproximationsApproximations
Suppose we want to fit the data set.
Nonlinear Data Fit
0
2
4
6
8
10
12
0 2 4 6 8 10
X Values
Y V
alu
es
Data
x Data0.2 9.910.8 8.181.6 6.332.8 4.314.2 2.758 0.82
![Page 6: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/6.jpg)
Linear Least Square Linear Least Square ApproximationsApproximations
x Data x2 xy ln(y) x ln(y) N0.2 9.91 0.04 1.982 2.293544 0.458709 10.8 8.18 0.64 6.544 2.101692 1.681354 11.6 6.33 2.56 10.128 1.8453 2.95248 12.8 4.31 7.84 12.068 1.460938 4.090626 14.2 2.75 17.64 11.55 1.011601 4.248724 18 0.82 64 6.56 -0.19845 -1.58761 1
17.6 32.3 92.72 48.832 8.514625 11.84429 6
baxy Use:
![Page 7: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/7.jpg)
Least Square Fit Least Square Fit ApproximationsApproximations
We would like to find the best straight line to fit the data?
Nonlinear Data Fit
0
2
4
6
8
10
12
0 2 4 6 8 10
X Values
Y V
alu
es
Linear
Data
y = -1.11733x + 8.66608
![Page 8: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/8.jpg)
Nonlinear Least Square Nonlinear Least Square ApproximationsApproximations
x Data x2 xy ln(y) x ln(y) N0.2 9.91 0.04 1.982 2.293544 0.458709 10.8 8.18 0.64 6.544 2.101692 1.681354 11.6 6.33 2.56 10.128 1.8453 2.95248 12.8 4.31 7.84 12.068 1.460938 4.090626 14.2 2.75 17.64 11.55 1.011601 4.248724 18 0.82 64 6.56 -0.19845 -1.58761 1
17.6 32.3 92.72 48.832 8.514625 11.84429 6
axbeyUse:
![Page 9: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/9.jpg)
Nonlinear Least Square Nonlinear Least Square ExampleExample
356492.2
6.1772.926
84429.116.17514625.872.92b
31956.0
6.1772.926
514625.86.1784429.116a
2
2
The equation is:
Nonlinear Data Fit
0
2
4
6
8
10
12
0 2 4 6 8 10
X Values
Y V
alu
es
Natural Log
Data
xy
xy 0.31965 e 55386.10
31965.0356492.2
![Page 10: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/10.jpg)
Nonlinear Least Square Nonlinear Least Square ApproximationsApproximations
abxy Use:
x Data x2 xy lnx (ln x2) ln(y) x ln(y) lnx lny N0.2 9.91 0.04 1.982 -1.60944 2.59029 2.293544 0.458709 -3.69132 10.8 8.18 0.64 6.544 -0.22314 0.049793 2.101692 1.681354 -0.46898 11.6 6.33 2.56 10.128 0.470004 0.220903 1.8453 2.95248 0.867298 12.8 4.31 7.84 12.068 1.029619 1.060116 1.460938 4.090626 1.50421 14.2 2.75 17.64 11.55 1.435085 2.059468 1.011601 4.248724 1.451733 18 0.82 64 6.56 2.079442 4.324077 -0.19845 -1.58761 -0.41267 1
17.6 32.3 92.72 48.832 3.181568 10.30465 8.514625 11.84429 -0.74972 6
![Page 11: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/11.jpg)
Nonlinear Least Square Nonlinear Least Square ApproximationsApproximations
The exponential approximation fits the data.
The power approximation does not fit the data.
Nonlinear Data Fit
0
2
4
6
8
10
12
0 2 4 6 8 10
X Values
Y V
alu
es
Linear
Natural Log
Pow er
Data
![Page 12: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/12.jpg)
Continuous Least Square Continuous Least Square FunctionsFunctions
Instead of modeling a known complex function over a region, we would like to model the values with a simple polynomial. This technique uses a least squares over a continuous region.
The coefficients of the polynomial can be determined using same technique that was used in discrete method.
![Page 13: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/13.jpg)
Continuous Least Square Continuous Least Square FunctionsFunctions
The technique minimizes the error of the function uses an integral.
where
dxxsxfE b
a
2
2210 xaxaaxf
![Page 14: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/14.jpg)
Continuous Least Square Continuous Least Square FunctionsFunctions
Take the derivative of the error with respect to the coefficients and set it equal to zero.
And compute the components of the coefficient matrix. The right hand side of the matrix will be the function we are modeling times a x value.
0 2
i
b
ai
dx
da
xdfxsxf
da
dE
![Page 15: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/15.jpg)
Continuous Least Square Continuous Least Square Function ExampleFunction Example
Given the following function:
Model the function with a quadratic polynomial.
2xs x xe
2210 xaxaaxf
from 0 to 1
![Page 16: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/16.jpg)
Continuous Least Square Continuous Least Square Function ExampleFunction Example
The integral for the error is:
122 2
0 1 2
0
12 2
0 1 20 0
1 1 1 12 2
0 1 2
0 0 0 0
2 1 0
x
x
x
E x a a x a x xe dx
dE xa a x a x xe dx
da
a dx a x dx a x dx xe dx
![Page 17: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/17.jpg)
Continuous Least Square Continuous Least Square Function ExampleFunction Example
The integral for the components are:1
0 0
0
11
1
0
12 2
2
0
2
3
a dx a
aa x dx
aa x dx
![Page 18: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/18.jpg)
Continuous Least Square Continuous Least Square Function ExampleFunction Example
The coefficient matrix becomes:
1
0
23
1
0
22
1
0
2
2
1
0
5
1
4
1
3
14
1
3
1
2
13
1
2
11
dxex
dxex
dxxe
a
a
a
x
x
x
![Page 19: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/19.jpg)
Continuous Least Square Continuous Least Square Function ExampleFunction Example
The right-hand side of the equation becomes:
2986.1
5973.1
0973.2
38
1
14
1
14
1
2
2
2
1
0
23
1
0
22
1
0
2
e
e
e
dxex
dxex
dxxe
x
x
x
![Page 20: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/20.jpg)
Continuous Least Square Continuous Least Square Function ExampleFunction Example
Continuous Least Squared Fit
0
1
2
3
4
5
6
7
8
0 0.5 1 1.5
X Value
Y V
alu
ePolynomial
Exact
The function becomes :
f(x) = 0.3328 -2.5806x
+ 9.1642x2
![Page 21: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/21.jpg)
Continuous Least Square Continuous Least Square FunctionFunction
There are other forms of equations, which can be used to represent continuous functions. Examples of these functions are
• Legrendre Polynomials
• Tchebyshev Polynomials
• Cosines and sines.
![Page 22: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/22.jpg)
Legendre PolynomialLegendre Polynomial
The Legendre polynomials are a set of orthogonal functions, which can be used to represent a function as components of a function.
xPaxPaxPaxf nn1100
![Page 23: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/23.jpg)
Legendre PolynomialLegendre Polynomial
These function are orthogonal over a range [ -1, 1 ]. This range can be scaled to fit the function. The orthogonal functions are defined as:
j i if 0
j i if #
1
1
ji dxxPxP
![Page 24: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/24.jpg)
Legendre PolynomialLegendre Polynomial
The Legendre functions are:
33
n nn2
n n n
3P x x x
5
1 dP x 1-x
2 n! dx
0
1
22
P x 1
P x x
1P x x
3
![Page 25: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/25.jpg)
Legendre PolynomialLegendre Polynomial
How would you work with a least square fit of a function.
dxxsxPaxPaxPaE21
1
221100
![Page 26: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/26.jpg)
Legendre PolynomialLegendre PolynomialHow would you work with a least square fit of a function.
02 0
1
1
2211000
dxxPxsxPaxPaxPada
dE
1
1
0
1
1
022
1
1
011
1
1
000
dxxPxsdxxPxPa
dxxPxPadxxPxPa
![Page 27: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/27.jpg)
Legendre PolynomialLegendre PolynomialThe coefficient a0 is determined by the orthogonality of the Legendre polynomials:
1
1
00
1
1
0
0
1
1
0
1
1
000
dxxPxP
dxxPxs
a
dxxPxsdxxPxPa
![Page 28: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/28.jpg)
Legendre Polynomial ExampleLegendre Polynomial Example
Given a simple polynomial:
22xxs
We want to throw a loop, let’s model it from 0 to 4 with f(x):
xPaxPaxPaxf 221100
![Page 29: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/29.jpg)
Legendre Polynomial ExampleLegendre Polynomial Example
The first step will be to scale the function:
bmux We know that at the ends are 0 and 4 for x and -1 to 1 for u so
8168
22*22
2
uuus
uus22 ux
![Page 30: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/30.jpg)
Legendre Polynomial ExampleLegendre Polynomial ExampleThe coefficients are
6667.102
3333.21
8168
1
1
1
1
2
1
1
00
1
1
0
0
du
duuu
duuPuP
duuPus
a
8 and 16 21 aa
![Page 31: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/31.jpg)
Legendre Polynomial ExampleLegendre Polynomial ExampleThe Legendre functions must be adjusted to handle the scaling:
Legendre Polynomial Example
0
5
10
15
20
25
30
35
0 1 2 3 4 5
X Values
Y V
alu
esLegendrePolynomial
Exact Value
12
1 xu
15.08
15.016
15.0667.10
2
1
0
xP
xP
xPxf
![Page 32: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/32.jpg)
Tchebyshev PolynomialTchebyshev Polynomial
The Tchebyshev polynomials are another set of orthogonal functions, which can be used to represent a function as components of a function.
xTaxTaxTaxf nn1100
![Page 33: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/33.jpg)
Tchebyshev PolynomialTchebyshev PolynomialThese function are orthogonal over a range [ -1, 1 ]. This range can be scaled to fit the function. The orthogonal functions are defined as:
1i j
21
0 if i j
if i j 01 /2 if i j 0
T x T xdx
x
![Page 34: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/34.jpg)
Tchebyshev PolynomialTchebyshev Polynomial
The Tchebyschev functions are:
xTxT2xT
3xx4xT
1x2xT
xxT
1xT
1-nn1n
33
22
1
0
x
![Page 35: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/35.jpg)
Tchebyshev PolynomialTchebyshev Polynomial
How would you work with a least square fit of a function.
dxxsxTaxTaxTaE21
1
221100
![Page 36: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/36.jpg)
Tchebyshev PolynomialTchebyshev PolynomialHow would you work with a least square fit of a function.
02 0
1
1
2211000
dxxTxsxTaxTaxTada
dE
1
1
0
1
1
022
1
1
011
1
1
000
dxxTxsdxxTxTa
dxxTxTadxxTxTa
Rearrange
![Page 37: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/37.jpg)
Tchebyshev PolynomialTchebyshev Polynomial
The coefficients are determined as:
1
1
00
1
1
0
0
1
1
0
1
1
000
dxxTxT
dxxTxs
a
dxxTxsdxxTxTa
![Page 38: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/38.jpg)
Continuous FunctionsContinuous Functions
Other forms of orthogonal functions are sines and cosines, which are used in Fourier approximation. The advantages for the sines and cosines are that they can model large time scales.
You will need to clip the ends of the series so that it will have zeros at the ends.
![Page 39: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/39.jpg)
Fourier Series Fourier Series
The Fourier series takes advantage of the orthogonality of sines and cosines.
i i jregioni i jregion
i j
iregioni
i iregion
sin if sin sin
0 if
sin =
sin sin
F x x dxC x x dx
F x x dxC
x x dx
![Page 40: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/40.jpg)
Fourier Series Fourier Series
The time series or spatial series is generally clipped and the resulting coefficients are determined using Least Squared technique.
0
jj sinj
xCxF
![Page 41: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/41.jpg)
Fast Fourier Transforms Fast Fourier Transforms
The Fast Fourier Transforms (FFT) are discrete form of the equations. It takes advantage of the power of 2 to find the coefficients in the analysis of data.
So when you hear FFT, it is technique developed by Black and Tukey in the early 60’s. To take advantage of the computer. It is a method to analysis the series.
![Page 42: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/42.jpg)
Other Continuous Functions Other Continuous Functions
Wavelets are another form of orthogonal functions, which maintain the amplitude and phase information of the series.
The techniques are used in data compression, earthquake modeling, wave modeling, and other forms of environmental loading. Etc.
![Page 43: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/43.jpg)
SummarySummary
• Developed a technique using Least Squared applications to nonlinear functions.
ax
a
b
or
b
ey
xy
![Page 44: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/44.jpg)
SummarySummary
• Modeled the equations with continuous functions to describe the functions.
– Polynomials
– Legrendre Polynomials
– Tchebyshev Polynomials
– Cosines and Sines
![Page 45: Lecture 17 - Approximation Methods CVEN 302 July 17, 2002.](https://reader030.fdocuments.net/reader030/viewer/2022013012/5697c02c1a28abf838cd9163/html5/thumbnails/45.jpg)
HomeworkHomework
• Check the homework webpage