numerical engineering, Slides of Numerical Methods in Engineering

hi this is a numerical methods in engineering good for you!

Typology: Slides

2018/2019

Uploaded on 09/30/2019

qjatjd0307
qjatjd0307 🇰🇷

5

(2)

1 document

1 / 69

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PT1.1 MOTIVATION 11
11
Mathematical Modeling and
Engineering Problem Solving
Knowledge and understanding are prerequisites for the effective implementation of any
tool. No matter how impressive your tool chest, you will be hard-pressed to repair a car if
you do not understand how it works.
This is particularly true when using computers to solve engineering problems. Al-
though they have great potential utility, computers are practically useless without a funda-
mental understanding of how engineering systems work.
This understanding is initially gained by empirical means—that is, by observation and
experiment. However, while such empirically derived information is essential, it is only
half the story. Over years and years of observation and experiment, engineers and scientists
have noticed that certain aspects of their empirical studies occur repeatedly. Such general
behavior can then be expressed as fundamental laws that essentially embody the cumula-
tive wisdom of past experience. Thus, most engineering problem solving employs the two-
pronged approach of empiricism and theoretical analysis (Fig. 1.1).
It must be stressed that the two prongs are closely coupled. As new measurements are
taken, the generalizations may be modified or new ones developed. Similarly, the general-
izations can have a strong influence on the experiments and observations. In particular,
generalizations can serve as organizing principles that can be employed to synthesize ob-
servations and experimental results into a coherent and comprehensive framework from
which conclusions can be drawn. From an engineering problem-solving perspective, such
a framework is most useful when it is expressed in the form of a mathematical model.
The primary objective of this chapter is to introduce you to mathematical modeling
and its role in engineering problem solving. We will also illustrate how numerical methods
figure in the process.
1.1 A SIMPLE MATHEMATICAL MODEL
A mathematical model can be broadly defined as a formulation or equation that expresses
the essential features of a physical system or process in mathematical terms. In a very gen-
eral sense, it can be represented as a functional relationship of the form
Dependent
variable =findependent
variables ,parameters,forcing
functions(1.1)
1
CHAPTER 1
cha01064_ch01.qxd 3/20/09 11:10 AM Page 11
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45

Partial preview of the text

Download numerical engineering and more Slides Numerical Methods in Engineering in PDF only on Docsity!

PT1.1 MOTIVATION 11

11

Mathematical Modeling and

Engineering Problem Solving

Knowledge and understanding are prerequisites for the effective implementation of any tool. No matter how impressive your tool chest, you will be hard-pressed to repair a car if you do not understand how it works. This is particularly true when using computers to solve engineering problems. Al- though they have great potential utility, computers are practically useless without a funda- mental understanding of how engineering systems work. This understanding is initially gained by empirical means—that is, by observation and experiment. However, while such empirically derived information is essential, it is only half the story. Over years and years of observation and experiment, engineers and scientists have noticed that certain aspects of their empirical studies occur repeatedly. Such general behavior can then be expressed as fundamental laws that essentially embody the cumula- tive wisdom of past experience. Thus, most engineering problem solving employs the two- pronged approach of empiricism and theoretical analysis (Fig. 1.1). It must be stressed that the two prongs are closely coupled. As new measurements are taken, the generalizations may be modified or new ones developed. Similarly, the general- izations can have a strong influence on the experiments and observations. In particular, generalizations can serve as organizing principles that can be employed to synthesize ob- servations and experimental results into a coherent and comprehensive framework from which conclusions can be drawn. From an engineering problem-solving perspective, such a framework is most useful when it is expressed in the form of a mathematical model. The primary objective of this chapter is to introduce you to mathematical modeling and its role in engineering problem solving. We will also illustrate how numerical methods figure in the process.

1.1 A SIMPLE MATHEMATICAL MODEL

A mathematical model can be broadly defined as a formulation or equation that expresses the essential features of a physical system or process in mathematical terms. In a very gen- eral sense, it can be represented as a functional relationship of the form

Dependent variable = f

independent variables , parameters, forcing functions

(1.1)

C H A P T E R 11

where the dependent variable is a characteristic that usually reflects the behavior or state of the system; the independent variables are usually dimensions, such as time and space, along which the system’s behavior is being determined; the parameters are reflective of the system’s properties or composition; and the forcing functions are external influences acting upon the system. The actual mathematical expression of Eq. (1.1) can range from a simple algebraic re- lationship to large complicated sets of differential equations. For example, on the basis of his observations, Newton formulated his second law of motion, which states that the time rate of change of momentum of a body is equal to the resultant force acting on it. The math- ematical expression, or model, of the second law is the well-known equation

