- Simple Euler method comes from using just one term from the Taylor series for y(x) expanded about .
- What if we use more terms of the Taylor series? Runge and Kutta, developed algorithms from using more than two terms of the series.
- In the Euler method, the increment is directly from to .
- Second-order Runge-Kutta methods are obtained by using a weighted average of two increments to
and .
- Let's take a "trial step" in the middle and then increment to by using these middle x- and y-values. Two quantities are defined here as and ,
- The local error term for the fourth-order Runge-Kutta method is ; the global error would be .
- It is computationally more efficient than the (modified) Euler method because the steps can be manyfold larger for the same accuracy.
- However, four evaluations of the function are required per step rather than two.
- Let's apply the RK4 method on the previous example. Given differential equation,
- The analytical solution of this equation is given as
. Initial condition:
Table 5.2:
Solution of the differential equation in the interval [0, 1] by 4th order Runge-Kutta method.
|
(Example py-file:
myrungekutta.py)
As can be seen from the Table, much more sensitive results are obtained compared to the Euler method.
Figure 5.2:
Solution of the differential equation in the interval [0, 1] by Euler method.
|