Uploaded by salma tharwat

lagrange

advertisement
Chapter 05.04
Lagrangian Interpolation – More Examples
Civil Engineering
Example 1
To maximize a catch of bass in a lake, it is suggested to throw the line to the depth of the
thermocline. The characteristic feature of this area is the sudden change in temperature. We
are given the temperature vs. depth data for a lake in Table 1.
Table 1 Temperature vs. depth for a lake.
05.04.1
Temperature, T C 
Depth, z m 
19.1
19.1
19
18.8
18.7
18.3
18.2
17.6
11.7
9.9
9.1
0
–1
–2
–3
–4
–5
–6
–7
–8
–9
–10
05.04.2
Chapter 05.0
Figure 1 Temperature vs. depth of a lake.
Using the given data, we see the largest change in temperature is between z  8 m and
z  7 m . Determine the value of the temperature at z  7.5 m using a first order
Lagrange polynomial.
Solution
For first order Lagrange polynomial interpolation (also called linear interpolation), the
temperature is given by
1
T ( z )   Li ( z )T ( z i )
i 0
 L0 ( z )T ( z 0 )  L1 ( z )T ( z1 )
Lagrange Method of Interpolation-More Examples: Civil Engineering
05.04.3
y
(x1, y1)
f1(x)
(x0, y0)
x
Figure 2 Linear interpolation.
Since we want to find the temperature at z  7.5 m , we need to choose the two data points
that are closest to z  7.5 m that also bracket z  7.5 m to evaluate it. The two points are
z 0  8 and z1  7 .
Then
z 0  8, T  z 0   11.7
z1  7, T  z1   17.6
gives
1
z  zj
L0 ( z )  
j 0 z 0  z j
j 0

z  z1
z 0  z1
1
z  zj
L1 ( z )  
j 0
j 1

z1  z j
z  z0
z1  z 0
Hence
z  z0
z  z1
T ( z1 )
T (z0 ) 
z1  z 0
z 0  z1
z7
z 8

(11.7) 
(17.6),  8  z  7
87
78
 7.5  7
 7.5  8
(11.7) 
(17.6)
T (7.5) 
87
78
T ( z) 
05.04.4
Chapter 05.0
 0.5(11.7)  0.5(17.6)
 14.65 C
You can see that L0 ( z )  0.5 and L1 ( z )  0.5 are like weightages given to the temperatures
at z  8 m and z  7 m to calculate the temperature at z  7.5 m .
Example 2
To maximize a catch of bass in a lake, it is suggested to throw the line to the depth of the
thermocline. The characteristic feature of this area is the sudden change in temperature. We
are given the temperature vs. depth data for a lake in Table 2.
Table 2 Temperature vs. depth for a lake.
Temperature, T C 
Depth, z m 
19.1
19.1
19
18.8
18.7
18.3
18.2
17.6
11.7
9.9
9.1
0
–1
–2
–3
–4
–5
–6
–7
–8
–9
–10
Using the given data, we see the largest change in temperature is between z  8 m and
z  7 m . Determine the value of the temperature at z  7.5 m using a second order
Lagrange polynomial. Find the absolute relative approximate error for the second order
polynomial approximation.
Solution
For second order Lagrange polynomial interpolation (also called quadratic interpolation), the
temperature is given by
2
T ( z )   Li ( z )T ( z i )
i 0
 L0 ( z )T ( z 0 )  L1 ( z )T ( z1 )  L2 ( z )T ( z 2 )
Lagrange Method of Interpolation-More Examples: Civil Engineering
05.04.5
y
(x1, y1)
(x2, y2)
f2(x)
(x0, y0)
x
Figure 3 Quadratic interpolation.
Since we want to find the temperature at z  7.5, we need to choose the three data points
that are closest to z  7.5 that also bracket z  7.5 to evaluate it. These three points are
z 0  9, z1  8 and z 2  7 . (Choosing the three points as z 0  8 , z1  7 and z 2  6
is equally valid.)
Then
z 0  9, T  z 0   9.9
z1  8, T z1   11.7
z 2  7, T z 2   17.6
gives
2
z  zj
L0 ( z )  
j 0 z 0  z j
j 0
 z  z1  z  z 2

 
 z 0  z1  z 0  z 2
2
z  zj
L1 ( z )  
j  0 z1  z j



 z  z 0  z  z 2

 
z
z

1
0
 z1  z 2

2
z  zj
L2 ( z )  
j 0 z 2  z j



j 1
j2
05.04.6
Chapter 05.0
 z  z0
 
 z2  z0
 z  z1 


 z 2  z1 
Hence
 z  z1  z  z 2

T ( z )  
 z 0  z1  z 0  z 2

 z  z0
T ( z 0 )  

 z1  z 0
 z  z 2

 z1  z 2
 z  z0

T ( z1 )  

 z2  z0
 z  z1 

T ( z 2 ),
 z 2  z1 
z0  z  z2
(7.5  8)(7.5  7)
(7.5  9)(7.5  7)
(9.9) 
(11.7)
(9  8)(9  7)
(8  9)(8  7)
(7.5  9)(7.5  8)

(17.6)
(7  9)(7  8)
 (0.125)(9.9)  (0.75)(11.7)  (0.375)(17.6)
 14.138 C