F = ma (1.2)

where F = net force acting on the body (N, or kg m/s 2 ), m = mass of the object (kg), and a = its acceleration (m/s^2 ).

12 MATHEMATICAL MODELING AND ENGINEERING PROBLEM SOLVING

Implementation

Numeric or graphic results

Mathematical model

Problem definition

THEORY DATA

Problem-solving tools: computers, statistics, numerical methods, graphics, etc.

Societal interfaces: scheduling, optimization, communication, public interaction, etc.

FIGURE 1. The engineering problem- solving process.

14 MATHEMATICAL MODELING AND ENGINEERING PROBLEM SOLVING

Air resistance can be formulated in a variety of ways. A simple approach is to assume that it is linearly proportional to velocity 1 and acts in an upward direction, as in FU = − c v (1.7) where c = a proportionality constant called the drag coefficient (kg/s). Thus, the greater the fall velocity, the greater the upward force due to air resistance. The parameter c ac- counts for properties of the falling object, such as shape or surface roughness, that affect air resistance. For the present case, c might be a function of the type of jumpsuit or the orien- tation used by the parachutist during free-fall. The net force is the difference between the downward and upward force. Therefore, Eqs. (1.4) through (1.7) can be combined to yield d v dt

mgc v m

(1.8)

or simplifying the right side, d v dt

= g

c m

v (1.9)

Equation (1.9) is a model that relates the acceleration of a falling object to the forces act- ing on it. It is a differential equation because it is written in terms of the differential rate of change ( d v/ dt ) of the variable that we are interested in predicting. However, in contrast to the solution of Newton’s second law in Eq. (1.3), the exact solution of Eq. (1.9) for the ve- locity of the falling parachutist cannot be obtained using simple algebraic manipulation. Rather, more advanced techniques such as those of calculus, must be applied to obtain an exact or analytical solution. For example, if the parachutist is initially at rest (v = 0 at t = 0), calculus can be used to solve Eq. (1.9) for

v( t ) =

gm c

1 − e −( c / m ) t^

(1.10)

Note that Eq. (1.10) is cast in the general form of Eq. (1.1), where v( t ) = the depen- dent variable, t = the independent variable, c and m = parameters, and g = the forcing function.

EXAMPLE 1.1 Analytical Solution to the Falling Parachutist Problem Problem Statement. A parachutist of mass 68.1 kg jumps out of a stationary hot air bal- loon. Use Eq. (1.10) to compute velocity prior to opening the chute. The drag coefficient is equal to 12.5 kg/s. Solution. Inserting the parameters into Eq. (1.10) yields

v( t ) =

1 − e −(^12.^5 /^68.^1 ) t^

1 − e −^0.^18355 t^

which can be used to compute

(^1) In fact, the relationship is actually nonlinear and might better be represented by a power relationship such as FU = − c v^2. We will explore how such nonlinearities affect the model in a problem at the end of this chapter.

t, s v, m/s 0 0. 2 16. 4 27. 6 35. 8 41. 10 44. 12 47.  53.

According to the model, the parachutist accelerates rapidly (Fig. 1.3). A velocity of 44.87 m/s (100.4 mi/h) is attained after 10 s. Note also that after a sufficiently long time, a constant velocity, called the terminal velocity, of 53.39 m/s (119.4 mi/h) is reached. This velocity is constant because, eventually, the force of gravity will be in balance with the air resistance. Thus, the net force is zero and acceleration has ceased.

Equation (1.10) is called an analytical, or exact, solution because it exactly satisfies the original differential equation. Unfortunately, there are many mathematical models that cannot be solved exactly. In many of these cases, the only alternative is to develop a nu- merical solution that approximates the exact solution. As mentioned previously, numerical methods are those in which the mathematical problem is reformulated so it can be solved by arithmetic operations. This can be illustrated

1.1 A SIMPLE MATHEMATICAL MODEL 15

0

0

20

40

4 8 12 t , s

v , m/s

Terminal velocity

FIGURE 1. The analytical solution to the falling parachutist problem as computed in Example 1.1. Velocity increases with time and asymptotically approaches a terminal velocity.

