# Applied Numerical Methods with MATLAB

(Parte 3 de 16)

, , d.l, and complicated geometries that are not uncommon in engineering and science and that are often impossible to solve analytically with standard calculus. As such" they greatly enhance your problem-solving skills.

2. Numorical methods allow you to use "canned" so-ftware with insight. During your career, you will invariably have occasion to use commercially available prepackaged computer prograrns that involve numerical methods. The intelligent use of these programs is greatly enhanced by an understanding of the basic theory underlying the methods. In the absence of such understanding, you will be left to treat such packages as "black boxes" with little critical insight into their inner workings or the validity of the results they produce.

3. Many problems cannot be approached using canned programs. If you are conversant with numerical methods, and are adept at computer programming, you can design your own programs to solve problems without having to buy or commission expensive software. 4. Nr.rrnerical methods are an efficient vehicle fbr learning to use computers. Because numerical methods ale expressly designed for computer implementation, they are ideal tbr illustrating the conrputer's powers and limitations. When you successfully implement numerical methods on a computer, and then apply them to solve otherwise intractable problenrs, you will be plovided with a dramatic dernonstration of how computers can serve your professional development. At the sarne lime, you rvilI also learn to acknowledge and control the errors of approximation that are part and parcel of large-scale numerical calculations. 5. Numerical methods provide a vehicle fbr you to reinforce your understanding of mathernatics. Because one tunction of numerical methods is to reduce higher mathematics to basic arithmetic operations. they get at the "nuts and bolts" of some otherwise

obscure topics. Enhanced understanding and insight can result from this alternative perspective.

With these reasons lls motivation. we can now set out to understand how numerical methods and digital computers work in tandem to generate reliable solutions to mathematical problems. The remainder of this book is devoted to this task.

1.2 PART ORGANIZATION

This book is divided into six parts. The latter five parts focus on the major areas of numerical methods. Although it might be tempting to jump right into this material, Part One consists of four chapters dealng with essential background material.

Chapter 1 provides a concrete example of how a numerical method can be employed to solve a real problem. To do this, we develop t muthematical model of a fiee-falling bungee jumper. The model, which is based on Newton's second law, results in an ordinary differential equation. After first using calculus to develop a closed-form solution, we then show how a comparable solution can be generated with a simple numerical method. We end the chapter with an overview of the major areers of numerical rnethods that we cover in Parts Two through Sir.

Chapters 2 and 3 provide an introduction to the MATLAB' software environment.

Chapter 2 deals with the standard way of operating MATLAB by entering commands one at a time in the so-called t'alculator nuttle.This interactive mode provides a straightforward means to orient you kl the enviroument and illustrates how it is used ibr common opera-

I.2 PART ORGANIZATION

Chapter -l shows how MATLAB's programming mode provides a vehicle for assembling individual commands into algorithms. Thus, our intent is to illustrate how MATLAB serves as a convenient programming environment to develop your own software.

Chapter I deals with the irnportant topic of error analysis, which must be understood for the effective use of numerical methods. The first part of the chapter focuses on the roundoJf errors thar result because digital computers cannot represent some quantities exactly. The latter part addresses truncation errctrs that arise fiom using an approximation in place of an exact mathematical procedure.

ffilT** TFi +

