step-by-step integration of ordinary differential …€¦ · step-by-step integration of ordinary...

Click here to load reader

Upload: others

Post on 30-Apr-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

  • 359

    STEP-BY-STEP INTEGRATION OF ORDINARYDIFFERENTIAL EQUATIONS*

    ByS. C. R. DENNIS**

    Weizmann Institute of Science, Rehovot, Israel

    1. Introduction. Finite-difference methods of integration of differential equationsare usually based on the assumption that, locally, the wanted function may be representedby a polynomial function of the independent variable (or variables, in the case of partialdifferential equations). Polynomial assumption is not necessarily, however, the onlystarting point. Recently, Allen and Southwell (1) found it desirable to employ othertypes of approximating functions when dealing with certain second-order partial dif-ferential equations. Investigation of their approximations (2) suggests that they have•substantial merit in certain cases. In the present paper we shall investigate a step-by-step integration process for ordinary differential equations which is based on Allen andSouthwell's type of approximating function. An investigation of the type we considermakes it necessarily limited in detail. In fact, we shall limit detailed work to the im-portant linear, second-order, initial value problem

    y" + p(x)y' + q(x)y = r(x) (1)with

    y(x0) = y0 , y'(x0) = y'o , (2)

    where primes denote differentiation with respect to the real variable x and p, q and rare given functions of x. This problem occurs frequently enough to merit attention;and it should become clear that the process may be extended to many other importantproblems.

    A convenient and simple special case of (1) with which to start is the equation

    y" + q(x)y = 0, (3)where, in physical applications, q{x) is often of the form q(x) = \p(x) —

  • 360 S. C. R. DENNIS [Vol. XX, No. 4

    wherein(x) = qm , (xm-i < x < xm), (to = 1,2, ••• , ft). (5)

    In the interval (zm_i , x„) this function satisfies

    4>'n'(x) + qmn(x) =0, (6)

    and an expression for

  • 1963] STEP-BY-STEP INTEGRATION OF ORDINARY DIFFERENTIAL EQUATIONS 361

    i.e.

    n(x) = n(0) cos a0x + sin aoX.«o

    We consider #„(0) and 0'(O) determined by continuity with values at the end of theprevious interval. Putting x = h gives

    4>n(h) =

  • 362 S. C. R. DENNIS [Vol. XX, No. 4

    both correct to order h3, i.e. although the first of Eqs. (11) may be true in general in (0, h),the case x = h leads to a special result. We shall calculate the error term in the nextsection, but before doing so we state the formulae corresponding to Eq. (1). They arenecessarily more complicated. In the typical interval (0, h), n{x) satisfies

    4>'n'(x) + Po'n(x) + qan{x) = T0 .

    For convenience, introduce the function

    Xn(x) = n(x) - -pQo

    and write

    &(0) = x«0) + hpoxM-The formulae may then be written

    (13)Xn(h) = e p°h/2{xn(0) cosy oh + — sinioli)

    To

    Xn(h) = e~p°h/2 {P„(0) costoh - YoXn(O) sin y0h] — %p0Xn(h)

    where

    To = (?o - IPo)'/2.

    Here Xnfa) is a discontinuous function as we pass from interval to interval, since it isn(x) that must preserve continuity.

    As a practical illustration when a first derivative is present, consider an equationwhich occurs in Cochran's solution (5) for the viscous fluid motion near a rotating disc.The problem is

    G" - HG' + H'G = 0,

  • 1963] STEP-BY-STEP INTEGRATION OP ORDINARY DIFFERENTIAL EQUATIONS 363

    TABLE 2

    00.20.40.60.81.0

    Eqs. (13)

    n(x)

    1.0000.8790.7630.6570.5620.479

    K(x)

    -0.616-0.598-0.557-0.504-0.447-0.390

    Cochran

    G(x)

    1.0000.8780.7620.6560.5610.468*

    G'(x)

    -0.616-0.599-0.558-0.505-0.448-0.391

    This value is an obvious misprint and should probably read 0.478.

    (and for identical reasons) the calculated values of n{%) and 4>'J,X) are both correct tothe same order of accuracy.

    3. Investigation of the error term. Let the solution y(x) of Eq. (3) be defined in thetypical interval (0, h) with given initial values 2/(0), y'{0). Expand q(x) in (0, A) as theFourier cosine series

    CO

    q(x) = a0 + 2 a, cos (n-irx/h) (15)71= 1

    and we may write Eq. (3) as

    y" 1^0 + 2^(1, cos (n7nz//i)J?/ = 0. (16)

    With minor changes, this is equivalent to Hill's differential equation (cf. Whittakerand Watson (6)) and accordingly we assume a solution

    y(x) = e** ± creir"/h. (17)r = —oo

    Substituting in Eq. (16) and equating coefficients of exp (ju + irirx/h) to zero we obtainthe infinite set of linear algebraic equations

    c„ + ± an„rcr = 0, (» = • • • , -2, -1, 0, 1, 2, • • •),

    wherea_, = ar (r = 0, 1, 2, • • •)•

    Putting

    „ = ah br = Kar , (18)7T 7T

    these equations become

    [(? + in)2 + b0]cn + bn-rcr , (r ^ n), = 0. (19)r = —oo

    Eqs. (19) are homogeneous in cr and the values of v for which solutions exist in whichnot all the cr are zero are given by the vanishing of a determinant A(iv) of Hill's type.

  • 364 S. C. R. DENNIS [Vol. XX, No. 4

    Its properties are well known and need not further be discussed, since the only resultof importance for present purposes is that if v = is a root, so is v = —vr and that thesetwo are the only roots which lead to distinct solutions in the form of Eq. (17). We shalldenote these roots simply by ±i>, to which correspond ±m by the first of Eqs. (18).

    In obtaining solutions of Eqs. (19) we can without loss put o0 = 1. Putting n = 0gives the equation

    v* + b0 = 5„ , (20)

    where

    S0 — b\(fi\ ~j~ C_j) b^(c^ ~f" C-2) • • ■ • (21)'

    and the remaining equations are

    (50 — n2 + 2ivn)c„ + bn = S„ , (22)

    where in general

    S„ = — X bn-rCr , fy ̂ U, T 0) . (23)r = — co

    Consider now the orders (with respect to h) of the quantities involved. By definition

    1 rha" = h J C°S (niTX/h) ̂x> (n ~ 0) I; 2, • • •), (24)

    so a0 = 0(1) certainly, and hence b0 = 0(h2). It is more difficult to be precise aboutthe order of a„ when n 0 for the most general q(x) we might consider but suppose,to be definite, that q(x) is continuous in (0, h). Then certainly an = 0(h) if n ^ 0, soK = 0(h3).

    It now follows that the first-order solution obtained by neglecting 8n in Eq. (22), viz.

    bncn ■' nl + (l + f) (25)

    satisfies these equations formally with an error 0(he). For this approximation yieldsc„ = 0(h3); moreover, ^ | c„ | converges and the bn are bounded, so the 5„ exist. Hence8„ = 0(h6). Furthermore, an even lower-order approximation to the solution of Eqs. (19)is obtained by neglecting even the approximate cn compared with c0 . Eq. (20) then gives

    f = ±ibl/2

    i.e.

    H = ±ia0 , (26)

    where— J'2a0 = a0 .

    Putting c0 = 1, cr = 0, (r ^ 0), in Eq. (17) gives two approximate solutions correspond-ing to the roots (26) and we can combine them in the form

    n(x) = 4>n(0) cos ctoX + —- sin auxdo

  • 1963] STEP-BY-STEP INTEGRATION OF ORDINARY DIFFERENTIAL EQUATIONS 365

    valid in (0, h). Since a0 is precisely the q0 defined by Eq. (10), this is the 4>n{x) previouslydiscussed.

    To find the precise effect of the error terms on the step-by-step formulae (9), ingeneral let the numbers c„ , (n = ±1, ±2, • • •), be any set of coefficients satisfyingEqs. (19) with a corresponding root n = ia and write

    A„ = c„ + c-n ; B„ = cn — c_„ .

    Then there is a corresponding fundamental solution y — u(x) in the form of Eq. (17),.where we can write

    u(x) = e'ax\ji(x) + if2(x)]

    with

    'h(x) = 1 + X cos (niTx/h),71 = 1

    CO

    f2(x) = ^ Bn sin (mrx/h).n = 1

    It is easy to show quite generally (cf. the approximation (25) to c„) that the coefficients-which satisfy Eqs. (19) with the root n = — ia involve only a change in sign in B„so a second solution is y — v(x), where

    v(x) = e~'axUi(x) - if2(x)].

    The general solution can now be written in the form

    y(x) = Ci[/i(x) cos ax — J2(x) sin ax] + C2[ji(x) sin ax + f2(x) cos ax].

    Making it satisfy the initial conditions, we obtain

    r r = y'(°)1 /i(0) ' °2 aUi0) + m'

    and step-by-step formulae follow if we put x = h in y(x) and y'(x).Confining attention to the special case of the approximation (25), let us write

    & - ± A. , &= £(-l)*+M„. (27)'n = 1 n = 1

    Then h(0) = 1 + , /i(/i) = 1 — S2 and from Eq. (25) we readily deduce that

    «/i(o) + urn = «d - so, m + am = «u + s2), mso that the step-by-step formulae are

    y(h) = y(o) cos ah + a(-11 _ ^ 2/'(°)sin ah

    y'Qi) = j ^ y'{0) cos ah - a^ ^ y{0) sin ah.

    (29)

    These formulae give only approximations to y(h) and y'(h), of course, but it is not con-venient to introduce special notation. For these approximations, formal justificationof the analysis follows readily enough if we assume q(x) bounded in (0, h). For then

  • 366 S. C. R. DENNIS [Vol. XX, No. 4

    | a„ | < K/n, where K is a positive constant, by well-known results of Fourier series,so h (x) and j[(x) and a fortiori f2(x), j'2(x) converge absolutely and uniformly in (0, h).The series (15) converges uniformly to q(x) in any interior interval of (0, h) in whichq(x) is continuous so, by Abel's test, f['(x) and f"(x) converge uniformly in the sameinterval justifying, to the given order of approximation, the satisfaction of the differentialequation (16) by the solution (17); and only slight modifications in the arguments arenecessary to extend the scope of Eqs. (29) when, subject to suitable initial conditionsfor 2/(0) and y'(0), q(x) is any function satisfying Dirichlet's conditions in (0, h), e.g.q{x) = x~1/2 with the initial condition y(0) = 0.

    If we neglect and S2 it is legitimate, within the same order of accuracy, to makea = a0 = q)f2. It is now clear that n(h) and 4>'n(K) are both correct to the same order,being 0(h3) if q(x) is continuous. This interesting result, that there is no loss of accuracyin the differentiated function, is true only for x = h, of course, the reason being thatwhereas the differentiated series f'2(x) makes a contribution to the step-by-step formulaewhen we put x = h, the differentiated series j[ (x) does not. The former series dependsonly on c„ — c_„ which, because of its dependence on v, always contains one higher powerOf h than c„ + c_„ .

    Next consider the modifications if we introduce a function r(x) on the right handside of Eq. (3). Let y(x) denote the solution of this new equation in (0, h) with initialvalues ?/(0) and y'{0). Put y(x) =

  • 1963] STEP-BY-STEP INTEGRATION OP ORDINARY DIFFERENTIAL EQUATIONS 367

    so that g(x) = d0/a0 , with neglect of terms in h3. Adding this particular solution to ourprevious approximation (to the same order of accuracy) to the general solution of Eq. (3),we arrive at an approximating function n{x) which satisfies in (0, h) the equation

    4>"(x) + alr&) = r0 ,

    where1 Ph

    r0 = do = ^ J r(x) dx.

    We are therefore led to the same step-by-step formulae (13) or, more correctly, to thesimplified form that results from putting p0 = 0, viz.

    (33)x'(0)Xn(h) = x»(0) cos a0h + —— sin a0h,

    a0

    Xn(h) = Xn(0) cos a0h - aoXn(O) sin a0h,_

    with

    Xn(x) = 4>n(x) — ^?o

    as before. Again there is no additional loss of accuracy in the derivatives predicted byEqs. (33) for, although a loss of accuracy clearly results when we differentiate g(x),this does not affect the step-by-step formulae, since by hypothesis g'(0) = g'{h) = 0.

    A second approximation to the solution of Eqs. (32) can be obtained, neglectingterms of order only he. Here we must retain the terms in b0 since in general these areOQi2). The approximation is

    do _ 2(cobn 6n) / -i oC° = — , Cn = —2 r— , (n = 1, 2, • • •)• (34)

    LI o 71 U o

    It leads to ^-values at the ends of the interval

    ff(0) = ^ + S3, g(h) = ^~ S

  • 368 S. C. R. DENNIS [Vol. XX, No. 4

    while b'n = ha J ir, the a'n being Fourier coefficients of the series (15) when p(x) replacesq(x). Again we may verify that a first approximation is

    Co = 1, c„ = 0(h3), (n ^ 0), (36)

    provided that p(x) and q(x) are continuous in (0, h). The approximation to the c„ comesfrom the equations

    [(v + in)2 + b'0(v + in) + b0]cn + vb'n + bn = 0

    and although b'n = 0(h2) in general, v = 0(h) so c„ = 0(h3). Corresponding to the ap-proximation (36) we determine two ^-values from the equation

    v2 + b'0v + b0 = 0,

    i.e.

    /X2 + a'0n + a0 = 0. (37)

    Subsequent analysis follows more or less as before, although it is more complicated;we shall not give the details. When r(x) ^ 0 we get the same particular solution g(x) —da/a0 , with an error of order h3, to the complete equation (1). Adding it to the approxi-mate general solution of the reduced equation, we arrive at the approximating function

    n{x) = C, e*11 + C2 e"" + 19 ,1o

    and hence to the step-by-step formulae (13). The details of the analysis show that theseformulae again predict approximations to n{h) and (f>'„(h) which are both correct toterms of order h3.

    4. Higher order approximations. If we retain the error terms Si and S2 in Eqs. (29),we will obtain a more accurate approximation to the solution of Eq. (3). We can expressJS, and S2 more conveniently in terms of definite integrals by making use of the results,valid in (0, h),

    and

    where

    cosh 2p.x = tn + 2 ?. L cos (nirx/h) (38)

    cosh 2jii(x — h) = t0 + 2 X) (—!)"/„ cos (n-rrx/h), (39)

    _ 2vh sinh 2vh (-!)"_ ( _ n 2 ,

    The summations required are

    e - v1 an j o 2h2 ( — 1 )n+1a„1 — 2 „2 _i xi 2 and 02 — 2 2-i 1 . 2 •7T n + Av 7r^w+4y

    To find Si , multiply the left hand side of Eq. (39) by q(x) and the right hand side bythe equivalent series (15) and integrate each side from x = 0 to x = h. A similar operation

  • 1963] STEP-BY-STEP INTEGRATION OF ORDINARY DIFFERENTIAL EQUATIONS 369

    applied to Eq. (38) gives S2 , and both operations are valid by well-known results ofFourier series. Simplifying and putting fi = ia we obtain

    (S'i = ~2 ~ ~—-1 0 , [ q(x) cos 2a (x — h) dx,4a 2a sin 2ah J 0

    o—-1 0 , f q(x) cos 2ax dx —2a sm 2ah Jn 4a

    (40)

    It remains to consider the accuracy of the formulae (29) in a little more detail.The error involved in Eq. (25) is in general 0(h6) but we have to examine whether anyaccuracy is lost when we differentiate the corresponding approximate solution for y(x).We shall omit the details, merely quoting the result that, as in the case of our first ap-proximation, the error term in c„ — e_n appears to one higher power in h than in on + c_„and this is sufficient to ensure that there is no loss of accuracy in the differentiatedsolution at x — h. But we have yet to consider the effect of making the approximation(26) to n, i.e. we have to find an appropriate value of a to substitute in Eqs. (29) and(40). Put v = iha/ir in Eq. (20) and substitute in S0 using Eq. (25). This gives

    -2 7^7-2 , (41)7T n — 4/i a /ir

    i.e.2OL = O'O 4" 0(/&4).

    Now let us expand the terms cos ah and sin ah in Eqs. (29) in powers of h, thus

    y(h) = 2/(0)(i - Wh2 +•••) + y'mh - +•••),

    y'ih) = y'(0)(1 - \a2tf +•••)- y(0)(ah - ia4h3 +•••)•

    (42)

    Assuming for the moment that we have computed accurate enough values of $1 and S2 ,it is clear that putting a = a\/2 in the first of Eqs. (42) will involve only an error of orderh6, but in the second the term ah will lead to an error of order h5. If we want to avoidthis we must compute a more accurate value of a2 using Eq. (41) and, moreover, thisvalue will then serve to substitute in Eqs. (40) to find Si and S2 without any furtherdrop in accuracy below the general level h6 we are working to. The series in Eq. (41)must be very rapidly convergent and the first term or two will suffice.

    It is interesting to note that the higher order approximation to the solution y(x)does not involve any further differentiations beyond the order of the differential equation;and although we have assumed q(x) continuous for the sake of stating definite ordersof accuracy this is not necessary. In most practical problems, however, q{x) will becontinuous in a given interval (0, h). It may then be convenient to evaluate the integralsin Eqs. (40) by numerical quadrature, e.g. if we assume q(x) to be parabolic in (0, h)we can easily obtain the results

    Si + & ~ (i - - «K0)]

    Si - S2 ~ [3(1 g/0t^ - l][ff(0) + q(h) - 2q(m,

  • (43)

    370 S. C. R. DENNIS [Vol. XX, No. 4

    or, if we expand tan ah and cot ah in powers of h and neglect terms in A6 and above,these become

    S» + S2 ~ j2 A2(l + |a2A2)[g(0) - q(h)]

    S> - S2 ~ ^ ft2(l + ^aV)[g(0) + ?(A) - 2?(^)].

    The results are expressed in this way for convenience but, in fact, since

    (1 + SO"1 = 1 -S, + 0(h°)and

    (1 - SO"1 = 1 + 5, + OQt),we can express Eqs. (29) entirely in terms of St + S2 , Sx — S2 ; and the advantage ofEqs. (43) is that we can calculate explicitly the first-order error terms very simplybefore we start a computation.

    Similar results apply to the terms

  • 1963] STEP-BY-STEP INTEGRATION OF ORDINARY DIFFERENTIAL EQUATIONS 371

    As an example of a non-homogeneous equation we have computed an approximatesolution to the problem

    y" + (3 - x2)y = 2, y{0) = 0, y'{0) = 1.

    Although here r{x) is constant, this is hardly a special simplification as the operativefunction in finding Sa and 4G = g expto the problem

    g" + {W - \H2)g = 0,

  • 372 S. C. R. DENNIS [Vol. XX, No. 4

    differential equation, although the details would need consideration. Certain non-linearequations could also be treated. For example, the well-known Blasius' problem

    y"' + yy" = 0, y( 0) = y'( 0) = o, y"( 0) = kcould be treated by using a function 4>n(x) which satisfies, in a typical interval (0, h),the equation

    4>'n"(x) + P.&n'tx) = 0,

    setting up step-by-step formulae in the manner we have indicated in this paper, anddetermining p0 for the given interval from the transcendental equation

    hp0 = [ 4>Jx) dx.J 0

    The object of the paper, therefore, is to suggest a possible approach which might some-times be fruitful, since it must be agreed that no method of numerical integration canhope to solve every problem with uniformly satisfactory results.

    References

    1. D. N. de G. Allen and R. V. Southwell, Relaxation method applied to determine the motion, in twodimensions, of a viscous fluid past a fixed cylinder, Quart. J. Mech. 8, 129-145 (1955)

    2. S. C. R. Dennis, Finite differences associated with second-order differential equations, Quart. J. Mech.13, 487-507 (1960)

    3. E. L. Ince, Ordinary differential equations, Dover, New York, 19264. C. de la Valine Poussin, Cours d'analyse infinit&imale 2, Louvain, 1928, pp. 127-1515. W. G. Cochran, The flow due to a rotating disc, Proc. Camb. Phil. Soc. 30, 365-375 (1934)6. E. T. Whittaker and G. N. Watson, Modern analysis, The University Press, Cambridge, 1935, pp.

    413-417