LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION LAURA EVANS.. Introduction Not all differential equations can be explicitly solved for y. Tis can be problematic if we need to know te value of y at a specific point. Tis is were metods of numerical integration are useful, as tey allow us to estimate te value of y based on known initial conditions. One of tese metods for numerical integration is Euler s Metod, wic will be te subject of te following discussion. Altoug not te most accurate of metods, it is one of te simplest, wic is useful wen beginning to understand tese metods. Essentially, te metod works by finding te slope at a known, traveling in a small amount in tat direction, ten calculating te new slope and traveling in te direction of te new slope, and so on. Euler s metod is an iterative metod. Consider te initial value problem () y (x) = f(x, y(x)) y(a) = y 0 We proceed in steps of size, so x 0 = a and x n+ = x n +. For eac step, ten, y n+ = y n + f(x n, y n ) Tis allows us to approximate te value of y at a point x, given te initial data. Because of its relative simplicity as a numerical metod, Euler s metod is limited in its scope, as I will discuss in tis paper.. Error Proposition.. Euler s metod produces an answer wit accuracy o(). Date: May 8, 007. Tis discussion is based on material found on Section.8 of Birkoff Rota, wit some inspiration for examples drawn from te Wikipedia entry on Euler s Metod.
LAURA EVANS. Proof. Consider te Taylor expansion of y(x) around a + : But Euler s metod gives y(a + ) = y(a) + y (a) + o( ) y(a + ) = y(a) + y (a) Since te error is te difference between te two equations, we can see tat te error in tis first step is o( ). Te way Euler s metod is commonly used is to set equal to some small fraction of te difference between te desired value and te known value. Tus, te number of steps needed to reac te desired value is o( ), so te total error accumulated upon reacing te desired value is o( ). One consequence of tis is tat if we want an additional decimal place of accuracy in our answer, we must use a new tat is one-tent te original. Tis means we must do a significantly more calculations. Tus, we see tat Euler s metod is not efficient for finding answers to a ig accuracy. 3. Demonstration Let us observe te beavior of solutions found using Euler s metod on te equation y = ky, wit initial value y(0) = for various values of k < 0 We know tat tis equation as solution y(x) = x kt, so we can compare te values given by tis metod to te real values. First, we will consider k =. Te true values and te values given by Euler s metod wit = 0.5 are given below. x y n y 0 0.5 0.5 0.6 0.5 0.37 Clearly, tis is not very accurate. We can improve its accuracy, as we saw above, by decreasing te value of. Te following table sows te same function, wit = 0.
LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION 3 x y n y 0 0. 0.90 0.90 0. 0.8 0.8 0.3 0.73 0.74 0.4 0.66 0.67 0.5 0.59 0.6 0.6 0.53 0.55 0.7 0.48 0.50 0.8 0.43 0.45 0.9 0.39 0.4 0.35 0.37 From tis we see tat te smaller value of gives muc more accurate values for y in our test case. In addition, we can see tat te error does remain less tan, altoug it does increase as x increases. 4. Failure Now, let us consider te same equation as te previous section, but wit larger values of k. In particular, we will look at k = 3, k =, and k =. First, we will use = 0.5. Readers sould note tat all data in te following table is rounded to te second decimal place. x 0 0.5 k = 3 k = k = y n y y n y y n y 0.70 0. -0. 0 -. 0 0.49 0.05 0.0 0. 0 Te values for te first k seem reasonable, but someting seems off about te values tat Euler s metod as given us for k =. Let s decrease to see if te problem goes away. Let s set equal to 0., as before. Again, values are rounded to te second decimal place.
4 LAURA EVANS. x 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 k = 3 k = k = y n y y n y y n y 0.7 0.74 -. 0.33 -. 0. 0.49 0.55 0.0 0.. 0.0 0.34 0.4 0 0.04 -.33 0 0.4 0.3 0 0.0.46 0 0.7 0. 0 0 -.6 0 0. 0.7 0 0.77 0 0.08 0. 0 0 -.95 0 0.06 0.09 0 0.4 0 0.04 0.07 0 0 -.36 0 0.03 0.05 0 0.59 0 From tis, we can see tat te problem as not gone away - in fact, it as gotten worse. Rater tan approximating te curve, te values tat Euler s metod gives for k = oscillate around te curve, wit growing amplitude. Holistically, it is easy to see wat te problem is. Wen te metod makes its step of lengt, it assumes tat y will remain about constant over tat small distance. However, tis is not te case for y = y. Over a distance, y canges relatively largely compared to. Te same is true wenever we ave an equation of te form y = ky, k 0. We can expand tis discussion to realize tat wenever y canges rapidly near y 0, Euler s metod will not be accurate. Tus, use of Euler s metod sould be limited to cases wen max{ y (x 0 ±ɛ) }, for some neigborood ɛ near x 0. 5. Improvements Euler s metod is a first order numerical approximation: eac new value depends only on te value immediately before it. Tis is part of te reason tat it can be affected as we saw previously. One way of improving Euler s metod is to use a second order version: y(a) = y a y = f(a, y 0 ) y n+ = y n + (f(x n, y n ) + f(x n+, y y+ ))
LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION 5 Let us consider wat y is in tis version. y = y 0 + (f(x 0, y 0 ) + f(x, y )) = y a + (y (a) + f(, f(a, y 0 ))) = y a + (y (a) + f(, y (a))) = y a + (y (a) + y (a) + y (a)) = y a + y (a) + y (a) Tis is only o( 3 ) away from te second order Taylor expansion of y(x) near a. By similar reasoning as te proof above, ten, we can assume tat tis will yield muc greater accuracy tan te original, even wit te same. 6. Conclusion After tis exploration of Euler s metod, we ave learned several tings about wen it sould be used and wen oter numerical metods would be more appropriate. In particular, Euler s metod is not te best coice wen y takes on large values near te initial data, nor wen a computationally efficient metod is required. Altoug we can improve te metod sligtly, by considering more tan te immediately previous point, tis improvement is limited. In many cases, ten, Euler s metod is not te most appropriate numerical metod.