Numerical Methods with Applications by Autar K Kaw (1).pdf - Chapter 01.01 Introduction to Numerical Methods After reading this chapter you should be

Numerical Methods with Applications by Autar K Kaw (1).pdf...

This preview shows page 1 out of 790 pages.

Unformatted text preview: Chapter 01.01 Introduction to Numerical Methods After reading this chapter, you should be able to: 1. understand the need for numerical methods, and 2. go through the stages (mathematical modeling, solving and implementation) of solving a particular physical problem. Mathematical models are an integral part in solving engineering problems. Many times, these mathematical models are derived from engineering and science principles, while at other times the models may be obtained from experimental data. Mathematical models generally result in need of using mathematical procedures that include but are not limited to (A) differentiation, (B) nonlinear equations, (C) simultaneous linear equations, (D) curve fitting by interpolation or regression, (E) integration, and (F) differential equations. These mathematical procedures may be suitable to be solved exactly as you must have experienced in the series of calculus courses you have taken, but in most cases, the procedures need to be solved approximately using numerical methods. Let us see an example of such a need from a real-life physical problem. To make the fulcrum (Figure 1) of a bascule bridge, a long hollow steel shaft called the trunnion is shrink fit into a steel hub. The resulting steel trunnion-hub assembly is then shrink fit into the girder of the bridge. Trunnion Hub Girder Figure 1 Trunnion-Hub-Girder (THG) assembly. 01.01.1 01.01.2 Chapter 01.01 This is done by first immersing the trunnion in a cold medium such as a dryice/alcohol mixture. After the trunnion reaches the steady state temperature of the cold medium, the trunnion outer diameter contracts. The trunnion is taken out of the medium and slid through the hole of the hub (Figure 2). Figure 2 Trunnion slided through the hub after contracting When the trunnion heats up, it expands and creates an interference fit with the hub. In 1995, on one of the bridges in Florida, this assembly procedure did not work as designed. Before the trunnion could be inserted fully into the hub, the trunnion got stuck. Luckily, the trunnion was taken out before it got stuck permanently. Otherwise, a new trunnion and hub would needed to be ordered at a cost of $50,000. Coupled with construction delays, the total loss could have been more than a hundred thousand dollars. Why did the trunnion get stuck? This was because the trunnion had not contracted enough to slide through the hole. Can you find out why? A hollow trunnion of outside diameter 12.363" is to be fitted in a hub of inner diameter 12.358" . The trunnion was put in dry ice/alcohol mixture (temperature of the fluid - dry ice/alcohol mixture is − 108°F ) to contract the trunnion so that it can be slid through the hole of the hub. To slide the trunnion without sticking, a diametrical clearance of at least 0.01" is required between the trunnion and the hub. Assuming the room temperature is 80°F , is immersing the trunnion in dry-ice/alcohol mixture a correct decision? To calculate the contraction in the diameter of the trunnion, the thermal expansion coefficient at room temperature is used. In that case the reduction ∆D in the outer diameter of the trunnion is (1) ∆D = Dα∆T where D = outer diameter of the trunnion, α = coefficient of thermal expansion coefficient at room temperature, and ∆T = change in temperature, Given D = 12.363" α = 6.47 × 10−6 in/in/ °F at 80°F ∆T = T fluid − Troom = − 108 − 80 Introduction to Numerical Methods where 01.01.3 = −188°F T fluid = temperature of dry-ice/alcohol mixture Troom = room temperature the reduction in the outer diameter of the trunnion is given by ∆D = (12.363) 6.47 × 10 −6 (− 188) = − 0.01504" So the trunnion is predicted to reduce in diameter by 0.01504" . But, is this enough reduction in diameter? As per specifications, the trunnion needs to contract by = trunnion outside diameter - hub inner diameter + diametric clearance = 12.363 – 12.358 + 0.01 = 0.015" So according to his calculations, immersing the steel trunnion in dry-ice/alcohol mixture gives the desired contraction of greater than 0.015" as the predicted contraction is 0.01504" . But, when the steel trunnion was put in the hub, it got stuck. Why did this happen? Was our mathematical model adequate for this problem or did we create a mathematical error? As shown in Figure 3 and Table 1, the thermal expansion coefficient of steel decreases with temperature and is not constant over the range of temperature the trunnion goes through. Hence, Equation (1) would overestimate the thermal contraction. ( ) 7.00E-06 Coefficient of Thermal Expancion (in/in/oF) 6.00E-06 5.00E-06 4.00E-06 3.00E-06 2.00E-06 1.00E-06 -400 -350 -300 -250 -200 -150 0.00E+00 -50 0 -100 50 100 150 o Tem perature ( F) Figure 3 Varying thermal expansion coefficient as a function of temperature for cast steel. The contraction in the diameter of the trunnion for which the thermal expansion coefficient varies as a function of temperature is given by T fluid ∆D = D ∫ αdT Troom (2) So one needs to curve fit the data to find the coefficient of thermal expansion as a function of temperature. This is done by regression where we best fit a curve through the data given in Table 1. In this case, we may fit a second order polynomial (3) α = a0 + a1 × T + a2 × T 2 01.01.4 Chapter 01.01 Table 1 Instantaneous thermal expansion coefficient as a function of temperature. Instantaneous Temperature Thermal Expansion μin/in/°F °F 80 6.47 60 6.36 40 6.24 20 6.12 0 6.00 -20 5.86 -40 5.72 -60 5.58 -80 5.43 -100 5.28 -120 5.09 -140 4.91 -160 4.72 -180 4.52 -200 4.30 -220 4.08 -240 3.83 -260 3.58 -280 3.33 -300 3.07 -320 2.76 -340 2.45 The values of the coefficients in the above Equation (3) will be found by polynomial regression (we will learn how to do this later in Chapter 06.04). At this point we are just going to give you these values and they are −6 a 0 6.0150 × 10 a = 6.1946 × 10 −9 1 a 2 − 1.2278 × 10 −11 to give the polynomial regression model (Figure 4) as α = a0 + a1T + a2T 2 = 6.0150 × 10 −6 + 6.1946 × 10 −9 T − 1.2278 × 10 −11 T 2 Knowing the values of a 0 , a1 and a 2 , we can then find the contraction in the trunnion diameter as T fluid ∆D = D ∫ (a 0 + a1T + a2T 2 )dT Troom 2 = D[a0 (T fluid − Troom ) + a1 2 (T fluid − Troom ) 2 3 + a2 3 (T fluid − Troom ) 3 (4) Introduction to Numerical Methods 01.01.5 which gives 2 2 −6 −9 (( −108) − (80) ) 6 . 0150 10 ( 108 80 ) 6 . 1946 10 × × − − + × 2 ∆D = 12.363 3 3 −12 (( −108) − (80) ) − 1.2278 × 10 3 = − 0.013689" Coefficient of thermal expansion o (µ in/in/ F) 7.00 6.00 5.00 4.00 3.00 2.00 1.00 0.00 -400 -300 -200 -100 0 100 200 o Temperature ( F) Figure 4 Second order polynomial regression model for coefficient of thermal expansion as a function of temperature. What do we find here? The contraction in the trunnion is not enough to meet the required specification of 0.015" . So here are some questions that you may want to ask yourself? 1. What if the trunnion were immersed in liquid nitrogen (boiling temperature = −321°F )? Will that cause enough contraction in the trunnion? 2. Rather than regressing the thermal expansion coefficient data to a second order polynomial so that one can find the contraction in the trunnion OD, how would you use Trapezoidal rule of integration for unequal segments? What is the relative difference between the two results? 3. We chose a second order polynomial for regression. Would a different order polynomial be a better choice for regression? Is there an optimum order of polynomial you can find? As mentioned at the beginning of this chapter, we generally see mathematical procedures that require the solution of nonlinear equations, differentiation, solution of simultaneous linear equations, interpolation, regression, integration, and differential equations. A physical example to illustrate the need for each of these mathematical procedures is given in the beginning of each chapter. You may want to look at them now to understand better why we need numerical methods in everyday life. 01.01.6 Chapter 01.01 INTRODUCTION, APPROXIMATION AND ERRORS Topic Introduction to Numerical Methods Summary Textbook notes of Introduction to Numerical Methods Major General Engineering Authors Autar Kaw Date January 27, 2011 Web Site Chapter 01.02 Measuring Errors After reading this chapter, you should be able to: 1. find the true and relative true error, 2. find the approximate and relative approximate error, 3. relate the absolute relative approximate error to the number of significant digits at least correct in your answers, and 4. know the concept of significant digits. In any numerical analysis, errors will arise during the calculations. To be able to deal with the issue of errors, we need to (A) identify where the error is coming from, followed by (B) quantifying the error, and lastly (C) minimize the error as per our needs. In this chapter, we will concentrate on item (B), that is, how to quantify errors. Q: What is true error? A: True error denoted by Et is the difference between the true value (also called the exact value) and the approximate value. True Error True value – Approximate value Example 1 The derivative of a function f (x) at a particular value of x can be approximately calculated by f ( x h) f ( x ) f ( x) h of f (2) For f ( x) 7e 0.5 x and h 0.3 , find a) the approximate value of f ( 2) b) the true value of f (2) c) the true error for part (a) Solution a) 01.02.1 f ( x) f ( x h) f ( x ) h 01.02.2 Chapter 01.02 For x 2 and h 0.3 , f (2 0.3) f (2) f (2) 0 .3 f ( 2.3) f (2) 0 .3 0 .5 ( 2 .3 ) 7e 7 e 0 .5 ( 2 ) 0 .3 22.107 19.028 0 .3 10.265 b) The exact value of f (2) can be calculated by using our knowledge of differential calculus. f ( x) 7e 0.5 x f ' ( x) 7 0.5 e 0.5 x 3.5e 0.5 x So the true value of f ' (2) is f ' (2) 3.5e 0.5( 2 ) 9.5140 c) True error is calculated as Et = True value – Approximate value 9.5140 10.265 0.75061 The magnitude of true error does not show how bad the error is. A true error of E t 0.722 may seem to be small, but if the function given in the Example 1 were f ( x) 7 10 6 e 0.5 x , the true error in calculating f (2) with h 0.3, would be Et 0.75061 10 6. This value of true error is smaller, even when the two problems are similar in that they use the same value of the function argument, x 2 and the step size, h 0.3 . This brings us to the definition of relative true error. Q: What is relative true error? A: Relative true error is denoted by t and is defined as the ratio between the true error and the true value. True Error Relative True Error True Value Example 2 The derivative of a function f ( x) at a particular value of x can be approximately calculated by f ( x h) f ( x) f ' ( x) h 0.5 x For f ( x) 7e and h 0.3 , find the relative true error at x 2 . Measuring Errors 01.02.3 Solution From Example 1, Et = True value – Approximate value 9.5140 10.265 0.75061 Relative true error is calculated as True Error t True Value 0.75061 9.5140 0.078895 Relative true errors are also presented as percentages. For this example, t 0.0758895 100% 7.58895% Absolute relative true errors may also need to be calculated. In such cases, t | 0.075888 | = 0.0758895 = 7.58895% Q: What is approximate error? A: In the previous section, we discussed how to calculate true errors. Such errors are calculated only if true values are known. An example where this would be useful is when one is checking if a program is in working order and you know some examples where the true error is known. But mostly we will not have the luxury of knowing true values as why would you want to find the approximate values if you know the true values. So when we are solving a problem numerically, we will only have access to approximate values. We need to know how to quantify error for such cases. Approximate error is denoted by E a and is defined as the difference between the present approximation and previous approximation. Approximate Error Present Approximation – Previous Approximation Example 3 The derivative of a function f ( x) at a particular value of x can be approximately calculated by f ( x h) f ( x ) f ' ( x) h 0.5 x For f ( x) 7e and at x 2 , find the following a) f (2) using h 0.3 b) f (2) using h 0.15 c) approximate error for the value of f (2) for part (b) Solution a) The approximate expression for the derivative of a function is 01.02.4 Chapter 01.02 f ( x h) f ( x) . h For x 2 and h 0.3 , f (2 0.3) f (2) f ' ( 2) 0 .3 f (2.3) f (2) 0 .3 7e 0.5( 2.3) 7e 0.5( 2 ) 0 .3 22.107 19.028 0 .3 10.265 b) Repeat the procedure of part (a) with h 0.15, f ( x h) f ( x ) f ( x) h For x 2 and h 0.15 , f (2 0.15) f (2) f ' ( 2) 0.15 f (2.15) f (2) 0.15 0.5 ( 2.15 ) 7e 0.5( 2) 7e 0.15 20.50 19.028 0.15 9.8799 c) So the approximate error, E a is f ' ( x) E a Present Approximation – Previous Approximation 9.8799 10.265 0.38474 The magnitude of approximate error does not show how bad the error is . An approximate error of E a 0.38300 may seem to be small; but for f ( x) 7 10 6 e 0.5 x , the approximate error in calculating f ' (2) with h 0.15 would be Ea 0.38474 10 6 . This value of approximate error is smaller, even when the two problems are similar in that they use the same value of the function argument, x 2 , and h 0.15 and h 0.3 . This brings us to the definition of relative approximate error. Q: What is relative approximate error? A: Relative approximate error is denoted by a and is defined as the ratio between the approximate error and the present approximation. Approximate Error Relative Approximate Error Present Approximation Measuring Errors 01.02.5 Example 4 The derivative of a function f (x) at a particular value of x can be approximately calculated by f ( x h) f ( x) f ' ( x) h 0.5 x For f ( x) 7e , find the relative approximate error in calculating f (2) using values from h 0.3 and h 0.15 . Solution From Example 3, the approximate value of f (2) 10.263 using h 0.3 f ' (2) 9.8800 using h 0.15 . E a Present Approximation – Previous Approximation 9.8799 10.265 0.38474 The relative approximate error is calculated as Approximate Error a Present Approximation 0.38474 9.8799 0.038942 Relative approximate errors are also presented as percentages. For this example, a 0.038942 100% = 3.8942% Absolute relative approximate errors may also need to be calculated. In this example a | 0.038942 | and 0.038942 or 3.8942% Q: While solving a mathematical model using numerical methods, how can we use relative approximate errors to minimize the error? A: In a numerical method that uses iterative methods, a user can calculate relative approximate error a at the end of each iteration. The user may pre-specify a minimum acceptable tolerance called the pre-specified tolerance, s . If the absolute relative approximate error a is less than or equal to the pre-specified tolerance s , that is, |a | s , then the acceptable error has been reached and no more iterations would be required. Alternatively, one may pre-specify how many significant digits they would like to be correct in their answer. In that case, if one wants at least m significant digits to be correct in the answer, then you would need to have the absolute relative approximate error, |a | 0.5 10 2 m %. 01.02.6 Chapter 01.02 Example 5 If one chooses 6 terms of the Maclaurin series for e x to calculate e 0.7 , how many significant digits can you trust in the solution? Find your answer without knowing or using the exact answer. Solution x2 e 1 x ................. 2! Using 6 terms, we get the current approximation as 0.7 2 0.7 3 0.7 4 0.7 5 e 0.7 1 0.7 2! 3! 4! 5! 2.0136 Using 5 terms, we get the previous approximation as 0.7 2 0.7 3 0.7 4 e 0.7 1 0.7 2! 3! 4! 2.0122 The percentage absolute relative approximate error is 2.0136 2.0122 a 100 2.0136 0.069527% Since a 0.5 10 2 2 % , at least 2 significant digits are correct in the answer of x e 0.7 2.0136 Q: But what do you mean by significant digits? A: Significant digits are important in showing the truth one has in a reported number. For example, if someone asked me what the population of my county is, I would respond, “The population of the Hillsborough county area is 1 million”. But if someone was going to give me a $100 for every citizen of the county, I would have to get an exact count. That count would have been 1,079,587 in year 2003. So you can see that in my statement that the population is 1 million, that there is only one significant digit, that is, 1, and in the statement that the population is 1,079,587, there are seven significant digits. So, how do we differentiate the number of digits correct in 1,000,000 and 1,079,587? Well for that, one may use scientific notation. For our data we show 1,000,000 1 10 6 1,079,587 1.079587 10 6 to signify the correct number of significant digits. Example 5 Give some examples of showing the number of significant digits. Solution a) b) c) d) 0.0459 has three significant digits 4.590 has four significant digits 4008 has four significant digits 4008.0 has five significant digits Measuring Errors e) 1.079 103 has four significant digits f) 1.0790 103 has five significant digits g) 1.07900 103 has six significant digits INTRODUCTION, APPROXIMATION AND ERRORS Topic Measuring Errors Summary Textbook notes on measuring errors Major General Engineering Authors Autar Kaw Date December 23, 2009 Web Site 01.02.7 Chapter 01.03 Sources of Error After reading this chapter, you should be able to: 1. know that there are two inherent sources of error in numerical methods – roundoff and truncation error, 2. recognize the sources of round-off and truncation error, and 3. know the difference between round-off and truncation error. Error in solving an engineering or science problem can arise due to several factors. First, the error may be in the modeling technique. A mathematical model may be based on using assumptions that are not acceptable. For example, one may assume that the drag force on a car is proportional to the velocity of the car, but actually it is proportional to the square of the velocity of the car. This itself can create huge errors in determining the performance of the car, no matter how accurate the numerical methods you may use are. Second, errors may arise from mistakes in programs themselves or in the measurement of physical quantities. But, in applications of numerical methods itself, the two errors we need to focus on are 1. Round off error 2. Truncation error. Q: What is round off error? A: A computer can only represent a number approximately. For example, a number like 1 3 may be represented as 0.333333 on a PC. Then the round off error in this case is 1 0.333333 0.0000003 3 . Then there are other numbers that cannot be represented 3 exactly. For example, and 2 are numbers that need to be approximated in computer calculations. Q: What problems can be created by round off errors? A: Twenty-eight Americans were killed on February 25, 1991. An Iraqi Scud hit the Army barracks in Dhahran, Saudi Arabia. The patriot defense system had failed to track and intercept the Scud. What was the cause for this failure? The Patriot defense system consists of an electronic detection device called the range gate. It calculates the area in the air space where it should look for a Scud. To find out where it 01.03.1 01.03.2 Chapter 01.03 should aim next, it calculates the velocity of the Scud and the last time the radar detected the Scud. Time is saved in a register that has 24 bits length. Since the internal clock of the system is measured for every one-tenth of a second, 1/10 is expressed in a 24 bit-register as 0.00011001100110011001100. However, this is not an exact representation. In fact, it would need infinite numbers of bits to represent 1/10 exactly. So, the error in the representation in decimal format is Figure 1 Patriot missile (Courtesy of the US Armed Forces, ) 1 (0 2 1 0 2 2 0 2 3 1 2 4 ... 1 2 22 0 2 23 0 2 24 ) 10 9.537 10 8 The battery was on for 100 consecutive hours, hence causing an inaccuracy of 3600s s 9.537 10 8 100 hr...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture