The Runge-Kutta method finds an approximate value of y for a given x. Only first-order ordinary differential equations can be solved by using the Runge Kutta 2nd order method. Below is the formula used to compute next value yn+1 from previous value yn.
-----Runge kutta 2 formula 1------
K1 is the increment based on the slope at the beginning of the interval, using y.
-----Runge kutta 2 formula 2------
K2 is the increment based on the slope at the midpoint of the interval, using (y + h*K1/2).
-----Runge kutta 2 formula 3------



Value of N

Value of h

Initial X0

Initial X0

Value of num

Value of xn

Function
Clear
XY