Simulasi Komputasi Dinamika Populasi Menggunakan Metode Numerik Runge-Kutta Berbasis Python
DOI:
https://doi.org/10.67319/kuadran.v1i1.1Keywords:
Runge–Kutta method, numerical simulation, Python, population dynamics, Lotka–VolterraAbstract
Purpose: This study implements and evaluates the fourth-order Runge–Kutta (RK4) method in Python for simulating population dynamics described by ordinary differential equations, and compares its accuracy and computational cost with the explicit Euler method and an adaptive SciPy solver.
Design/Methodology: A computational experiment was conducted on three benchmark models: the logistic growth model, which has a closed-form solution for validation, and the Lotka–Volterra predator–prey system, which conserves a first integral, and the Rosenzweig–MacArthur model with a saturating functional response. Both integrators were coded from scratch with NumPy, tested on five step sizes, and evaluated using maximum absolute error, empirical order of convergence, relative drift of the conserved quantity, and execution time.
Findings: For the logistic model (N₀ = 100, r = 0.3, K = 1000), the maximum RK4 error decreased from 0.126 to 2.4 × 10⁻⁶ as the step size was reduced from 2 to 0.125, giving an empirical order of 3.82–3.98, consistent with the theoretical order of four; Euler reached an order close to one with errors of 4.8–76.9 individuals. In the Lotka–Volterra simulation, Euler with h = 0.1 inflated the conserved quantity by 161%, producing spurious expanding spirals, whereas RK4 kept the drift below 1.6 × 10⁻⁴%. RK4 with h = 0.1 was both more accurate and faster than Euler with h = 0.01. A step-size test showed that Euler lost stability at r·h > 2, whereas RK4 remained stable up to r·h ≈ 2.7, and RK4 reproduced the Hopf bifurcation of the Rosenzweig–MacArthur model at K ≈ 2.33.
Practical Implications: The Python workflow offers a transparent and low-cost tool for teaching numerical methods, ecological modelling, and reproducible computational research.
Originality/Value: The article combines a from-scratch RK4 implementation, analytical validation, a conservation-based accuracy check, and a comparison with an adaptive library solver into one reproducible workflow for population-dynamics simulation.
References
Burden, R. L., & Faires, J. D. (2011). Numerical analysis (9th ed.). Brooks/Cole, Cengage Learning.
Butcher, J. C. (2016). Numerical methods for ordinary differential equations (3rd ed.). Wiley. https://doi.org/10.1002/9781119121534 DOI: https://doi.org/10.1002/9781119121534
Chapra, S. C., & Canale, R. P. (2015). Numerical methods for engineers (7th ed.). McGraw- Hill Education.
Dormand, J. R., & Prince, P. J. (1980). A family of embedded Runge–Kutta formulae. Journal of Computational and Applied Mathematics, 6(1), 19–26. https://doi.org/10.1016/0771-050X(80)90013-3 DOI: https://doi.org/10.1016/0771-050X(80)90013-3
Edelstein-Keshet, L. (2005). Mathematical models in biology. SIAM. https://doi.org/10.1137/1.9780898719147 DOI: https://doi.org/10.1137/1.9780898719147
Hairer, E., Lubich, C., & Wanner, G. (2006). Geometric numerical integration: Structure- preserving algorithms for ordinary differential equations (2nd ed.). Springer. https://doi.org/10.1007/3-540-30666-8 DOI: https://doi.org/10.1007/3-540-30666-8
Hairer, E., Nørsett, S. P., & Wanner, G. (1993). Solving ordinary differential equations I: Nonstiff problems (2nd ed.). Springer. https://doi.org/10.1007/978-3-540-78862-1 DOI: https://doi.org/10.1007/978-3-540-78862-1
Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., ... Oliphant, T. E. (2020). Array programming with NumPy. Nature, 585, 357–362. https://doi.org/10.1038/s41586-020-2649-2 DOI: https://doi.org/10.1038/s41586-020-2649-2
Holling, C. S. (1959). Some characteristics of simple types of predation and parasitism. The Canadian Entomologist, 91(7), 385–398. https://doi.org/10.4039/Ent91385-7 DOI: https://doi.org/10.4039/Ent91385-7
Hunter, J. D. (2007). Matplotlib: A 2D graphics environment. Computing in Science & Engineering, 9(3), 90–95. https://doi.org/10.1109/MCSE.2007.55 DOI: https://doi.org/10.1109/MCSE.2007.55
Kiusalaas, J. (2013). Numerical methods in engineering with Python 3. Cambridge University Press. https://doi.org/10.1017/CBO9781139523899 DOI: https://doi.org/10.1017/CBO9781139523899
Kot, M. (2001). Elements of mathematical ecology. Cambridge University Press. DOI: https://doi.org/10.1017/CBO9780511608520
Linge, S., & Langtangen, H. P. (2020). Programming for computations – Python (2nd ed.). Springer. https://doi.org/10.1007/978-3-030-16877-3 DOI: https://doi.org/10.1007/978-3-030-16877-3
Lotka, A. J. (1925). Elements of physical biology. Williams & Wilkins.
May, R. M. (1976). Simple mathematical models with very complicated dynamics. Nature, 261, 459–467. https://doi.org/10.1038/261459a0 DOI: https://doi.org/10.1038/261459a0
Murray, J. D. (2002). Mathematical biology I: An introduction (3rd ed.). Springer.
Rosenzweig, M. L. (1971). Paradox of enrichment: Destabilization of exploitation ecosystems in ecological time. Science, 171(3969), 385–387. https://doi.org/10.1126/science.171.3969.385 DOI: https://doi.org/10.1126/science.171.3969.385
Rosenzweig, M. L., & MacArthur, R. H. (1963). Graphical representation and stability conditions of predator-prey interactions. The American Naturalist, 97(895), 209–223. https://doi.org/10.1086/282272 DOI: https://doi.org/10.1086/282272
Sandve, G. K., Nekrutenko, A., Taylor, J., & Hovig, E. (2013). Ten simple rules for reproducible computational research. PLoS Computational Biology, 9(10), e1003285. https://doi.org/10.1371/journal.pcbi.1003285 DOI: https://doi.org/10.1371/journal.pcbi.1003285
Strogatz, S. H. (2018). Nonlinear dynamics and chaos: With applications to physics, biology, chemistry, and engineering (2nd ed.). CRC Press. DOI: https://doi.org/10.1201/9780429399640
Verhulst, P.-F. (1838). Notice sur la loi que la population suit dans son accroissement. Correspondance Mathématique et Physique, 10, 113–121.
Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., ... SciPy 1.0 Contributors. (2020). SciPy 1.0: Fundamental algorithms for scientific computing in Python. Nature Methods, 17, 261–272. https://doi.org/10.1038/s41592-019-0686-2 DOI: https://doi.org/10.1038/s41592-020-0772-5
Volterra, V. (1926). Variazioni e fluttuazioni del numero d’individui in specie animali conviventi. Memorie della R. Accademia Nazionale dei Lincei, 2, 31–113.
Wilson, G., Aruliah, D. A., Brown, C. T., Chue Hong, N. P., Davis, M., Guy, R. T., ... Wilson, P. (2014). Best practices for scientific computing. PLoS Biology, 12(1), e1001745. https://doi.org/10.1371/journal.pbio.1001745 DOI: https://doi.org/10.1371/journal.pbio.1001745
Yee, H. C., Sweby, P. K., & Griffiths, D. F. (1991). Dynamical approach study of spurious steady-state numerical solutions of nonlinear differential equations. I. The dynamics of time discretization and its implications for algorithm development in computational fluid dynamics. Journal of Computational Physics, 97(2), 249–310. https://doi.org/10.1016/0021-9991(91)90001-2 DOI: https://doi.org/10.1016/0021-9991(91)90001-2
Downloads
Published
Issue
Section
License
Copyright (c) 2026 KUADRAN: Jurnal Analitika Data dan Ilmu Komputer

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.




