Chapter 05.04 Lagrange Method of Interpolation – More Examples Electrical Engineering Example 1 Thermistors are used to measure the temperature of bodies. Thermistors are based on materials’ change in resistance with temperature. To measure temperature, manufacturers provide you with a temperature vs. resistance calibration curve. If you measure resistance, you can find the temperature. A manufacturer of thermistors makes several observations with a thermistor, which are given in Table 1. Table 1 Temperature as a function of resistance. R ohm T C 1101.0 911.3 636.0 451.1 25.113 30.131 40.120 50.128 Figure 1 Resistance vs. temperature. 05.04.1 05.04.2 Chapter 05.04 Determine the temperature corresponding to 754.8 ohms using a first order Lagrange polynomial. Solution For first order Lagrange polynomial interpolation (also called linear interpolation), the temperature is given by 1 T ( R ) Li ( R )T ( Ri ) i 0 L0 ( R)T ( R0 ) L1 ( R)T ( R1 ) y (x1, y1) f1(x) (x0, y0) x Figure 2 Linear interpolation. Since we want to find the temperature at R 754.8 , we need to choose the two data points that are closest to R 754.8 that also bracket R 754.8 to evaluate it. The two points are R0 911.3 and R1 636.0 . Then R0 911.3, T R0 30.131 R1 636.0, T R1 40.120 gives 1 L0 ( R) j 0 j 0 R Rj R0 R j R R1 R0 R1 Lagrange Method of Interpolation-More Examples: Electrical Engineering 1 L1 ( R) j 0 j 1 05.04.3 R Rj R1 R j R R0 R1 R0 Hence R R0 R R1 T ( R0 ) T ( R1 ) R0 R1 R1 R0 R 636.0 R 911.3 (30.131) (40.120), 636.0 R 911.3 911.3 636.0 636.0 911.3 754.8 636.0 754.8 911.3 T (754.8) (30.131) (40.120) 911.3 636.0 636.0 911.3 0.43153(30.131) 0.56847(40.120) 35.809 C You can see that L0 ( R) 0.43153 and L1 ( R) 0.56847 are like weightages given to the temperatures at R0 911.3 and R1 636.0 to calculate the temperature at R 754.8 . T ( R) Example 2 Thermistors are used to measure the temperature of bodies. Thermistors are based on materials’ change in resistance with temperature. To measure temperature, manufacturers provide you with a temperature vs. resistance calibration curve. If you measure resistance, you can find the temperature. A manufacturer of thermistors makes several observations with a thermistor, which are given in Table 2. Table 2 Temperature as a function of resistance. R ohm T C 1101.0 911.3 636.0 451.1 25.113 30.131 40.120 50.128 Determine the temperature corresponding to 754.8 ohms 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 05.04.4 Chapter 05.04 2 T ( R ) Li ( R )T ( Ri ) i 0 L0 ( R)T ( R0 ) L1 ( R)T ( R1 ) L2 ( R)T ( R2 ) y (x1, y1) (x2, y2) f2(x) (x0, y0) x Figure 3 Quadratic interpolation. Since we want to find the temperature at R 754.8, we need to choose the three data points that are closest to R 754.8 that also bracket R 754.8 to evaluate it. The three points are R0 911.3, R1 636.0 and R2 451.1 . Then R0 911.3, T ( R0 ) 30.131 R1 636.0, T ( R1 ) 40.120 R2 451.1, T ( R2 ) 50.128 gives 2 L0 ( R) j 0 j 0 R Rj R0 R j R R1 R R2 R0 R1 R0 R2 2 RR j L1 ( R) j 0 R1 R j j 1 R R0 R R2 R1 R0 R1 R2 Lagrange Method of Interpolation-More Examples: Electrical Engineering 2 L2 ( R) j 0 j 2 05.04.5 R Rj R2 R j R R0 R R1 R2 R0 R2 R1 Hence R R1 R R2 T ( R ) R0 R1 R0 R2 R R0 T ( R0 ) R1 R0 R R2 R1 R2 T ( R1 ) R R0 R R1 T ( R2 ), R0 R R2 R R R R 0 2 1 2 (754.8 636.0)(754.8 451.1) T (754.8) (30.131) (911.3 636.0)(911.3 451.1) (754.8 911.3)(754.8 451.1) (40.120) (636.0 911.3)(636.0 451.1) (754.8 911.3)(754.8 636.0) (50.128) (451.1 911.3)( 451.1 636.0) (0.28478)(30.131) (0.93372)( 40.120) (0.21850)(50.128) 35.089 C The absolute relative approximate error a obtained between the results from the first and second order polynomial is 35.089 35.809 a 100 35.089 2.0543% Example 3 Thermistors are used to measure the temperature of bodies. Thermistors are based on materials’ change in resistance with temperature. To measure temperature, manufacturers provide you with a temperature vs. resistance calibration curve. If you measure resistance, you can find the temperature. A manufacturer of thermistors makes several observations with a thermistor, which are given in Table 3. Table 3 Temperature as a function of resistance. R ohm T C 1101.0 911.3 636.0 451.1 25.113 30.131 40.120 50.128 05.04.6 Chapter 05.04 a) Determine the temperature corresponding to 754.8 ohms using a third order Lagrange polynomial. Find the absolute relative approximate error for the third order polynomial approximation. b) The actual calibration curve used by industry is given by 3 1 1 Li (ln R) T i 0 T (ln Ri ) 1 1 1 1 L0 (ln R) L1 (ln R) L2 (ln R) L3 (ln R) T (ln R0 ) T (ln R1 ) T (ln R2 ) T (ln R3 ) 1 substituting y and x ln R, the calibration curve is given by T y( x) L0 ( x) y( x0 ) L1 ( x) y( x1 ) L2 ( x) y( x2 ) L3 ( x) y( x3 ) Table 4 Manipulation for the given data. 1 y R ohm T C x ln R T 1101.0 25.113 7.0040 0.039820 911.3 30.131 6.8149 0.033188 636.0 40.120 6.4552 0.024925 451.1 50.128 6.1117 0.019949 Find the calibration curve and find the temperature corresponding to 754.8 ohms. What is the difference between the results from part (a)? Is the difference larger using the results from part (a) or part (b), if the actual measured value at 754.8 ohms is 35.285C ? Solution a) For third order Lagrange polynomial interpolation (also called cubic interpolation), we choose the temperature given by 3 T ( R ) Li ( R )T ( Ri ) i 0 L0 ( R)T ( R0 ) L1 ( R)T ( R1 ) L2 ( R)T ( R2 ) L3 ( R)T ( R3 ) Since we want to find the temperature at R 754.8, we need to choose the four data points that are closest to R 754.8 that also bracket R 754.8 to evaluate it. The four data points are R0 1101.0, R1 911.3, R2 636.0 and R3 451.1 . Then R0 1101.0, T ( R0 ) 25.113 R1 911.3, T ( R1 ) 30.131 R2 636.0, T ( R2 ) 40.120 R3 451.1, T ( R3 ) 50.128 gives Lagrange Method of Interpolation-More Examples: Electrical Engineering 3 L0 ( R) j 0 j 0 05.04.7 R Rj R0 R j R R1 R R2 R R3 R0 R1 R0 R2 R0 R3 3 RR j L1 ( R) j 0 R1 R j j 1 R R0 R R2 R R3 R R R R R R 0 1 2 1 3 1 3 R Rj L2 ( R) j 0 R2 R j j 2 R R0 R R1 R R3 R2 R0 R2 R1 R2 R3 3 R Rj L3 ( R) j 0 R3 R j j 3 R R0 R R1 R R2 R R R R R R 0 3 1 3 2 3 Hence R R1 R R2 T ( R) R R 1 R0 R2 0 R R0 R2 R0 R R3 R R0 T ( R0 ) R0 R3 R1 R0 R R2 R1 R2 R R3 T ( R1 ) R R 3 1 R R1 R R3 R R0 T ( R2 ) R2 R1 R2 R3 R3 R0 R R1 R R2 T ( R3 ) R3 R1 R3 R2 R0 R R3 (754.8 911.3)(754.8 636.0)(754.8 451.1) T (754.8) (25.113) (1101.0 911.3)(1101.0 636.0)(1101.0 451.1) (754.8 1101.0)(754.8 636.0)(754.8 451.1) (30.131) (911.3 1101.0)(911.3 636.0)(911.3 451.1) (754.8 1101.0)(754.8 911.3)(754.8 451.1) (40.120) (636.0 1101.0)(636.0 911.3)(636.0 451.1) (754.8 1101.0)(754.8 911.3)(754.8 636.0) (50.128) (451.1 1101.0)( 451.1 911.3)( 451.1 636.0) (0.098494)( 25.113) (0.51972)(30.131) (0.69517 )(40.120 ) (0.11639 )(50.128 ) 35.242 C 05.04.8 Chapter 05.04 The absolute relative approximate error a obtained between the results from the second and third order polynomial is 35.242 35.089 a 100 35.242 0.43458% b) Finding the cubic interpolant using the Lagrangian method of interpolation for y( x) L0 ( x) y( x0 ) L1 ( x) y( x1 ) L2 ( x) y( x2 ) L3 ( x) y( x3 ) requires that we first calculate the new values of x and y . x ln R 7.0040 6.8149 6.4552 6.1117 Then 1 y T 0.039820 0.033188 0.024925 0.019949 x0 7.0040, yx0 0.039820 x1 6.8149, yx1 0.033188 x2 6.4552, yx2 0.024925 x3 6.1117, yx3 0.019949 gives 3 L0 ( x) j 0 j 0 x xj x0 x j x x1 x x2 x x3 x x x x x x 1 0 2 0 3 0 3 x x j L1 ( x) j 0 x1 x j j 1 x x0 x x2 x x3 x1 x0 x1 x2 x1 x3 3 x xj L2 ( x) j 0 x 2 x j j 2 x x0 x x1 x x3 x x x x x x 0 2 1 2 3 2 3 x xj L3 ( x) j 0 x3 x j j 3 Lagrange Method of Interpolation-More Examples: Electrical Engineering 05.04.9 x x0 x x1 x x2 x3 x0 x3 x1 x3 x2 Hence x x1 x x 2 y ( x) x0 x1 x0 x 2 x x0 x 2 x0 x x3 x x0 x x 2 y ( x0 ) x0 x3 x1 x0 x1 x 2 x x1 x x3 x x0 y ( x 2 ) x 2 x1 x 2 x3 x3 x 0 x x3 y ( x1 ) x1 x3 x x1 x x 2 y ( x3 ) x3 x1 x3 x 2 x 0 x x3 Since we’re looking for the temperature at R 754.8 , we will be using x ln( 754.8) 6.6265 At x 6.6265, (6.6265 6.8149)(6.6265 6.4552)(6.6265 6.1117) y (6.6265) (0.039820) (7.0040 6.8149)(7.0040 6.4552)(7.0040 6.1117) (6.6265 7.0040)(6.6265 6.4552)(6.6265 6.1117) (0.033188) (6.8149 7.0040)(6.8149 6.4552)(6.8149 6.1117) (6.6265 7.0040)(6.6265 6.8149)(6.6265 6.1117) (0.024925) (6.4552 7.0040)(6.4552 6.8149)(6.4552 6.1117) (6.6265 7.0040)(6.6265 6.8149)(6.6265 6.4552) (0.019949) (6.1117 7.0040)(6.1117 6.8149)(6.1117 6.4552) (0.17938)(0.039820) (0.69585)(0.033188) (0.54005)(0.024925) (0.056519)(0.019949) 0.028285 1 Finally, since y , T 1 T y 1 0.028285 35.355 C Since the actual measured value at 754.8 ohms is 35.285C, the absolute relative true error between the value used for part (a) is 35.285 35.242 t 100 35.285 0.12253% and for part (b) is 35.285 35.355 t 100 35.285 0.19825% 05.04.10 Chapter 05.04 Therefore, a cubic polynomial interpolant given by the Lagrangian method of interpolation, that is, 3 T ( R ) Li ( R )T ( Ri ) i 0 L0 ( R)T ( R0 ) L1 ( R)T ( R1 ) L2 ( R)T ( R2 ) L3 ( R)T ( R3 ) obtained more accurate results than the calibration curve of 3 1 1 Li (ln R) T i 0 T (ln Ri ) 1 1 1 1 L0 (ln R) L1 (ln R) L2 (ln R) L3 (ln R) T (ln R0 ) T (ln R1 ) T (ln R2 ) T (ln R3 )