**UFBA**

# Applied Numerical Methods with MATLAB

(Parte **6** de 16)

Ilr=0

I V Downward force m Li = downward force - upward force

I.3 NUMERICAL METHODS COVERED IN THIS BOOKr5 lal Part 2: Roots and optimization f(xl

Roots: Solve for.r so thatfi-r) = 0 Optimization: Solve for x so that/'(r) = 0 lbl Part 3: Linear algebraic equations f\x\ Given the a's and the b's. solve for the.r's a',rxt t ar2x.a= b, arrx, 1- a,x, = b2

ldl Part 5: Integration and differentiation

Integration: Find the area under the curve Differentiation: Find the slooe of the curve lel Part 6: Differential equations Given dv Av,h : N:flt'Yl solve for r as a function of r

.,Ii+r = -]'i + "f(ti, yJAr

FIGURE I.6 Summory of the numericol methods covered in this book.

Optima lcl Part 4: Curve fitting o t6MATHEMATICAL MODELING, NUMERICAT METHODS, AND PROBLEM SOLVING

Part Two deals with two related topics: root finding and optimization. As depicted in

Fig. 1.6a, root locotiorr involves searching for the zeros of a function. In contrast, optimizarion involves determining a value or values of an independent variable that correspond to a "best" or optirnal value of a function. Thus, as in Fig. 1 .6a, optimization involves identifying maximir and minima. Although somewhat different approaches are used, root location and optimization both typically arise in design contexts.

Part Three is devoted to solving systems of simultaneous linear algebraic equations

(Fig. 1.6&). Such systerns are similar in spirit to l'oots of equations in the sense that they are concemed with values that satisfy equations. However, in contrast to satistying a single equatiou, a set of values is sought that simultaneously satisfies a set of linear algebraic equations. Such equations arise in a variety of problem contexts and in all disciplines of engineeriug and science. In particular, they originate in the mathenratical modeling of Jarge systems of interconnected elements such as structures, electric circuits. and fluid networks. However, they are also encountered in other areas of numerical methods such as curve titling lrnd differential equutions.

As an engineer or scientist. you will often have occasion to fit curves to data points. The techniques developed for this pulpose can be divided into two general categories: regression and interpolation. As described in Part Four tFig. 1.6c'1, regression is ernployed where there is a significant degree of error associirted with the data. Experimental results are often of this kind. For these situations. the strategy is to derive a single curve that represents the general trend of the data without necessarily matching any individual points.

In contrast, interpolution is used where the objective is to determine intermediate values between relatively error-free data points. Such is usually the case for tabulated information. The strategy in such cases is to flt a curve directly through the data points and r.rse the curve to predict the intermediate values.

As depicted in Fig. 1.6d, Part Five is devoted to integlation and differentiation. A plrysical interpretation of ruurrcricctl iltegratiott is tlre determination of the area under a curve. Integration has many applications in engineering and science, ranging from the determination of the centroids of oddly shaped objects to the calculation of total quantities based on sets of discrete measurements. In addition, nurnerical integration formulas play an importtrnt role in the solution of diffbrential equations. Part Five also covers methods for nume.rical difr'erentiation. As you know fiom your study of calculus, this involves the determination of a function's slope or its rate of change.

Finally. Part Si.x focuses on the solution of ordirro'v di.fterential equations (Fig. 1.6e).

Such equations are of great significance in all areirs of engineering and science. This is because many physical laws are couched in terms of the rate of change of a quantity rather than the magnitude of the quantity itself. Examples range from population-forecasting rnodels (rate ofchange of population) to tlre acceleration of a tallin-e body (rate ofchange ofvelocity). Two types of problems are addressed: initial-value and boundary-value problems.

PROBLEMS t7 l.l Use calculus to velity that Eq. (1.9) is a Eq. (1.8). 1.2 The following infbrmation is availablc acc0unt:

Dote Deposits Withdrowols solution of for a bank

Bolonce

6/l

9ll

5ir

7/l Bit

