Академический Документы
Профессиональный Документы
Культура Документы
R2 [ k ] = R ( rk + hR1 [ k ] , f k + hF1 [ k ] ) F2 [ k ] = F ( rk + hR1 [ k ] , f k + hF1 [ k ] ) [See 6.3.1 for a hint of proof.] Application to the rabbits-foxes equations is described in Example 6-3: Modified Euler Algorithm 06-3.nb The phase space trajectory for the same parameters as used in Example 6-2, except for the change from n = 1000 to n = 2000, is plotted in Fig.6.5. Significant improvements over the Euler result are evident. In particular, the trajectory remains a closed loop, as it should, even after twice the number of steps as taken in Example 6-2. A price to pay for the higher accuracy is more complicated calculations at each step. Thus, the modified version is always slower that the original Euler method. One way to lessen this penalty is to increase the step size h. Unfortunately, the solution tends to become unstable if h is too large [ see Fig.6.7, where h = 0.570 ]. Indeed, the quality of the solution has already begun to deteriorate for h = 0.565 [see Fig.6.6]. As always, trade-off must be made.
As another illustration of the damages that an outsized h can do, consider the ODE y = 10 y (6.11)
10 x with y ( 0 ) = 1 . The exact solution is easily found to be y ( x ) = e . Applying the
To see the effects of increasing h, we start with a relatively small value of h = 0.05. The results calculated from (6.12) are tabulated as follows k yk yexact 0 1 1 1 0.5 0.60 7 2 0.25 0.36 8 3 0.12 5 0.22 3 4 0.0625 0.135
where we have also listed the exact values to 3 significant digits. For h = 0.1, eq(6.12) gives yk = 0 for all k = 1, 2, 3, . It should come as no surprise that instability sets in for h > 0.1. For example, if h = 0.15, then k y
k
0 1
1 0. 5
2 0.2 5
3 0.12 5
4 0.0625
Thus, the solution oscillates instead of decaying exponentially any resemblance to the actual solution has been lost.