Article Contents
Article Contents

# Applying particle swarm optimization based on Padé approximant to solve ordinary differential equation

• * Corresponding author: Azzam S. Y. Aladool
• Ordinary differential equations are converted into a constrained optimization problems to find their approximate solutions. In this work, an algorithm is proposed by applying particle swarm optimization (PSO) to find an approximate solution of ODEs based on an expansion approximation. Since many cases of linear and nonlinear ODEs have singularity point, Padé approximant which is fractional expansion is employed for more accurate results compare to Fourier and Taylor expansions. The fitness function is obtained by adding the discrete least square weighted function to a penalty function. The proposed algorithm is applied to 13 famous ODEs such as Lane Emden, Emden-Fowler, Riccati, Ivey, Abel, Thomas Fermi, Bernoulli, Bratu, Van der pol, the Troesch problem and other cases. The proposed algorithm offer fast and accurate results compare to the other methods presented in this paper. The results demonstrate the ability of proposed approach to solve linear and nonlinear ODEs with initial or boundary conditions.

Mathematics Subject Classification: Primary: 34Bxx, 65Lxx, 65Kxx, 41A21; .

 Citation:

• Figure 1.  shows a plot of the resulting approximate solution with the corresponding exact solutions.

Figure 2.  Shows numerical error between the approximate solution and exact solution arising from the proposed algorithm in four examples.in NLIVP5, NLIVP6, NBVP1 and NBVP3 respectively.

Figure 3.  Show the convergence of PSO-PEA-DLSWF algorithm in 500 iteration.

Figure 4.  Comparison of expansions: PEA, TEA and FEA to consumed time.

Figure 5.  shows the simulating of example (NLBVP3) in terms of errors, convergence and stability.

Figure 6.  Comparison between the fitness function: WRF, LSWF and DLSWF with consumed time.

Figure 7.  shows the simulating of example (NLBVP1) in terms of errors, convergence and stability.

Table 1.  Illustrates different type of the ordinary differential equations, with its conditions, domain and exact solution.

 ODE NAME ODE EQUATION I.C. or B.C DOMAIN EXACT SOLUTION Simple ODEs1 LIVP1 $y'=\frac{y}{x}+1$ $y(1)=0$ $x\in[1,2]$ $y=xln(x)$ Simple ODEs2 LIVP2 $y''-y=e^x$ $y(0)=0$ $y'(0)=1$ $x\in[0,1]$ $y=0.25(e^x+2xe^x-e^{-x})$ Simple Harmonic LBVP1 $y''+25y=0$ $y(0)=1$ $y(\frac{\pi}{10})=0$ $x\in[0,\frac{\pi}{10}]$ $y=\cos(5x)$ Riccati NLIVP1 $y'=1+2y-y^2$ $y(0)=0$ $x\in[0,1]$ $y=1+\sqrt{2} \tanh{(\sqrt{2}x}+\frac{1}{2} ln(\frac{\sqrt{2}-1}{\sqrt{2}+1}))$ Abel NLIVP2 $y'=1-x^2 y+y^3$ $y(0)=0$ $x\in[0,1]$ $y=x$ Ivey NLIVP3 $y''=\frac{(y' )^2}{y}-\frac{2y'}{x}-2y^2$ $y(1)=1$ $y'(1)=-2$ $x\in[1,2]$ $y=\frac{1}{x^2}$ Lane- Emden NLIVP4 $y''+2\frac{y'}{x}=-4(2e^y+e^{\frac{y}{2}})$ $y(0)=0$ $y'(0)=0$ $x\in[0,1]$ $y=-2ln(1+x^2)$ Emden-Fowler NLIVP5 $y''+6\frac{y'}{x}+14y+4ylny=0$ $y(0)=1$ $y'(0)=0$ $x\in[0,1]$ $y=e^{-x^2}$ Van Der Pol NLIVP6 $y''+y=0.05(1-y^2 )y'$ $y(0)=0$ $y'(0)=0.5$ $x\in[0,1]$ Sol. By ode45 solver in MATLAB Bratu-Gelfand NLBVP1 $y''-\pi^2 e^y=0$ $y(0)=0$ $y(1)=0$ $x\in[0,1]$ $y=-2ln(\sqrt{2}\cos(\pi(\frac{x}{2}-\frac{1}{4})))$ Thomas-Fermi NLBVP2 $y''=\sqrt{\frac{y^3}{x}}$ $y(1)=144$ $y(2)=18$ $x\in[1,2]$ $y=\frac{144}{x^3}$ Bernoulli NLBVP3 $y''+(y')^2=2e^{-y}$ $y(0)=0$ $y(1)=0$ $x\in[0,1]$ $y=\log{(0.75+(x-0.5)^2)}$ Troesch Problem NLBVP4 $y''=\sinh{y}$ $y(0)=0$ $y(1)=1$ $x\in[0,1]$ Sol. By bvp4c solver in MATLAB

