Adam-Bashforth-Moulton Algorithm for ODEs

Adam-Bashforth-Moulton Algorithm for ODEs

Although MATLAB contains plenty of sophisticated algorithms and solvers to evaluate plethora of stiff and non-stiff ODEs and PDEs, I decided to take a step back and stop relying on the comfort that these algorithms provided to me. Much like the algorithm themselves, the smaller I found my prediction and correction steps to be, considering I come without round-off errors (haha), the more I learned and the more I felt liberated, not to mention the lesser intimidated I felt of creating lengthy but sophisticated codes.

Today I take this opportunity to share my first post on LinkedIn, the implementation of the Adam-Bashforth-Moulton predictor-corrector algorithm which solves slightly stiff ODEs, and may have more capabilities which I, as I can now proudly say, look forward to express in a numerical code.

No alt text provided for this image

The ABM algorithm was applied first to the non-stiff initial value problem: y'(t) = 1 - y(t),

%% VASUDEV GUPTA

% Defining the ODE:
tspan = [0 10]; N=100; y0 = 0;
func = @(t,y) 1-y;


% analytical solution for NON-STIFF ODE
t_an = tspan(1) + (0:N)' * ((tspan(2)-tspan(1))/N);
y_an = 1 - exp(-t_an);



figure(1)
subplot(2,1,1)
plot(t_an, y_an, '-k','DisplayName','Analytical');hold on;

% Runge-Kutta 4th Order Method
[t_rk4, y_rk4] = RK4_ODEsys(func, y0, tspan,N);
%plot(t_an, y_an, 'ro-'); hold on;
plot(t_rk4, y_rk4, 'o-','DisplayName','RK-4th'); hold on;

% Adam-Bashforth-Moulton Method
[t_abm, y_abm] = ode_ABM(func, y0, tspan, N);
plot(t_abm, y_abm ,'v-','DisplayName','Adam-Bashforth-Moulton')

legend; grid on;
title('Numerical Solutions ODE');
xlabel('(t):time'); ylabel('y(t):response');

which produced the satisfying graph that illustrates the superiority of ABM method over the Runge-Kutta(4th) method:

No alt text provided for this image

MATLAB's in-built function 'ode113()' gives the user the capability to go till the 12th order of the ABM algorithm.

To excite our hearts even more, the Adam-Bashforth-Moulton algorithm was applied to the slightly stiff (depends on the value of mu) van der Pol Nonlinear equation:

%% VASUDEV GUPTA

% Defining van der Pol ODE:
tspan = [0 20]; N=200; y0 = [2 0];
mu=2;
func = @(t,y) [( y(2) ) ( mu*(1-y(1).^2).*y(2) - y(1) )];

% Runge-Kutta 4th order
[t_rk4, y_rk4] = RK4_ODEsys(func, y0, tspan,N);
plot(t_rk4, y_rk4, 'o-','DisplayName','RK-4th'); hold on;

% Adam-Bashforth-Moulton Method
[t_abm, y_abm] = ode_ABM(func, y0, tspan, N);
plot(t_abm, y_abm ,'v-','DisplayName','Adam-Bashforth-Moulton')

legend; grid on;
title('van der Pol (\mu=2) Nonlinear DE Numerical Solutions');
xlabel('(t):time'); ylabel('y(t):response');

and I'll leave the results for you to ruminate on,

No alt text provided for this image

At the end I would like to close by saying that no matter how small your steps are, you will converge to where you truly want to be, for

big things have small beginnings

Thanking Malte Krack & Johann Gross, whose book Harmonic Balance for Nonlinear Vibration Problems showed me a path to follow when I was confused and overwhelmed with information from literature on Nonlinear Vibrations, trying to come up with an algorithm to solve nonlinear differential equation using the quantitative methods such as 'The Harmonic Balance Method', 'The Method of Averaging' etc, and encouraged me to deconstruct systems and to look them under a microscope. Finding myself excited to wake up everyday to dissect nonlinear systems and learn from the chaos that gives them order, I explored Prof. Krack's research on the HBM method, Nonlinear Modal Analysis and Stability and would be honored to thank him personally by contributing to his research at Universitaet Stuttgart.

Thanking Ruediger Seydel, for his book Practical Bifurcation and Stability Analysis, did inspire me to perform my own experimental studies, and the examples and figures provided a basis and motivation to start, slowly but surely.

Thanking Won Y. Yang, Wenwu Cao, Jaekwon Kim and all the 7 other authors for their book Applied Numerical Methods using MATLAB that is helping me start my journey of MATLAB and is also a major contributor for this post, for the above simulations are derived from the works of the above 10 authors.

Thanking Evgeni Burovski and National Research University Higher School of Economics for providing an excellent online course on Numerical Analysis which is easy to understand and is encouraging students and researchers like me with the fundamental concepts of numerical computation and implementing them on Python.

for more references:

Adams Methods - MIT

Adams-Bashforth and Adams-Moulton methods - wikiversity





My first acquaintance with MATLAB started with solving 2D Heat and wave equations using numerical methods.

To view or add a comment, sign in

Others also viewed

Explore content categories