## Monday, January 16, 2023

### Runge-Kutta 2nd order method (RK2), also known as the Midpoint Method

The Runge-Kutta 2nd order method (RK2), also known as the midpoint method, is a numerical method for solving ordinary differential equations (ODEs). The basic idea behind this method is to approximate the solution of the ODE at discrete time steps, using a local polynomial approximation of the solution.

The method begins by approximating the solution at the current time step using the initial value and the derivative of the solution at that point, which is given by the ODE. The next step is to calculate the estimate of the solution at the midpoint between the current and next time steps, this is done by using the initial value and the derivative evaluated at the current time step .

The next approximate solution is then calculated by taking a weighted average of the estimates. The weights used in this average are determined by the specific RK method being used.

The RK2 method is a second-order method, meaning that it can achieve an accuracy of O(h^2), where h is the size of the time step. However, the RK2 method is less computationally expensive than higher-order methods like the RK4 method, which is a fourth-order method with an accuracy of O(h^4).

The explicit form of RK2 method is as follows:

y(tn+1) = y(tn) + h * f(tn + h/2, y(tn) + (h/2)*f(tn, y(tn)))

where y is the function to be solved, h is the step size and f(tn, y(tn)) is the derivative of the function.

It's important to note that RK2 method is not always the best choice for solving ODEs, especially if high accuracy is needed or stiff ODEs. The choice of numerical method depends on the specific problem being solved and the desired level of accuracy.

All RK Methods

Runge-Kutta methods are a family of iterative methods for solving ordinary differential equations (ODEs) with a given initial value. The basic idea behind these methods is to approximate the solution of the ODE at discrete time steps, using a local polynomial approximation of the solution.

The most common method in this family is the fourth-order Runge-Kutta (RK4) method, which uses four estimates of the solution at different points within a time step to compute the next approximate solution. The method begins by approximating the solution at the current time step using the initial value and the derivative of the solution at that point, which is given by the ODE.

The first estimate of the solution at the next time step is calculated using the initial value and the derivative evaluated at the current time step. The second estimate is calculated using the initial value and the derivative evaluated at the midpoint between the current and next time steps. The third and fourth estimates are calculated in a similar manner, using the derivative evaluated at other points within the time step.

These four estimates are then used to compute the next approximate solution, by taking a weighted average of the estimates. The weights used in this average are determined by the specific RK method being used.

The RK4 method is a fourth-order method, meaning that it can achieve an accuracy of O(h^4), where h is the size of the time step. However, the RK4 method is more computationally expensive than lower-order methods like the Euler method, which is a first-order method with an accuracy of O(h).

There are other Runge Kutta Methods like RK2, RK3, RK4, RK5 and so on. It's important to note that RK methods are not always the best choice for solving ODEs. The choice of numerical method depends on the specific problem being solved and the desired level of accuracy.

External Source

https://www.researchgate.net/figure/Illustration-of-numerical-discretization-methods-a-FE-b-RK2-c-RK4-and-d-AB2_fig1_332343636 