later time ti + 1. This new value of velocity at ti + 1 can in turn be employed to extend the computation to velocity at ti + 2 and so on. Thus, at any time along the way, New value = old value + slope × step size

Note that this approach is formally called Euler’s method.

EXAMPLE 1.2 Numerical Solution to the Falling Parachutist Problem

Problem Statement. Perform the same computation as in Example 1.1 but use Eq. (1.12) to compute the velocity. Employ a step size of 2 s for the calculation. Solution. At the start of the computation ( ti = 0), the velocity of the parachutist is zero. Using this information and the parameter values from Example 1.1, Eq. (1.12) can be used to compute velocity at ti + 1 = 2 s:

v = 0 +

[

]

2 = 19 .60 m/s

For the next interval (from t = 2 to 4 s), the computation is repeated, with the result

v = 19. 60 +

[

]

2 = 32 .00 m/s

The calculation is continued in a similar fashion to obtain additional values:

t, s v, m/s 0 0. 2 19. 4 32. 6 39. 8 44. 10 47. 12 49.  53.

The results are plotted in Fig. 1.5 along with the exact solution. It can be seen that the numerical method captures the essential features of the exact solution. However, because we have employed straight-line segments to approximate a continuously curving function, there is some discrepancy between the two results. One way to minimize such discrepan- cies is to use a smaller step size. For example, applying Eq. (1.12) at l-s intervals results in a smaller error, as the straight-line segments track closer to the true solution. Using hand calculations, the effort associated with using smaller and smaller step sizes would make such numerical solutions impractical. However, with the aid of the computer, large num- bers of calculations can be performed easily. Thus, you can accurately model the velocity of the falling parachutist without having to solve the differential equation exactly.

As in the previous example, a computational price must be paid for a more accurate numerical result. Each halving of the step size to attain more accuracy leads to a doubling

1.1 A SIMPLE MATHEMATICAL MODEL 17

of the number of computations. Thus, we see that there is a trade-off between accuracy and computational effort. Such trade-offs figure prominently in numerical methods and consti- tute an important theme of this book. Consequently, we have devoted the Epilogue of Part One to an introduction to more of these trade-offs.

1.2 CONSERVATION LAWS AND ENGINEERING

Aside from Newton’s second law, there are other major organizing principles in engineer- ing. Among the most important of these are the conservation laws. Although they form the basis for a variety of complicated and powerful mathematical models, the great conserva- tion laws of science and engineering are conceptually easy to understand. They all boil down to

Change = increases − decreases (1.13)

This is precisely the format that we employed when using Newton’s law to develop a force balance for the falling parachutist [Eq. (1.8)]. Although simple, Eq. (1.13) embodies one of the most fundamental ways in which conservation laws are used in engineering—that is, to predict changes with respect to time. We give Eq. (1.13) the special name time-variable (or transient ) computation. Aside from predicting changes, another way in which conservation laws are applied is for cases where change is nonexistent. If change is zero, Eq. (1.13) becomes

Change = 0 = increases − decreases or Increases = decreases (1.14)

18 MATHEMATICAL MODELING AND ENGINEERING PROBLEM SOLVING

0

0

20

40

4 8 12 t , s

v , m/s

Terminal velocity

Exact, analytical solution

Approximate, numerical solution

FIGURE 1. Comparison of the numerical and analytical solutions for the falling parachutist problem.

20 MATHEMATICAL MODELING AND ENGINEERING PROBLEM SOLVING

TABLE 1.1 Devices and types of balances that are commonly used in the four major areas of engineering. For each case, the conservation law upon which the balance is based is specified.

Structure

Civil engineering Conservation of momentum

Chemical engineering

Field Device Organizing Principle Mathematical Expression

Conservation of mass

Force balance:

Mechanical engineering Conservation of momentum

Machine Force balance:

Electrical engineering Conservation of charge Current balance:

Conservation of energy Voltage balance:

Mass balance: Reactors Input^ Output

Over a unit of time period mass = inputs – outputs

At each node  horizontal forces ( F (^) H ) = 0  vertical forces ( F (^) V ) = 0

For each node  current ( i ) = 0

Around each loop  emf’s –  voltage drops for resistors = 0   –  iR = 0

  • FV
  • FV
  • FH + FH
  • i 2

  • i 1 – i 3

Circuit i 1 R 1

i 3 R 3

i 2 R 2 

Upward force

Downward force

x = 0

m d = downward force – upward force (^2) x dt^2

PROBLEMS 21