{.1:i i.t "i'i,r I r,if i

..,,lrfi;

FIGI Forc, f- lI c-

iump

Mothemoticol Modeling, Numericol Methods, ond Problem Solving

The prirnary objective of this chapter is to provide you with a concrete idea of what numerical methods are and how they relate to engineering ancl scientific problem solving. Specific objectives and topics covered are o Learning how mathematical models can be formulated on the basis of scientific principles to simulate the behavior of a simple physical system. r Understanding how numerical methods irlford a means to generate solutions in a rnanner that can be irnplemented on a digital computer. o Understanding the different types of conservation laws that lie beneath the models used in the various engineering disciplines and appreciating the diff'erence between steady-state irnd dynamic solutions of these models. r Learning about the difterent types of numerical methods we will cover in this book.

uppose that a bungee-jumping company hires you. You're given the task of predict- ing the velocity of a jumper (Fig. l.l ) as a function of time during the free-fall part of the jump. This inlbrmation will be used as part of a larger analysis to determine the length and required strength of the bungee cord for jumpers of different mass

You know from your studies ofphysics that the acceleration should be equal to the ratio of the tbrce to the mass (Newton's second law). Based on this insight and your knowledge

Upward force due to air resistance til tilv Downward force due to gravrty of fluid mechanics, you develop the following mathematical model for the rate of change ol'velocity r.r'ith respect to time.

ducd. dt''m where r : vertical velocity (n/s). r : time (s), g : the acceleration due to gravity

(:9.81nls21, ca: a second-order drag coetficient (kg/m), and m: the jumper's mass (kg).

Because this is a ditlerential equation, you know that calculus might be used to obtain an analytical or exact solution for u as a function of /. However, in the following pages, we will illustrate an alternative solution approach. This will involve developing a con.rputeroriented numerical or approximate solution.

Aside from showing you how the computer can be used to solve this particular prob- lem, our more general objective will be to illustrate (a) what numerical methods are and (b) how they figure in engineering and scientific problen solving. In so doing, we will also show how mathematical n.rodels figure prominently in the way engineers and scientists use numerical methods in their work.

I.lA SIMPTE MATHEMATICAT MODET

A motlrcnntical ntodel can be broadly defined as a tbrmulation or equation that expresses the essential features of a physical system or process in mathematical terms. In a very general sense, it can be represented as a functional relationship of the fonn

Deoenden( -/ indenenclent forcine \..'...,_, :J [ '.,, .puran)eters. | (l.l) vanaole \ vanaDtes lunctlons ,f where the de;tendent variable is a characteristic that usually reflects the behavior or state of the system:- the independettt variables are usually dimensions. such as time and space, along which the system's behavior is being determined; the parameters are retlective of the system's properlies or composition; and thelbrring.functiotts are external intluences acting upon it.

The actual mathematical expression of Eq. (1.1) can range from a sirnple algebraic relationship to large complicated sets of diff-erential 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 ntathematical expression, or model, of the second law is the well-known equation

F:ma( t.2) where F is the net force acting on the body (N, or kg nls"), m is the n.rass of the object (kg), and ci is its acceleration (rn/s:).

flGURE l.l

Forces ociing on o lreeJolling bungee iumpet.

6MATHEMATICAL MODELING, NUMERICAL METHODS, AND PROBLEM SOLVING

The second law can be recast in the format of Eq. ( 1. l) by merely dividing both sides by m to give

where a is the dependent variable reflecting the system's behavior, F is the forcing function, and nr is a parameter. Note that for this simple case there is no independent variable because we are not yet predicting how acceleration varies in time or space.

Equation ( 1.3) has a number of characteristics that are typical of mathematical models of the physical world.

. It describes a natural process or system in mathematical terms. . It represents an idealization and sirnplification of reality. That is. the model ignores neg- ligible details of the natural process and focuses on its essential manif'estations. Thus, the second law does not include the effects of relativity that are of minimal importance when applied to objects and forces that interact on or about the earth's surface at velocities and on scales visible to humans.

. Finally, it yields reproducible results and, consequently, can be used fbr predictive purposes. For example, if the force on an object and its mass are known, Eq. ( 1.3) can be used to compLlte acceleration.

Because of its simple algebraic form, the solution of Eq. (1.2) was obtained easily.

However, other mathernatical models of physical phenomena may be much more complex. and either cannot be solved exactly or require more sophisticated mathematical techniques than simple algebra for their solution. To illustrate a more complex model of this kind, Newton's second law can be used to determine the terminal velocity of a free-falling body near the earth's surface. Our falling body will be a bungee jumper (Fig. 1.1). For this case, a model can be derived by expressing the acceleration as the time rate of change of the r,'elocity (tluldr) and substituting it into Eq. (1.3) to yield duF dt nr ( 1.4) where u is velocity (in meters per second). Thus, the rate of change of the velocity is equal to the net force acting on the body normalized to its mass. If the net force is positive, the object will accelerate. Ifit is negative. the object will decelerate. Ifthe net force is zero, the object's velocity will remain at a constant level.

Next, we will express the net force in terms of measurable variables and parameters.

For a body talling witlrin the vicinity of the earth, the net force is composed of two oppos- ing forces: the downward pull of gravity Fp and the upward force of air resistance Fy (Fig.1.1):

F: Fol Fti( 1.5)

If force in the downward direction is assigned a positive sign, the second law can be u.sed to formulate the force due to pravity as

Fo:m8 where g is the acceleration due to gravity (9.81 m/s2). ( 1.6)

I .I A SIMPLE MATHEMATICAL MODEI.7

Air resistance can be fbrmulated in i.i variety of ways. Knowledge from the science of fluid ntechanics suggests that a gtrod first approxirrration wouliJ be to assume that it is pro- portional to the square of the velocitl,,f U: -cdr)' (1.7) where r',1 is a proporticlnalitv constant called the drag coefticient (kg/m). Thus. the greater the fall velocity, the greater the uprvard fbrce due to air resistance. The parameter c./ accounts lbr properties ofthe ialling object, such as shape or surface roughness, that affect air resistance. For the present c&s€, c,7 might be a function of the type of clothing or the orientation used by the jumper during free tall.

The rlet fbrce is the difference between the downward and upwi.rrd force. Therefbre, Eqs. 1.41 through ( 1.7) can be combined to yield dt: ctt t, -,5 dt tn

(Parte 3 de 16)