13.07.2015 Views

Mathematical Methods for Physics and Engineering - Matematica.NET

Mathematical Methods for Physics and Engineering - Matematica.NET

Mathematical Methods for Physics and Engineering - Matematica.NET

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

27.6 DIFFERENTIAL EQUATIONSx h y(exact)0.01 0.1 0.5 1.0 1.5 2 30 (1) (1) (1) (1) (1) (1) (1) (1)0.5 0.605 0.590 0.500 0 −0.500 −1 −2 0.6071.0 0.366 0.349 0.250 0 0.250 1 4 0.3681.5 0.221 0.206 0.125 0 −0.125 −1 −8 0.2232.0 0.134 0.122 0.063 0 0.063 1 16 0.1352.5 0.081 0.072 0.032 0 −0.032 −1 −32 0.0823.0 0.049 0.042 0.016 0 0.016 1 64 0.050Table 27.10 The solution y of differential equation (27.61) using the Euler<strong>for</strong>ward difference method <strong>for</strong> various values of h. The exact solution is alsoshown.27.6.1 Difference equationsConsider the differential equationdy= −y, y(0) = 1, (27.61)dx<strong>and</strong> the possibility of solving it numerically by approximating dy/dx by a finitedifference along the lines indicated in section 27.5. We start with the <strong>for</strong>warddifference( ) dy≈ y i+1 − y i, (27.62)dxx ihwhere we use the notation of section 27.5 but with f replaced by y. Inthisparticular case, it leads to the recurrence relation( ) dyy i+1 = y i + h = y i − hy i =(1− h)y i . (27.63)dxiThus, since y 0 = y(0) = 1 is given, y 1 = y(0 + h) =y(h) can be calculated, <strong>and</strong>so on (this is the Euler method). Table 27.10 shows the values of y(x) obtainedif this is done using various values of h <strong>and</strong> <strong>for</strong> selected values of x. The exactsolution, y(x) =exp(−x), is also shown.It is clear that to maintain anything like a reasonable accuracy only very smallsteps, h, can be used. Indeed, if h is taken to be too large, not only is the accuracybad but, as can be seen, <strong>for</strong> h>1 the calculated solution oscillates (when itshould be monotonic), <strong>and</strong> <strong>for</strong> h>2 it diverges. Equation (27.63) is of the <strong>for</strong>my i+1 = λy i , <strong>and</strong> a necessary condition <strong>for</strong> non-divergence is |λ| < 1, i.e. 0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!