0

I am trying to understand Explicit Runge-Kutta method to solve system of ODEs. First I tried Euler's as below,

$ \frac{dy_1}{dt} = f_1(y_1,y_2, ..y_n) \\ \frac{dy_2}{dt} = f_2(y_1,y_2, ..y_n) $

Euler's method, the value y at step i+1

$ y_1^{i+1} = y_1^i + h\, f_1(y_1^i,y_2^i,...,y_n^i) $

But it did not provide good solutions, then I turned to Runge Kutta,

$ k_1 = f_1(y_1^i) \\ k_2 = f_1( y_1^i + 0.5 \, h \,k_1) \\ \vdots \\ y_1^{i+1} = y_1^i + \frac{h}{0.6} \, (k_1+2k_2+2k_3+k_4) $

is this correct way of doing it?

Emmet B
  • 125

1 Answers1

1

First of all, the RK4 method is generally the best method with regards to stability and accuracy.

It looks correct, have you tried implementing it?

Furthermore, you can try explicit Euler with a smaller $h$ if you do not have problem of computational effort.

Try also some 2-step methods, like Adam-Bashfort, or other RK, like adaptive RK2-3, Rk4-5 and so on.

7raiden7
  • 1,794
  • yes it gives much better than Euler. I was not sure about the RK method, I asked to clarify. Euler gives good results when step size is very small and for large number of iteration, though I need to decrease the number of iterations. I will check your suggestions, though I am not familiar with 2-step methods. – Emmet B Mar 04 '14 at 09:01
  • 2
    If you need to decrease the number of iteration try the adaptive RK4-5.

    This method uses a RK5 to control the error of the main RK4 method, so that you will find the maximum grid size for which the method produces an error within the set tolerance.

    Otherwise, try to use the implicit version of codes of above, just to be sure that stability region is maximised.

    Finally, the implementation of 2-step methods is quite straightforward, nothing more than 1-step.

    – 7raiden7 Mar 04 '14 at 09:05
  • Indeed it was very straightforward, now I will try this adaptive RK4-5 and the other points you mentioned, thanks. – Emmet B Mar 04 '14 at 09:12