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

Illustration of numerical discretization methods: (a) FE, (b) RK2, (c) RK4, and (d) AB2 Figure 1(b) shows the application of RK2 method where Predictor and Corrector are the points of the function at each sample based on Equations (4) and (5). From this perspective, the RK2 method can also be considered as a hybrid method with switching factor is equal to one. This mechanism can be seen from Equations (4) and (5) where the the predictor 'measures' value and then the corrector update the values and this switching continues for the complete ODE function. It is obvious that the main challenge with this approach is the high effort for computation is required even the accuracy is improved. The reduced speed calculation due to the finding the solution is the main hindrance of adaption the method in real-time control system.

Illustration of numerical discretization methods: (a) FE, (b) RK2, (c) RK4, and (d) AB2 Figure 1(b) shows the application of RK2 method where Predictor and Corrector are the points of the function at each sample based on Equations (4) and (5). From this perspective, the RK2 method can also be considered as a hybrid method with switching factor is equal to one. This mechanism can be seen from Equations (4) and (5) where the the predictor 'measures' value and then the corrector update the values and this switching continues for the complete ODE function. It is obvious that the main challenge with this approach is the high effort for computation is required even the accuracy is improved. The reduced speed calculation due to the finding the solution is the main hindrance of adaption the method in real-time control system.

No comments:

Today is day 356 or 97.5 percent of the year 2024

English: Today is day 356 or 97.5 percent of the year 2024 Mandarin Chinese: 今天是2024年的第356天,即97.5% Hindi: आज 2024 का 356वां दिन या 97.5 प्रत...