Table 2.  the values of parameters and inputs used in all example.

 parameter $\phi_1$ $\phi_2$ $\kappa$ $\rho$ $\sigma$ $h$ $TOL$ $K_m \forall m$ $Maxit$ $nPop$ value 2.05 2.05 1 0.8 0.4 0.01 1e-03 1 or 10 500 200

Table 3.  Search space and nVar sitting of each example.

 Equation PEA TEA FEA VarMin VarMax nVar VarMin VarMax nVar VarMin VarMax nVar LIVP1 -1 1 10 -2 2 10 -2 2 9 LIVP2 -2 2 10 -2 2 10 -2 2 11 LBVP1 -3 3 10 -3 3 10 -1 1 11 NLIVP1 -2 2 10 -2 2 10 -2 2 9 NLIVP2 0 1 10 0 1 10 -1 1 11 NLIVP3 0 1 10 -3 3 10 -2 2 9 NLIVP4 -2 2 10 -2 2 10 -1 1 11 NLIVP5 -1 1 10 -1 1 10 -1 1 9 NLIVP6 -1 1 10 -2 2 10 -0.5 0.5 9 NLBVP1 -1 1 10 -3 3 10 -1 1 9 NLBVP2 0 1 10 -900 900 10 -200 200 9 NLBVP3 -2 2 10 -3 3 10 -1 1 9 NLBVP4 -4 4 10 -1 1 10 -1 1 9

Table 4.  shows the values of variables founded by using the PSO-PEA-DLSWF algorithm.

 Eq. Coff, $m=1$ $m=2$ $m=3$ $m=4$ $m=5$ LIVP1 $\alpha_m$ 0.449646621 -0.955885566 -0.662451518 0.5990158869 0.5696745764 $\beta_m$ -0.383029549 1.000000000 0.9928258613 0.2090703809 -0.01223876 LIVP2 $\alpha_m$ 1.5905e-08 -2.000000000 -1.99993129 -1.999993802 1.320889355 $\beta_m$ -2.000000000 -1.028027457 -0.640309044 1.893006788 -0.627961135 LBVP1 $\alpha_m$ -0.23700822 0.2939052397 1.7497711122 -0.815400817 -0.28105974 $\beta_m$ -0.237008298 0.2940587929 -1.172283084 1.983810204 -2.525130497 NLIVP1 $\alpha_m$ -6.595e-07 -2.000000000 -1.969510526 -2.000000000 -1.99980317 $\beta_m$ -1.999999998 0.1334264437 -1.999346637 0.2828697917 -1.132644395 NLIVP2 $\alpha_m$ 0.00000000 1.00000000 1.00000000 0.9159523195 1.00000000 $\beta_m$ 1.00000000 1.00000000 0.9159523195 1.00000000 0.00000000 NLIVP3 $\alpha_m$ 1.00000000 0.501789937 0.3963523812 0.00000000 0.00000000 $\beta_m$ 0.00000000 0.00000000 1.00000000 0.501789937 0.3963523812 NLIVP4 $\alpha_m$ -3.556e-10 1.1605e-09 1.371544377 1.705016485 1.664659425 $\beta_m$ -0.699013232 -0.795001437 -1.237894199 -0.487132482 -0.20116878 NLIVP5 $\alpha_m$ -1.0000000 -0.999999714 0.9996994842 1.00000000 -0.670316746 $\beta_m$ -0.999999761 -1.0000000 0.0694451202 -0.363172581 0.4710444283 NLIVP6 $\alpha_m$ 9.8817e-08 0.499999967 -0.128335779 -0.225730262 0.4574883022 $\beta_m$ 1.00000000 -0.334983343 0.0548712929 0.1919886974 0.4900184664 NLBVP1 $\alpha_m$ 6.0988e-07 -1.0000000 -0.168001861 0.1680024128 1.00000000 $\beta_m$ 0.3182717396 0.5556535208 0.2683350684 0.1086186654 -0.242687286 NLBVP2 $\alpha_m$ 1.00000000 0.00000000 0.00000000 0.00000000 0.00000000 $\beta_m$ 0.00000000 0.00000000 0.00000000 0.0069444444 0.00000000 NLBVP3 $\alpha_m$ -2.979e-11 -1.512033065 0.5287945264 -0.376563712 1.359802251 $\beta_m$ 1.512152004 0.2390046775 1.385502167 0.2230003398 0.4953153062 NLBVP4 $\alpha_m$ 2.6966e-06 -3.398796238 -0.916386583 -3.997792287 -2.079546692 $\beta_m$ -4.00000000 -1.420908971 -2.843010022 -3.999816103 1.8712207261