Finally, the electrical engineering applications employ both current and energy bal- ances to model electric circuits. The current balance, which results from the conservation of charge, is similar in spirit to the flow balance depicted in Fig. 1.6. Just as flow must bal- ance at the junction of pipes, electric current must balance at the junction of electric wires. The energy balance specifies that the changes of voltage around any loop of the circuit must add up to zero. The engineering applications are designed to illustrate how numerical methods are actually employed in the engineering problem-solving process. As such, they will permit us to explore practical issues (Table 1.2) that arise in real-world applications. Making these connections between mathematical techniques such as numerical methods and engineering practice is a critical step in tapping their true potential. Careful examina- tion of the engineering applications will help you to take this step.

TABLE 1.2 Some practical issues that will be explored in the engineering applications at the end of each part of this book.

  1. Nonlinear versus linear. Much of classical engineering depends on linearization to permit analytical solutions. Although this is often appropriate, expanded insight can often be gained if nonlinear problems are examined.
  2. Large versus small systems. Without a computer, it is often not feasible to examine systems with over three interacting components. With computers and numerical methods, more realistic multicomponent systems can be examined.
  3. Nonideal versus ideal. Idealized laws abound in engineering. Often there are nonidealized alternatives that are more realistic but more computationally demanding. Approximate numerical approaches can facilitate the application of these nonideal relationships.
  4. Sensitivity analysis. Because they are so involved, many manual calculations require a great deal of time and effort for successful implementation. This sometimes discourages the analyst from implementing the multiple computations that are necessary to examine how a system responds under different conditions. Such sensitivity analyses are facilitated when numerical methods allow the computer to assume the computational burden.
  5. Design. It is often a straightforward proposition to determine the performance of a system as a function of its parameters. It is usually more difficult to solve the inverse problem—that is, determining the parameters when the required performance is specified. Numerical methods and computers often permit this task to be implemented in an efficient manner.

PROBLEMS

1.1 Use calculus to solve Eq. (1.9) for the case where the initial velocity, v( 0 ) is nonzero. 1.2 Repeat Example 1.2. Compute the velocity to t = 10 s, with a step size of (a) 1 and (b) 0.5 s. Can you make any statement re- garding the errors of the calculation based on the results? 1.3 Rather than the linear relationship of Eq. (1.7), you might choose to model the upward force on the parachutist as a second- order relationship,

FU = − c ′v^2

where c ′^ = a second-order drag coefficient (kg/m).

(a) Using calculus, obtain the closed-form solution for the case where the jumper is initially at rest (v = 0 at t = 0). (b) Repeat the numerical calculation in Example 1.2 with the same initial condition and parameter values. Use a value of 0.225 kg/m for c ′. 1.4 For the free-falling parachutist with linear drag, assume a first jumper is 70 kg and has a drag coefficient of 12 kg/s. If a second jumper has a drag coefficient of 15 kg/s and a mass of 75 kg, how long will it take him to reach the same velocity the first jumper reached in 10 s? 1.5 Compute the velocity of a free-falling parachutist using Euler’s method for the case where m = 80 kg and c = 10 kg/s. Perform the

where P is the gas pressure, V is the volume of the gas, Mwt is the molecular weight of the gas (for air, 28.97 kg/kmol), and R is the ideal gas constant [8.314 kPa m 3 /(kmol K)]. 1.11 Figure P1.11 depicts the various ways in which an average man gains and loses water in one day. One liter is ingested as food, and the body metabolically produces 0.3 L. In breathing air, the ex- change is 0.05 L while inhaling, and 0.4 L while exhaling over a one-day period. The body will also lose 0.2, 1.4, 0.2, and 0.35 L through sweat, urine, feces, and through the skin, respectively. In order to maintain steady-state condition, how much water must be drunk per day?

PROBLEMS 23

(b) For the case where drag is negligible, use the chain rule to ex- press the differential equation as a function of altitude rather than time. Recall that the chain rule is

d v dt

= d v dx

dx dt

(c) Use calculus to obtain the closed form solution where v = v 0 at x = 0. (d) Use Euler’s method to obtain a numerical solution from x = 0 to 100,000 m using a step of 10,000 m where the initial veloc- ity is 1400 m/s upwards. Compare your result with the analyti- cal solution. 1.13 Suppose that a spherical droplet of liquid evaporates at a rate that is proportional to its surface area.

dV dt

= − k A