2t6 B0 ,r(n r< t 27 .31

327.26 378 61 r06 80 350 6r

Use the conservation of cash to compute the balance on 6/ l, 1.811, and 9/1. Show each stcp in thc computation. ls this a steady-state or a transient computation?

1,3 Repeat Example 1.2. Compute thc velocity to t: l2 s, with a step size of (a) I and (b) 0.5 s. Can you make any statement regarding the crrors of thc calculation based on the results? 1.4 Rather than the nonlinear rclationship of Eq. ( 1.7), you might choose to model the upward fbrce on the bungee jumpcr as a linear relationrhip:

wherer'' : a first-order drag coefTicient (kg/s). (a) Using calculus, obtain the closed-fbnn solution fbr thc case where thejurnper is initially at rcst (u : 0 at 1: 0). (b) Repeat the numerical calculation in Example 1.2 with the same initial condition and oarameter values. Use a value of 12.5 kg/s fbr c'.

1.5 For the free-talling bungee jumper with linear drag (Prob. I .4). assume a first jumper is 70 kg and has a drag co- efficient of l2 kg/s. If a secondjurnper has a drag coefficient of 15 kg/s and a mass of 75 kg, how long will it take her to reach the same velocity jumpcr I rcached in l0 s'l 1.6 For the fiee-falling bungce jumper with linear drag (Prob. 1.4), compule the velocity of a free-talling parachutist usrng Er-rler's method fbr thc casc whcre r : 80 kg and c' : l0 kg/s. Perfbrm thc calculation from / : 0 to 20 s with a step size of I s. Use an initial condition that the parachutist has an upward vclocity of 20 m/s at /: 0. At r: l0 s, assume that the chute is instantaneously deployed so that thc drag cocllicient jumps to 50 kg/s.

1.7 Thc amount of a uniformly distributed radioactive contaminant contained in a closed reactor is measured by its concentration c (becquerel/liter or Bq/L). The contaminant decrcases a1 a decay rate proportional to its concentration; that is

Decay rate : -tc

I 5 I 2 . 3 3 where ft is a constant with units of day I . Thercfore, accord- ing to Eq. (1.14), a rrass balance fbr the reactor can be wntten as dc kt dt

/ changc \ / decrease \t."t:t,l\ in mars / \ Ul decaS /

(a) Use Euler's mcthod to solve this equation from t : 0 to

I dwith k:0.2dr.Employastepsize of Ar:0. I d. The concentration at /:0 is l0 Bq/L. (b) Plot the solution on a semilog graph (i.e., ln c versus /) and detennine the slopc. Intcrpret your results.

l l A storage tank (Fig. Pl.8) contains a liquid at depth ) where ,r' : 0 when the tank is half full. Liquid is withdrawn at a constant flow rate Q to meet demands. The contents are resupplied at a sinusoidal rate 3Q sin2(t). Equation (1.14) can be written fbr this systcrn as d( Av'\-+ :30sin'(r) - O AT

/chanee in\| ,' l: tinflowt - (outflow) \ votume /

FIGURE PI.8 r8MATHEMATICAL MODELING, NUMERICAL METHODS, AND PROBLEM SOTVING or, since the surface area A is constant r/t'O.O: :3: sin-ft) _ : drAA

Use Euler's method to solve for the depth _v fron-r r : 0 to I0 d with a step size of 0.5 d. The parameter values are A :

1200 m2 and p : 500 m3/d. Assume that the initial condition is.y : 0. 1.9 For the same storage tank described in Prob. 1.8, suppose that the outflow is not constant but rather depends on the depth. For this case, the differential equation fbr depth can be written as nr the heat capacity, and thc change in temperature by the following relationship:

The mass of air can be obtained liom the ideal sas larv:

Plt : -P7 Mwt where P is the gas pressure, V is lhe volume of the gas, Mwt is the molecular weight of the gas (1br air 28.97 kg/krnol), and rR is the ideal gas constant [8.31,1 kPa m]/(kmol K)]. 1.12 Figure P1.12 depicts the various ways in which an aver- ilge man gains and loses water in one day. One liter is ingested as food, and the body metabolically produces 0.3 liters. In breathing air, the exchange is 0.05 liters while inhaling, and 0.4 liters while exhaling over a one-day period. The body will also lose 0.2, 1.4.0.2. and 0.35 liters through sweat, urine, feces, and through the skin, respectively. To maintain steady state, how much water must be drunk per day? l.13 In our example of the fiee-falling parachutist, we assumed that the acceleration due to gravity was a constant value of 9.8 m/s2. Although this is a decent approxinration when we are examining falling objects near the surtace of the earth, the gravitational lbrce decreases as we lrove above sea level. A rnore general representation based on Newton's inverse square law of gravitational attraction can be written as

R: s(x) : g(0) -(l(+.r)' o : - Ir': c,dr : nrc,,(rz - r) dl'dt

O . a(ltr')r = .1; sin-(r t - A

Use Euler's method to solve for the depth )' fiom t : 0 to 10 d with a step siz-e of 0.5 d. The parameter values are A :

1200 m2, O:500 mr/d, and cv: -300. Assurne that the initial condition is _r : 0.

1.10 The volume flow rate through a pipe is given by Q : rA, whele u is the average velocity and A is the cross- sectional area. Use volume-continuity to solve for the required area in pipe 3 of Fig. P I . 10. l.l A group of 30 students attend a class in a room which lneasures l0 m by 8 m by 3 m. Each student takes up about 0.075 mr and gives out about 80 W of heat (l W = I J/s). Calculate the air temperature rise during the first l5 minutes of the class if the room is completely sealed and insulated. Assume the heat capacity C,. tbr air is 0.7 18 kJ/(kg K). As- sume air is an ideal gas at 20 "C and 101.325 kPa. Note that the heat absorbed by the air O is related to the mass of the air

Qr.in =Qz'rt: 20 m3/s u.,ou, = 6 m/s A:=?

(Parte **6** de 16)