ENGRD 241: Engineering Computation PS07S, Fall 2002 SOLUTION TO PROBLEM SET NUMBER 7 1. C&C Problem 17.13, page 472. Use Excel for calculations. Also use the Excel Trendline capability (C&C Section 19.8.1) for parts (a), (b), and (d) as well as for a logarithmic fit. Because the Trendline capability does not have an option for part (c), you will need to calculate this separately. The following are obtained by least-squares regression using EXCEL Trendline capability. (a) A straight line (b) Power equation y = 9.6583x 0.395 R2 = 0.9309 Power-equation fit y = 0.4958x + 20.667 R2 = 0.8201 50 50 45 45 40 40 35 35 30 30 25 25 y y Linear fit 20 20 15 15 10 10 5 5 0 0 0 10 20 30 x 40 50 60 0 10 20 30 x 40 50 (c) Saturation growth rate equation. A saturation growth equation, which is typically of the form x 1 b 1 1 1 1 y a3 , can be linearized by expressing it as 3 . A plot of versus x y a3 x a3 b3 x y would, therefore, be linear. So, we convert each data value into its reciprocal and use those values in EXCEL Trendline to get the required fit, which, as shown in the below Trendline 1 1 1 52.36 and chart, is 0.2134 0.0191 . Therefore, a3 0.0191 y x b3 a3 (0.2134) (52.36)(0.2134) 11.17 . 1/y = 0.21341/x + 0.0191 R2 = 0.992 0.07 0.06 0.05 1/y 0.04 0.03 0.02 0.01 0 0 0.05 0.1 0.15 0.2 0.25 1/x Page 1 of 5 60 ENGRD 241: Engineering Computation PS07S, Fall 2002 (d) A parabola. A parabola is a second-order polynomial. Using EXCEL Trendline, a second-order polynomial fit is obtained as shown below. Parabola y = -0.0155x 2 + 1.3458x + 12.167 R2 = 0.9476 45 40 35 30 y 25 20 15 10 5 0 0 10 20 30 40 50 60 x (e) Logarithmic Logarithmic 50 45 40 35 30 y 25 20 y = 11.14Ln(x) - 0.4559 R2 = 0.971 15 10 5 0 0 10 20 30 x 40 50 60 A look at the R2 values for each of the ‘fits’ obtained above shows that the curve obtained by the saturation growth equation appears to be the best because it has the highest R2 value (0.992). The standard error is another parameter that can be used to check how good a fit is. The saturation growth equation works better for data that seem to saturate beyond a certain point. This saturation can be observed in the given data. So, the curve obtained by the saturation growth equation stands out as the best. 2. C&C Problem 18.11, page 506. From the given data, x0 = 1, x1 = 2, x2 = 3, x3 = 5, x4 = 6 f ( x0 ) = 4.75, f ( x1 ) = 4, f ( x2 ) = 5.25, f ( x3 ) = 19.75, f ( x4 ) = 36 Page 2 of 5 ENGRD 241: Engineering Computation PS07S, Fall 2002 Substitute these values in Eq.(18.37) on C&C page 503: For i = 1, we have, 6 6 [5.25 – 4] + [4.75 – 4] 3 2 2 1 By one of the properties of a natural spline, f (1) = 0. So, the above equation reduces to: 4 f (2) + f (3) = 12 ………….(1) (2 – 1) f (1) + 2(3 – 1) f (2) + (3 – 2) f (3) = For i = 2, we have, (3 – 2) f (2) + 2(5 – 2) f (3) + (5 – 3) f (5) = reduces to: f (2) + 6 f (3) + 2 f (5) = 36 6 6 [19.75 – 5.25] + [4 – 5.25], which 53 3 2 ………………………..(2) For i = 3, we have, 6 6 [36 – 19.75] + [5.25 – 19.75] 65 53 From the properties of a natural spline, we have f (6) = 0. So, the above equation reduces to, 2 f (3) + 6 f (5) = 54 ………………(3) (5 – 3) f (3) + 2(6 – 3) f (5) + (6 – 5) f (6) = The equations (1), (2) and (3) can be expressed in matrix form as, 4 1 0 f (2) 12 1 6 2 f (3) = 36 0 2 6 f (5) 54 The above set of equations is solved by a suitable method such as the Gauss elimination method and we obtain: f (2) = 2.2623; f (3) = 2.9508; f (5) = 8.0164 Using these values in Eq.(18.36) on page 503 C&C, we obtain: 2.2623 4.75 2.2623(2 1) 4 ( x 1)3 (2 x) For the 1st interval, f1(x) = 0 + ( x 1) , 6(2 1) 2 1 6 2 1 which reduces to: f1(x) = 0.37705(x – 1)3 + 4.75(2 – x) + 3.6229(x – 1) 2.2623(3 2) 2.2623 2.9508 4 (3 x)3 ( x 2)3 (3 x) 6 6(3 2) 6(3 2) 3 2 5.25 2.9508(3 2) + ( x 2) , which reduces to: 6 3 2 f2(x) = 0.37705(3 – x)3 + 0.4918(x – 2)3 + 3.6229(3 – x) + 4.7582(x – 2) For the 2nd interval, f2(x) = 2.9508 8.0164 5.25 2.9508(5 3) (5 x)3 ( x 3)3 (5 x) 6(5 3) 6(5 3) 6 5 3 19.75 8.0164(5 3) ( x 3) , which reduces to: 6 53 f3(x) = 0.2459(5 – x)3 + 0.668(x – 3)3 + 1.6414(5 – x) + 7.2029(x – 3) For the 3rd interval, f3(x) = Page 3 of 5 ENGRD 241: Engineering Computation PS07S, Fall 2002 For the 4th interval, 8.0164 19.75 8.0164(6 5) 36 (6 x)3 0 (6 x) 0 ( x 5) , f4(x) = 6(6 5) 6 65 6 5 3 which reduces to: f4(x) = 1.3361(6 – x) + 18.4139(6 – x) + 36(x – 5) (a) To predict f(4), we use the equation for the 3rd interval: f3(4) = 0.2459(5 – 4)3 + 0.668(4 – 3)3 + 1.6414(5 – 4) + 7.2029(4 – 3) = 9.7582 To predict f(2.5), we use the equation for the 2nd interval. f2(2.5) = 0.37705(3 – 2.5)3 + 0.4918(2.5 – 2)3 + 3.6229(3 – 2.5) + 4.7582(2.5 – 2) = 4.2992 (b) Using the equation for the 2nd interval, f2(3) = 0.37705(3 – 3)3 + 0.4918(3 – 2)3 + 3.6229(3 – 3) + 4.7582(3 – 2) = 5.25 Using the equation for the 3rd interval, f3(3) = 0.2459(5 – 3)3 + 0.668(3 – 3)3 + 1.6414(5 – 3) + 7.2029(3 – 3) = 5.25 The above results verify that f(3) calculated by using the equation for the 2nd interval is the same as that calculated using the equation for the 3rd interval. 3. C&C Problems 20.44 and 20.45, pages 560-561. Use Excel Trendline capabilities. 20.44) We can use EXCEL Trendline capability to get a linear fit for the first four data points, and thereby find the value of k from the regression equation: y = 117.16x - 1.0682 R2 = 0.9959 Linear fit 45 Force (*10000 N) 40 From the regression equation, we find that the value of the spring constant k is 117.16 x 104 35 30 25 20 15 10 5 0 0 0.1 0.2 0.3 0.4 Displacem ent (m ) Any nonlinear fit can be made for the nonlinear portion (the last four data points) of the data. One of the fits could be a logarithmic fit, which is shown below. Logarithm ic fit y = 234.85Ln(x) + 268.97 R2 = 0.9051 90 Force (*10000 N) 80 70 60 50 40 30 20 10 0 0.38 0.4 0.42 Displacem ent (m ) 0.44 0.46 Page 4 of 5 ENGRD 241: Engineering Computation PS07S, Fall 2002 20.45) Using EXCEL Trendline, a power curve can be fitted to the data as shown below, y = 185.45x 1.2876 R2 = 0.9637 Pow er fit 90 Force (*10000 N) 80 70 60 50 40 30 20 10 0 0 0.1 0.2 0.3 0.4 0.5 Displacem ent (m ) Generally power curves fit well for data in which one parameter saturates as the other one increases. In the given data, beyond 60 104 N, the displacement appears to get saturated. So, the power curve fits well for the given data. Page 5 of 5