where V = volume (mm 3 ), t = time (min), k = the evaporation rate (mm/min), and A = surface area (mm 2 ). Use Euler’s method to compute the volume of the droplet from t = 0 to 10 min using a step size of 0.25 min. Assume that k = 0.1 mm/min and that the droplet initially has a radius of 3 mm. Assess the validity of your re- sults by determining the radius of your final computed volume and verifying that it is consistent with the evaporation rate. 1.14 Newton’s law of cooling says that the temperature of a body changes at a rate proportional to the difference between its tempera- ture and that of the surrounding medium (the ambient temperature), dT dt = − k ( TTa )

where T = the temperature of the body (°C), t = time (min), k = the proportionality constant (per minute), and Ta = the ambient tem- perature (°C). Suppose that a cup of coffee originally has a temper- ature of 68°C. Use Euler’s method to compute the temperature from t = 0 to 10 min using a step size of 1 min if Ta = 21°C and k = 0.1/min. 1.15 Water accounts for roughly 60% of total body weight. As- suming it can be categorized into six regions, the percentages go as follows. Plasma claims 4.5% of the body weight and is 7.5% of the total body water. Dense connective tissue and cartilage occupies 4.5% of the total body weight and 7.5% of the total body water. In- terstitial lymph is 12% of the body weight, which is 20% of the total body water. Inaccessible bone water is roughly 7.5% of the total body water and 4.5% total body weight. If intracellular water is 33% of the total body weight and transcellular water is 2.5% of the total body water, what percent of total body weight must the transcellular water be and what percent of total body water must the intracellular water be?

Figure P1.

Skin Urine

BODY

Food

Drink

Feces

Sweat

Air

Metabolism

1.12 In our example of the free-falling parachutist, we assumed that the acceleration due to gravity was a constant value of 9.8 m/s 2. Although this is a decent approximation when we are examining falling objects near the surface of the earth, the gravitational force decreases as we move above sea level. A more general representa- tion based on Newton’s inverse square law of gravitational attrac- tion can be written as

g ( x ) = g ( 0 ) R^2 ( R + x )^2

where g ( x ) = gravitational acceleration at altitude x (in m) mea- sured upwards from the earth’s surface (m/s^2 ), g (0) = gravitational acceleration at the earth’s surface (∼= 9 .8 m/s^2 ), and R = the earth’s radius (∼= 6. 37 × 106 m). (a) In a fashion similar to the derivation of Eq. (1.9) use a force balance to derive a differential equation for velocity as a func- tion of time that utilizes this more complete representation of gravitation. However, for this derivation, assume that upward velocity is positive.

1.16 Cancer cells grow exponentially with a doubling time of 20 h when they have an unlimited nutrient supply. However, as the cells start to form a solid spherical tumor without a blood supply, growth at the center of the tumor becomes limited, and eventually cells start to die. (a) Exponential growth of cell number N can be expressed as shown, where μ is the growth rate of the cells. For cancer cells, find the value of μ. d N dt

= μ N

(b) Write an equation that will describe the rate of change of tumor volume during exponential growth given that the diameter of an individual cell is 20 microns. (c) After a particular type of tumor exceeds 500 microns in diam- eter, the cells at the center of the tumor die (but continue to take up space in the tumor). Determine how long it will take for the tumor to exceed this critical size. 1.17 A fluid is pumped into the network shown in Fig. P1.17. If Q 2 = 0. 7 , Q 3 = 0. 5 , Q 7 = 0 .1, and Q 8 = 0 .3 m^3 /s, determine the other flows.

Figure P1.

1.18 The following information is available for a bank account:

Date Deposits Withdrawals Interest Balance 5/1 1512. 220.13 327. 6/ 216.80 378. 7/ 450.25 106. 8/ 127.31 350. 9/

Q 1

Q 10 Q 9 Q 8

Q 3 Q 5

Q 2 Q 4 Q 6 Q 7

24 MATHEMATICAL MODELING AND ENGINEERING PROBLEM SOLVING

Note that the money earns interest which is computed as Interest = i Bi where i = the interest rate expressed as a fraction per month, and Bi the initial balance at the beginning of the month. (a) Use the conservation of cash to compute the balance on 6/1, 7/1, 8/1, and 9/1 if the interest rate is 1% per month ( i = 0.01/month). Show each step in the computation. (b) Write a differential equation for the cash balance in the form d B dt = f ( D ( t ), W ( t ), i )

