Upload
anand-tr
View
219
Download
0
Embed Size (px)
Citation preview
7/30/2019 The Modified Euler Method
1/4
6.2.2. The Modified Euler Method
The Euler method can be modified so that each step is accurate to O(h2). As an
example, consider the pair of 1
st
order equations [ cf. the rabbits-foxes equations(6.7) ],
( ),r R r f =& and ( ),f F r f=& (6.9)
The modified Euler equations are
[ ] [ ]( )1 1 21
2k k
r r h R k R k +
= + +
[ ] [ ]( )1 1 21
2k k
f f F R k R k+
= + + (6.10)
where
1k kt t h+
= + ( )k kr r t= ( )k kf f t=
[ ] ( )1 ,k kR k R r f= [ ] ( )1 ,k kF k F r f=
[ ] [ ] [ ]( )2 1 1,k kR k R r hR k f hF k= + +
[ ] [ ] [ ]( )
2 1 1,
k kF k F r hR k f hF 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, thetrajectory 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 ifh is too large [ see Fig.6.7, where h= 0.570 ]. Indeed, the quality
of the solution has already begun to deteriorate forh= 0.565 [see Fig.6.6]. As
always, trade-off must be made.
http://var/www/apps/conversion/tmp/scratch_6/06-3.nbhttp://var/www/apps/conversion/tmp/scratch_6/06-3.nb7/30/2019 The Modified Euler Method
2/4
As another illustration of the damages that an outsized h can do, consider the ODE
10y y = (6.11)
with ( )0 1y = . The exact solution is easily found to be ( ) 10xy x e
= . Applying the
Euler method, we get
110
k k ky y h y
+= ( )1 10 kh y= (6.12)
To see the effects of increasing h, we start with a relatively small value ofh= 0.05.
The results calculated from (6.12) are tabulated as follows
k 0 1 2 3 4
yk 1 0.5 0.25 0.12
5
0.0625
yexact 1 0.60
7
0.36
8
0.22
3
0.135
where we have also listed the exact values to 3 significant digits.
Forh= 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, ifh= 0.15, then
k 0 1 2 3 4
y
k
1 0.
5
0.2
5
0.12
5
0.0625
Thus, the solution oscillates instead of decaying exponentially any resemblance to
the actual solution has been lost.
7/30/2019 The Modified Euler Method
3/4
Fig.6.5. Modified Euler algorithm applied to r-fequations.
Fig.6.6. Behavior ofr-fequations forh= 0.565 in modified Euler code.
7/30/2019 The Modified Euler Method
4/4
Fig.6.7. Onset of numerical instability in modified Euler code forh= 0.570.