# Applied Numerical Methods with MATLAB

(Parte 4 de 16)

Ecluation (1.8) is a ntodel that relates the accelerirtion of a falling object to the tbrces acting on it. It is a tli/Jerential equtttiort because it is written in ternts of the differential rate of change (d u I dt 1 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.8) for the velocity of the jumper cannot be obtirined using simple algebraic manipulation. Rather, more adt'anced techniques such as those of calculus nrust be applied to obtain an exact or

analytical solution. For example, if the jumper is initially at rest (r., : 0 at / : 0), calculus can be used to solve Eq. ( 1.8) for

( 1.9) where tanh is the hyperbolic tangent that can be either computed directlyr or via the more elementary exponential function as in e' - e-' tanh-t: (1.10) e., *e \

Note that Eq. ( 1.9) is cast in the general fbrm of Eq. (1.1) where t,(/) is the dependent variable. t is the independent variable , ctt and m are parameters, and g is the forcing function.

Anolyticol Solution to the Bungee Jumper Problem

Problem Stotement. A bungee jumper with a mass of 68.1 kg leaps liom a stationary hot air balloon. Use Eq. ( 1.9) to compute velocity fbr the first l2 s of fiee fall. Also deterr-nine the terminal velocity that will be attained fbr an infinitely long corcl (or alternatively, the jumprraster is having a particuiarly bad dayl). Use a drag coefticient of 0.25 kg/m.

I MATLABG'allows direcr calculation of the hypcrbolic tangent via thc built-in function rdnh (r).

u(/) :r,f*"n(,8,)yilt / EXAMPLE I .I

MATHEMATICAL MODELING, NUMERICAL METHODSAND PROBTEM SOLVING Solution. Inserting the parameters into Eq. (1.9) yields which can be used to compute t, 3u,mfs o I B 72,92 3 I I tB 42 4762 46 9575 4S 42t 4 50 6175 5 1 6938

According to the model, the jumper accelerates rapidly (Fig. 1.2). A velocity of 49.4214 m/s (about 110 mi/h) is attained after 10 s. Note also that after a sufficiently lons

FIGURE I.2

The onolyticol solution for the bungee iumper problem os compured in Exomple I 1 Velociry increoses with time ond osympfoiicolly opprooches o terminol velociiy.

] .I A SIMPLE MATHEMATICAL MODEL9 time, a constant velocity. called the terminol velocitt', of 51.6983 m/s (115.6 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 ( I .9) is called an anabtical or closed-form solution because it exactly satisfies the oliginal diffbrential equation. Unfortunately, tlrere are mirny matlrematical nrodels that cannot be solved exactly. In many of these cases, the only alternative is to develop a numerical solution that approximates the exact solution.

Nttnterical ntethods are those in which the mathemirtical problerr is refbrmulated so it can be solved by arithmetic operations. This can be illustrated for Eq. ( 1 .8) by realizing that the time tate of change of velocity can be approximated by (Fig. 1.3):

dtt

-dt

AuNdtt dt

- Au u(/i+r) - u(ti)

Lt ti+t - ti (r.lr) where Au and At are differences in velocity and time computed overflnite intervals, u(r1) is velocity at an initial time ri, and u(ria;) is velocity at some later time f11. Note that du ldt = Lu I Lt is approximate because Ar is flnite. Remember from calculus that

- lim A1+l)

Equation ( l. I I ) represents the reverse process.

FIGURE I.3 The use of o finite difference to opproximote the firsf derlvotive of u wifh respect io /

Approximate slopeAr_u(1,*,) -u(r,) Lt li+t - ti toMATHEMATICAL MODELING, NUMERICAL MEIHODS, AND PROBLEM SOLVING

Equation ( 1.1 I ) is callecl a Jinite-diJJeren.ce opprcrirnation of the derivative Jt Iirnc /, . It can be substituted into Eq. (1.8) to give

 r'(1,,1)-u(t,l .J ):g t.t/7)-

tr+t * t; tn.

This equation can then be rearrangecl to yielcl

( r. r2)

Notice that the tenn in brackets is the right-hand side of the diff'erential equation itself tEq. (1.8)1. That is, it provides a means to compute the rate of change or slope of u. Thus, the equat.ion can be rewritten as ui+r :r+'!u (t.13) {1t where the nomenclature u; clesignates velocity attinle /i and At : ti+t - ti.

We can now see that the differential equation has been transformed into an equation that can be used to determine the velocity algebraically at ri+l using the slope and previous values of u and t. If you are given an initial value for velocity at some time l;, you can easily com-

pute velocity at a later time f 1 . This new value of velocity at l;1 can in tum be employed to extend the cornputation to velocity at l;12 and so on. Thus at any time along the way,

New valne : old vahle * slope x step size

This approach is tbrnraly caled Euler's metlnd. We'l discuss it in more detail when we turn to diff'erential equations later in this book.

EXAMPLE 1 .2 Numericol Soluiion to the Bungee Jumper Problem

' Problem Stoiement. Perform the same cornpLltation as inExample 1.1but use Eq. (J.13) to colnpute velocity with Euler's method. Employ a step size of 2 s fbr the calculation.

Solution. At the start of the computation (/{) :0), the velocity of the jumper is zero.

Using this infbrmation and the parameter values from Example I . I , Eq. ( 1.13) can be used to corxpute velocity at 1 - 2 s:

r, : o * fr.r' - H,o,rl x 2 : te.62rls L 68.r I

For the next interval lfiom r : 2 b 4 sJ, the colnplrtation is repeated, with the result l- 0.2s .1: l().62 + 19.81 -,(19.62t-l " l:16.4117m/s L 68.t r u(/i+r ) : u(/i) -1_ [r - 9lrt,,f(/,+r - /i)

I .1 A SIMPLE MATHEMATICAL MODELtt Terminal velocity

FIGURE I.4 Compcrison of the numericol ond onclyticol solutions for the bungee iumper problem

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

u, m/s

0 r9.6200

36.4137 46 2983 50 r 802 5 t 3123 5 r 6008 5r 6938

The results are plotted in Fig. 1.4 along with the exact solution. We can see that the numerical method captures the essential features of the exact solution. However, because we have employed straighfline segments to approximate a continuously curving function, there is some discrepancy between the two results. One way to minimize such discrepancies is to use a smaller step size. Forexample, applying Eq. (1.13) at 1-s intervals results in a smaller error, as the straighrline 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 numbers of calculations can be performed easily. Thus, you can accurately model the velocity of the jumper without having to solve the differential equation exactly.

ttS

B r0 l2 o r2MATHEMATICAL MODELINGNUMERICAL METHODS, AND PROBLEM SOLVING

As in Example 1.2, a cornputational price nrust be paid for a nrore accurate numerical result. Each halving of the step size to attain morc accuracy leads to a doubling of the nurnber of computations. Thus, we see that there is a trade-off between accuracy and computa- tional effort. Such trade-offs figure prominently in numerical methods and constitute an important theme of this book.

1.2 CONSERVATION L/AWS lN ENGINEERING AND SCIENCE

(Parte 4 de 16)