Table 5.  Comparison of expansions: PEA, TEA and FEA. The capital letters P, T and F denotes when PEA, TEA and FEA is the best results respectively.

 Equation PEA TEA FEA No. It RMSE Time (s) No. It RMSE Time (s) No. It RMSE Time (s) LIVP1 047 6.98e-04 26.79 113 9.70e-04 37.70 349 3.28e-02 090.10 P LIVP2 017 3.35e-04 10.37 062 8.50e-04 21.39 500 4.68e-02 130.30 P LBVP1 019 6.49e-04 09.25 081 9.87e-04 21.64 128 9.69e-04 027.38 P NLIVP1 049 9.53e-04 25.92 122 9.90e-04 39.58 500 1.50e-02 093.13 P NLIVP2 006 4.95e-04 03.61 003 0.00e-00 02.06 500 2.90e-02 193.67 T NLIVP3 006 6.83e-04 09.67 500 1.36e-03 247.7 500 9.90e-03 233.29 P NLIVP4 028 9.80e-04 28.07 500 8.60e-03 189.1 500 6.00e-02 181.89 P NLIVP5 008 6.70e-04 7.122 500 2.60e-03 238.3 500 2.30e-02 201.20 P NLIVP6 014 7.95e-04 18.14 040 9.90e-04 36.58 500 9.10e-03 339.87 P NLBVP1 014 9.01e-04 08.89 500 2.10e-02 151.0 500 4.80e-03 152.02 P NLBVP2 013 8.69e-04 12.08 500 2.14e-01 143.2 500 6.30e-01 126.00 P NLBVP3 014 8.59e-04 16.40 500 5.80e-03 158.5 500 1.49e-03 226.66 P NLBVP4 013 4.58e-04 10.62 500 2.30e-03 200.7 500 2.15e-03 121.30 P

Table 6.  Comparison of fitness function: WRF, LSWF and DLSWF. W, L and D symbols indicates that method PEA-PSO-WRF, PEA-PSO-LSWF and PEA-PSO-DLSWF is the best results respectively.

 Equation WRF LSWF DLSWF No. It RMSE Time (s) No. It RMSE Time (s) No. It RMSE Time (s) LIVP1 012 8.03e-04 14.13 014 5.91e-03 22.88 039 1.24e-03 58.56 W LIVP2 012 8.98e-04 15.68 016 9.57e-04 29.54 030 6.09e-04 22.33 W LBVP1 031 6.76e-04 23.92 027 9.14e-04 25.76 018 9.81e-04 11.42 D NLIVP1 212 8.38e-04 270.9 150 9.94e-04 182.0 057 9.51e-04 77.09 D NLIVP2 004 1.42e-17 07.64 003 1.44e-17 04.26 003 0.00e-00 07.48 L NLIVP3 003 3.79e-17 08.43 003 3.79e-17 08.77 003 3.79e-17 07.71 D NLIVP4 077 9.81e-04 172.9 246 8.19e-04 486.1 016 8.96e-04 39.77 D NLIVP5 013 7.60e-04 40.40 018 8.52e-04 36.23 009 6.52e-04 25.20 D NLIVP6 027 7.14e-04 85.23 018 7.86e-04 39.10 012 9.79e-04 23.62 D NLBVP1 034 6.13e-04 54.26 074 9.14e-04 114.2 018 8.97e-04 33.88 D NLBVP2 019 1.86e-04 35.08 027 7.55e-05 48.71 012 2.52e-04 17.02 D NLBVP3 016 3.75e-04 27.01 011 8.91e-04 18.40 018 9.11e-04 28.41 L NLBVP4 015 8.11e-04 25.80 016 7.19e-04 22.62 021 8.84e-04 24.08 L
