This project demonstrates the graphical solution for the Lotka-Volterra Equations using Runge-Kutta-4 method. MATLAB and Python both have been used to find the graphical solution.
Runge-Kutta-4 is the most widely known member of Runge-Kutta family, used for the approximate solution of ordinary differential equations (ODE).
x_(n+1) = x_n + 1/6*(k1+k2+k3+k4)
t_(n+1) = t_n + h for n=0,1,2,3,...
where,
1) k1 = f(t_n,x_n)
2) k2 = h*f(t_n + h/2, x_n + k1/2)
3) k3 = h*f(t_n + h/2, x_n + k2/2)
4) k4 = h*f(t_n + h, x_n + k3)
- t_(n+1) is reperesented by t
- t_n is reperesented by
t(k)
- x_(n+1) is represented by
x(:,k+1)
- x_n is represented by
x(:,k)
- 1/6*(K1+K2+K3+K4) is represented by dx
- k1+k2+k3+k4 is represented by is represented by k1,k2,k3,k4
- t_(n+1) is reperesented by t
- t_n is reperesented by
t[k]
- x_(n+1) is represented by
x[:,k+1]
- x_n is represented by
x[:,k]
- 1/6*(K1+K2+K3+K4) is represented by dx
- k1+k2+k3+k4 is represented by is represented by k1,k2,k3,k4
NOTE: All other important notes are written alongside the code itself in their respective files.
The Lotka-Volterra equations or prey-predator equations, are a pair of first-order non-linear differential equations, used to describe the dynamics of biological systems in which two species interact, one as a predator and the other as prey.
dx/dt = α*x - β*x*y
dy/dt = δ*x*y - γ*y
xdot = [alpha*x(1) - beta*x(1)*x(2)
delta*x(1)*x(2) - gamma*x(2)];
xdot = np.array([alpha*x[0] - beta*x[0]*x[1], delta*x[0]*x[1] - gamma*x[1]])
NOTE: Please see the coding files for more information regarding the application part of Lotka-Volterra
Both plots are approximately same as both python and MATLAB codes have same initial conditions