where t = time (months), D ( t ) = deposits as a function of time ($/month), W ( t ) = withdrawals as a function of time ($/month). For this case, assume that interest is compounded continuously; that is, interest = i B. (c) Use Euler’s method with a time step of 0.5 month to simulate the balance. Assume that the deposits and withdrawals are ap- plied uniformly over the month. (d) Develop a plot of balance versus time for (a) and (c). 1.19 The velocity is equal to the rate of change of distance x (m), dx dt = v( t ) (P1.19)

(a) Substitute Eq. (1.10) and develop an analytical solution for dis- tance as a function of time. Assume that x ( 0 ) = 0. (b) Use Euler’s method to numerically integrate Eqs. (P1.19) and (1.9) in order to determine both the velocity and distance fallen as a function of time for the first 10 s of free fall using the same parameters as in Example 1.2. (c) Develop a plot of your numerical results together with the analytical solutions.

3.1 SIGNIFICANT FIGURES 53

of the two major forms of numerical error: round-off error. Round-off error is due to the fact that computers can represent only quantities with a finite number of digits. Then Chap. 4 deals with the other major form: truncation error. Truncation error is the discrepancy in- troduced by the fact that numerical methods may employ approximations to represent exact mathematical operations and quantities. Finally, we briefly discuss errors not directly con- nected with the numerical methods themselves. These include blunders, formulation or model errors, and data uncertainty.

3.1 SIGNIFICANT FIGURES

This book deals extensively with approximations connected with the manipulation of num- bers. Consequently, before discussing the errors associated with numerical methods, it is useful to review basic concepts related to approximate representation of the numbers themselves. Whenever we employ a number in a computation, we must have assurance that it can be used with confidence. For example, Fig. 3.1 depicts a speedometer and odometer from an automobile. Visual inspection of the speedometer indicates that the car is traveling between 48 and 49 km/h. Because the indicator is higher than the midpoint between the markers on the gauge, we can say with assurance that the car is traveling at approximately 49 km/h. We have confidence in this result because two or more reasonable individuals reading this gauge would arrive at the same conclusion. However, let us say that we insist that the speed be estimated to one decimal place. For this case, one person might say 48.8, whereas another might say 48.9 km/h. Therefore, because of the limits of this instrument,

40

8 7 3 2 4 4 5

0 120

20

40

60 80

100

FIGURE 3. An automobile speedometer and odometer illustrating the concept of a significant figure.

only the first two digits can be used with confidence. Estimates of the third digit (or higher) must be viewed as approximations. It would be ludicrous to claim, on the basis of this speedometer, that the automobile is traveling at 48.8642138 km/h. In contrast, the odome- ter provides up to six certain digits. From Fig. 3.1, we can conclude that the car has trav- eled slightly less than 87,324.5 km during its lifetime. In this case, the seventh digit (and higher) is uncertain. The concept of a significant figure, or digit, has been developed to formally designate the reliability of a numerical value. The significant digits of a number are those that can be used with confidence. They correspond to the number of certain digits plus one estimated digit. For example, the speedometer and the odometer in Fig. 3.1 yield readings of three and seven significant figures, respectively. For the speedometer, the two certain digits are

  1. It is conventional to set the estimated digit at one-half of the smallest scale division on the measurement device. Thus the speedometer reading would consist of the three signifi- cant figures: 48.5. In a similar fashion, the odometer would yield a seven-significant-figure reading of 87,324.45. Although it is usually a straightforward procedure to ascertain the significant figures of a number, some cases can lead to confusion. For example, zeros are not always signifi- cant figures because they may be necessary just to locate a decimal point. The numbers 0.00001845, 0.0001845, and 0.001845 all have four significant figures. Similarly, when trailing zeros are used in large numbers, it is not clear how many, if any, of the zeros are significant. For example, at face value the number 45,300 may have three, four, or five significant digits, depending on whether the zeros are known with confidence. Such uncertainty can be resolved by using scientific notation, where 4. 53 × 104 , 4.530 × 104 , 4.5300 × 104 designate that the number is known to three, four, and five significant figures, respectively. The concept of significant figures has two important implications for our study of numerical methods: 1. As introduced in the falling parachutist problem, numerical methods yield approximate results. We must, therefore, develop criteria to specify how confident we are in our approximate result. One way to do this is in terms of significant figures. For example, we might decide that our approximation is acceptable if it is correct to four significant figures. 2. Although quantities such as π, e , or