•  [1] S. Abbasbandy, Homotopy perturbation method for quadratic Riccati differential equation and comparison with Adomian's decomposition method, Applied Mathematics and Computation, Elsevier, 172 (2006), 485–490. doi: 10.1016/j.amc.2005.02.014. [2] E. J. Ali, New treatment of the solution of initial boundary value problems by using variational iteration method, Basrah Journal of Science, Basrah University, 30 (2012), 57–74. [3] M. Almazmumy, F. A. Hendi, H. O. Bakodah and H. Alzumi, Recent modifications of Adomian decomposition method for initial value problem in ordinary differential equations, American Journal of Computational Mathematics, Scientific Research Publishing, 2 (2012), 228–234. doi: 10.4236/ajcm.2012.23030. [4] U. M. Ascher, R. M. M. Mattheij and R. D. Russel, Numerical Solution of Boundary Value Problems for Ordinary Differential Equations, Society for Industrial and Applied Mathematics, 1995. doi: 10.1137/1.9781611971231. [5] M. Babaei, A general approach to approximate solutions of nonlinear differential equations using particle swarm optimization, Applied Soft Computing, Elsevier, 13 (2013), 3354–3365. [6] G. A. Baker and  P. Graves-Morris,  Padé Approximants, Second edition: Encyclopedia of Mathematics and It's Applications, Cambridge University Press, 1996.  doi: 10.1017/CBO9780511530074. [7] A. Borzì,  Modelling with Ordinary Differential Equations: A Comprehensive Approach, CRC Press, 2020. [8] W. E. Boyce, R. C. DiPrima and D. B. Meade, Elementary Differential Equations and Boundary Value Problems, 11$^{nd}$ edition, WILEY, 2017. [9] R. L. Burden and J. D. Faires, Numerical Analysis, 9$^{nd}$ edition, Brooks/Cole, Cencag Learning, 2011. [10] S. Chakraverty and  Su smita Mall,  Artificial Neural Networks for Engineers and Scientists: Solving Ordinary Differential Equations, CRC Press, 2017.  doi: 10.1201/9781315155265. [11] J. M. Chaquet and E. Carmona, Solving differential equations with Fourier series and evolution strategies, Appl. Soft Comput., 12 (2012), 3051–3062. [12] M. Clerc and J. Kennedy, The particle swarm-explosion, stability, and convergence in a multidimensional complex space, IEEE Transactions on Evolutionary Computation, IEEE, 6 (2002), 58–73. doi: 10.1002/9780470612163. [13] R. Eberhart and J. Kennedy, A new optimizer using particle swarm theory, MHS'95. Proceedings of the Sixth International Symposium on Micro Machine and Human Science, IEEE, (1995), 39–43. [14] A. Engelbrecht, Particle swarm optimization: Velocity initialization, 2012 IEEE Congress on Evolutionary Computation, IEEE, (2012), 1–8. [15] D. Gutierrez-Navarro and S. Lopez-Aguayo, Solving ordinary differential equations using genetic algorithms and the Taylor series matrix method, Journal of Physics Communications, IOP Publishing, 2 (2018), 115010. [16] M. Hermann and M. Saravi, Nonlinear Ordinary Differential Equations: Analytical Approximation and Numerical Methods, Springer India, 2016. doi: 10.1007/978-81-322-2812-7. [17] E. A. Hussain and Y. M. Abdul–Abbass, Solving differential equation by modified genetic algorithms, Journal of University of Babylon for Pure and Applied Sciences, 26 (2018), 233-241. [18] J. Kennedy, The particle swarm: social adaptation of knowledge, Proceedings of 1997 IEEE International Conference on Evolutionary Computation (ICEC'97), IEEE, (1997), 303–308. [19] F. Mirzaee, Differential transform method for solving linear and nonlinear systems of ordinary differential equations, Applied Mathematical Sciences, 5 (2011), 3465-3472. [20] T. Radhika,  T. Iyengar and  T. Rani,  Approximate Analytical Methods for Solving Ordinary Differential Equations, CRC Press, 2014. [21] A. Sadollah, H. Eskandar, D. G. Yoo and J. H. Kim, Approximate solving of nonlinear ordinary differential equations using least square weight function and metaheuristic algorithms, Engineering Applications of Artificial Intelligence, Elsevier, 40 (2015), 117–132. [22] A. Sahu, S. K. Panigrahi and S. Pattnaik, Fast convergence particle swarm optimization for functions optimization, Procedia Technology, Elsevier, 4 (2012), 319–324. [23] M. Shehab, A. T. Khader and M. Al-Betar, New selection schemes for particle swarm optimization, IEEJ Transactions on Electronics, Information and Systems, The Institute of Electrical Engineers of Japan, 136 (2016), 1706–1711. [24] S. Talukder, Mathematicle Modelling and Applications of Particle Swarm Optimization, Mc. S. Thesis, Blekinge Institute of Technology, School of Engineering, 2011. [25] W. F. Trench, Elementary Differential Equations with Boundary Value Problems, Brooks/Cole Thomson Learning, 2013. [26] W. Van Assche, Padé and Hermite-Padé approximation and orthogonality, arXiv: math/0609094, 2006. [27] Z. Zhang, Y. Cai and D. Zhang, Solving ordinary differential equations with adaptive differential evolution, IEEE Access, IEEE, 8 (2020), 128908–128922. [28] P. Zitnan, Discrete weighted least-squares method for the Poisson and biharmonic problems on domains with smooth boundary, Appl. Soft Comput., 217 (2011), 8973-8982.  doi: 10.1016/j.amc.2011.03.103.

Figures(7)

Tables(6)