What does the 45 mean in ode45?

From Murray Wiki
Jump to navigationJump to search

Q What does the 45 mean in ode45?

A The solver ode45 implements the Runge-Kutta(4,5) method. Such method is suited for solving ordinary differential equations by predictions.

Suppose you are evaluating the solution of an ODE:

y'=f(y,t) y(0)=y_0

around an initial point y_n, at time t_n using a step size δ in your domain; Runge-Kutta(4,5) will approximate such prediction as follows:

y_n+1= y_n + δ/6*(k_1+2k_2+2k_3+k_4),

where k_i's are iteratively computed:

k_1=f(y_n,t_n)

k_2= f(y_n + δ/2* k_1 , t_n +δ/2 )

k_3= f(y_n + δ/2* k_2 , t_n +δ/2 )

k_4= f(y_n + δ* k_3 , t_n +δ)


The method is iterative: at every iteration, the prediction is computed by using the previous value y_n adding a certain slope, calculated by averaging the slopes k_i at different midpoints.

The result of such method, is that the prediction error is of order δ^5, and the total accumulated error is of order δ^4, from which the name. --Franco