7 represent specific quantities, they cannot be expressed exactly by a limited number of digits. For example,

π = 3. 141592653589793238462643...

ad infinitum. Because computers retain only a finite number of significant figures, such numbers can never be represented exactly. The omission of the remaining significant figures is called round-off error_._

Both round-off error and the use of significant figures to express our confidence in a numerical result will be explored in detail in subsequent sections. In addition, the concept of significant figures will have relevance to our definition of accuracy and precision in the next section.

54 APPROXIMATIONS AND ROUND-OFF ERRORS

engineering design. In this book, we will use the collective term error to represent both the inaccuracy and the imprecision of our predictions. With these concepts as background, we can now discuss the factors that contribute to the error of numerical computations.

3.3 ERROR DEFINITIONS

Numerical errors arise from the use of approximations to represent exact mathematical op- erations and quantities. These include truncation errors, which result when approximations are used to represent exact mathematical procedures, and round-off errors, which result when numbers having limited significant figures are used to represent exact numbers. For both types, the relationship between the exact, or true, result and the approximation can be formulated as

True value = approximation + error (3.1)

By rearranging Eq. (3.1), we find that the numerical error is equal to the discrepancy be- tween the truth and the approximation, as in

E (^) t = true value − approximation (3.2)

where E (^) t is used to designate the exact value of the error. The subscript t is included to des- ignate that this is the “true” error. This is in contrast to other cases, as described shortly, where an “approximate” estimate of the error must be employed. A shortcoming of this definition is that it takes no account of the order of magni- tude of the value under examination. For example, an error of a centimeter is much more significant if we are measuring a rivet rather than a bridge. One way to account for the mag- nitudes of the quantities being evaluated is to normalize the error to the true value, as in

True fractional relative error =

true error true value where, as specified by Eq. (3.2), error = true value − approximation. The relative error can also be multiplied by 100 percent to express it as

ε t =

true error true value

where ε t designates the true percent relative error.

EXAMPLE 3.1 Calculation of Errors Problem Statement. Suppose that you have the task of measuring the lengths of a bridge and a rivet and come up with 9999 and 9 cm, respectively. If the true values are 10,000 and 10 cm, respectively, compute ( a ) the true error and ( b ) the true percent relative error for each case. Solution. (a) The error for measuring the bridge is [Eq. (3.2)] E (^) t = 10 , 000 − 9999 = 1 cm

56 APPROXIMATIONS AND ROUND-OFF ERRORS

and for the rivet it is E (^) t = 10 − 9 = 1 cm

(b) The percent relative error for the bridge is [Eq. (3.3)]

ε t =

and for the rivet it is

ε t =

Thus, although both measurements have an error of 1 cm, the relative error for the rivet is much greater. We would conclude that we have done an adequate job of measuring the bridge, whereas our estimate for the rivet leaves something to be desired.

Notice that for Eqs. (3.2) and (3.3), E and ε are subscripted with a t to signify that the error is normalized to the true value. In Example 3.1, we were provided with this value. How- ever, in actual situations such information is rarely available. For numerical methods, the true value will be known only when we deal with functions that can be solved analytically. Such will typically be the case when we investigate the theoretical behavior of a particular technique for simple systems. However, in real-world applications, we will obviously not know the true answer a priori. For these situations, an alternative is to normalize the error using the best available estimate of the true value, that is, to the approximation itself, as in

ε a =

approximate error approximation

where the subscript a signifies that the error is normalized to an approximate value. Note also that for real-world applications, Eq. (3.2) cannot be used to calculate the error term for Eq. (3.4). One of the challenges of numerical methods is to determine error estimates in the absence of knowledge regarding the true value. For example, certain numerical methods use an iterative approach to compute answers. In such an approach, a present approxima- tion is made on the basis of a previous approximation. This process is performed repeat- edly, or iteratively, to successively compute (we hope) better and better approximations. For such cases, the error is often estimated as the difference between previous and current approximations. Thus, percent relative error is determined according to

ε a =

current approximation − previous approximation current approximation

This and other approaches for expressing errors will be elaborated on in subsequent chapters. The signs of Eqs. (3.2) through (3.5) may be either positive or negative. If the approx- imation is greater than the true value (or the previous approximation is greater than the current approximation), the error is negative; if the approximation is less than the true value, the error is positive. Also, for Eqs. (3.3) to (3.5), the denominator may be less than

3.3 ERROR DEFINITIONS 57