The absolute relative approximate error a obtained between the results from the first and
T (7.5) 
second order polynomial is
14.138  14.65
a 
 100
14.138
 3.6251%
Example 3
To maximize a catch of bass in a lake, it is suggested to throw the line to the depth of the
thermocline. The characteristic feature of this area is the sudden change in temperature. We
are given the temperature vs. depth data for a lake in Table 3.
Table 3 Temperature vs. depth for a lake.
Temperature, T C 
Depth, z m 
19.1
19.1
19
18.8
18.7
18.3
18.2
17.6
11.7
9.9
9.1
0
–1
–2
–3
–4
–5
–6
–7
–8
–9
–10
Using the given data, we see the largest change in temperature is between z  8 m and
z  7 m .
Lagrange Method of Interpolation-More Examples: Civil Engineering
05.04.7
a) Determine the value of the temperature at z  7.5 m using a third order Lagrange
polynomial. Find the absolute relative approximate error for the third order
polynomial approximation.
d 2T
 0 . Using the
b) The position where the thermocline exists is given where
dz 2
expression from part (a), what is the value of the depth at which the thermocline
exists?
Solution
a) For third order Lagrange polynomial interpolation (also called cubic interpolation), we
choose the temperature given by
3
T ( z )   Li ( z )T ( z i )
i 0
 L0 ( z )T ( z 0 )  L1 ( z )T ( z1 )  L2 ( z )T ( z 2 )  L3 ( z )T ( z 3 )
y
(x3, y3)
f3(x)
(x1, y1)
(x0, y0)
(x2, y2)
x
Figure 4 Cubic interpolation.
Since we want to find the temperature at z  7.5, we need to choose the four data points
that are closest to z  7.5 that also bracket z  7.5 to evaluate it. The four data points are
z 0  9, z1  8, z 2  7 and z 3  6 .
Then
z 0  9, T  z 0   9.9
z1  8, T z1   11.7
z 2  7, T z 2   17.6
z 3  6, T  z 3   18.2
05.04.8
Chapter 05.0
gives
3
L0 ( z )  
j 0
j 0
z  zj
z0  z j
 z  z1  z  z 2

 

z
z
 0 1  z 0  z 2
3
z  zj
L1 ( z )  
j  0 z1  z j
 z  z 3 



z
z
3 
 0
 z  z 0  z  z 2

 
 z1  z 0  z1  z 2
3
z  zj
L2 ( z )  
j 0 z 2  z j
 z  z 3 


 z1  z 3 
j 1
j2
 z  z 0  z  z1  z  z 3 



 



z
z
z
z
z
z
0  2
1  2
3 
 2
3
z  zj
L3 ( z )  
j 0 z 3  z j
j 3
 z  z0
 
 z3  z0
 z  z1  z  z 2


 z 3  z1  z 3  z 2



Hence
 z  z1  z  z 2

T ( z )  
 z 0  z1  z 0  z 2
 z  z0
 z  z 3 
T ( z 0 )  

 z1  z 0
 z 0  z 3 
 z  z 2

 z1  z 2
 z  z 3 
T ( z1 )

 z1  z 3 

T ( z 3 )

z 0  z  z3
(7.5  9)(7.5  7)(7.5  6)
(7.5  8)(7.5  7)(7.5  6)
T (7.5) 
(9.9) 
(11.7)
(8  9)(8  7)(8  6)
(9  8)(9  7)(9  6)
(7.5  9)(7.5  8)(7.5  6)
(7.5  9)(7.5  8)(7.5  7)

(17.6) 
(18.2)
(7  9)(7  8)(7  6)
(6  9)(6  8)(6  7)
 (0.0625)(9.9)  (0.5625)(11.7)  (0.5625 )(17.6 )  (0.0625 )(18.2 )
 14.725 C
The absolute relative approximate error a obtained between the results from the second
 z  z0
 
 z2  z0
 z  z1  z  z 3 
 z  z0

T ( z 2 )  

 z 2  z1  z 2  z 3 
 z3  z0
and third order polynomial is
14.725  14.138
a 
 100
14.725
 3.9898%
 z  z1  z  z 2


z
z

 3 1  z 3  z 2
Lagrange Method of Interpolation-More Examples: Civil Engineering
05.04.9
b) To find the position of the thermocline, we must find the points of inflection of the third
d 2T
 0.
order polynomial, given by
dz 2
( z  8)( z  7)( z  6)
( z  9)( z  7)( z  6)
(9.9) 
(11.7)
T ( z) 
(9  8)(9  7)(9  6)
(8  9)(8  7)(8  6)
( z  9)( z  8)( z  6)
( z  9)( z  8)( z  7)

(17.6) 
(18.2)
(7  9)(7  8)(7  6)
(6  9)(6  8)(6  7)
 9  z  6
2
3
 615.9  262.58 z  35.55 z  1.5667 z ,  9  z  6
dT
 262.58  71.1z  4.7 z 2 ,  9  z  6
dz
d 2T
 71.1  9.4 z ,  9  z  6
dz 2
Simply setting this expression equal to zero, we get
0  71.1  9.4 z,  9  z  6
z  7.5638 m
This answer can be verified due to the fact that it falls within the specified range of the third
order polynomial and it also falls within the region of the greatest temperature change in the
collected data from the lake.
Download