A numerical approach for a nonhomogeneous differential equation with variable delays

In this study, we consider a linear nonhomogeneous differential equation with variable coefficients and variable delays and present a novel matrix-collocation method based on Morgan–Voyce polynomials to obtain the approximate solutions under the initial conditions. The method reduces the equation with variable delays to a matrix equation with unknown Morgan–Voyce coefficients. Thereby, the solution is obtained in terms of Morgan–Voyce polynomials. In addition, two test problems together with error analysis are performed to illustrate the accuracy and applicability of the method; the obtained results are scrutinized and interpreted by means of tables and figures.

under the initial condition yðaÞ ¼ k, where the coefficients P j ðtÞ and the delays s j are continuous functions on the interval 0 a j b and the delays are nonnegative, s j t ð Þ ! 0 for t ! a. Delay differential equations of the type 1 arise in a variety of applications including control systems, electrodynamics, mixing liquids, neutron transportation, population models, physiological processes and conditions including production of blood cells [1,14,23,25,27,28,34,37].
In the case of bounded delays, many authors using standard techniques [3,10,20,27,34,37] have studied the asymptotic behavior of solutions, the asymptotic stability in equations and the existence of positive periodic solutions of delay equations. However, most of the mentioned type delay equations have not analytical and numerical solutions; therefore, numerical methods are required to obtain approximate solutions. For this purpose, by means of the matrix method based on collocation points which have been given by Sezer and coworkers [2,6,16,17,21,26,29,36], we develop a novel matrix technique to find the approximate solution of Eq. 1 under the initial condition yðaÞ ¼ k in the truncated Morgan-Voyce series form where y n ; n ¼ 0; 1; . . .; N are coefficients to be determined; b n ; n ¼ 0; 1; . . .; N are the first kind Morgan-Voyce polynomials defined by [11,32,33] b n t ð Þ ¼ X n j¼0 n þ j n À j t j ; n 2 N; a t b ð3Þ Here, the set of polynomials b n t ð Þ f g has the following properties [11,15,19,32] 1. The polynomials b n t ð Þ defined by 3 are recursively given by the relation . . . are solutions of the differential equation Þy 00 þ 2 t þ 1 ð Þy 0 À n n þ 1 ð Þy ¼ 0: 3. The first four Morgan-Voyce polynomials of the first kind are obtained from 3 as

Fundamental matrix relations
In this section, we compose the matrix relations of Eq. 1 and its solution Eq. 2. For this aim, we first write the matrix form of the finite Morgan-Voyce series Eq. 2 as then, by using the Morgan-Voyce polynomials Eq. 3, we obtain the matrix form b t ð Þ as follows 0      2   6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  4 Besides, the relation between the matrix and its derivative X 0 t ð Þ can be written in the form [13,18,22,24] where : Then, by means of the matrix relations Eqs. 4, 5, and 6, we obtain and By putting t ! t À s j t ð Þ in Eq. 7, we gain the recurrence relation [13,18,22,24] y t À s j ðtÞ À Á ffi y N ðtÞ ¼ X t À s j ðtÞ Note that the matrix X t À s j ðtÞ À Á can be written as X t À s j ðtÞ À Á ¼ X t ð ÞL Às j ðtÞ À Á By substituting the relations Eqs. 7, 8, and 9 into Eq. 1, we have the matrix equation and by placing the collocation points defined by in Eq. 10, the compact form of the obtained matrix equations system

Morgan-Voyce matrix method
The fundamental matrix Eq. 11 of Eq. 1 can be expressed in the form where By using the relation Eq. 7, we obtain the corresponding matrix form to the initial condition yðaÞ ¼ k as such that Consequently, in order to get the approximate solution of Eq. 1 subject to yðaÞ ¼ k, we replace the row matrix in Eq. 13 by the last row(or any row) of the augmented matrix in Eq. 12; then, we obtain the result matrix Thus the matrix, Y (thereby the Morgan-Voyce coefficients y o ; y 1 ; . . .; y N ) is uniquely determined; thus Eq. 1 has a unique solution.

Error analysis
In this section, an error analysis will be presented for the Morgan-Voyce polynomial solution in Eq. 16 with the residual error function [4,8,9,13,21,22,28,31,36]. In addition, we will improve the Morgan-Voyce polynomial solution y N t ð Þ with the aid of the residual error function.
Firstly, we consider the operator Eq. 1, under the initial condition yðaÞ ¼ k, Here, y N ðtÞ is the approximate solution of the problem and satisfies the problem Also, the residual function of the Morgan-Voyce polynomial approximation y N t ð Þis defined as If we know the exact solution y t ð Þ, then the error function is calculated as the difference between the approximate and the exact solutions defined by

Numerical examples
Example 1 Consider the differential equation with variable delay t 2 þ 1 subject to the initial condition yð0Þ ¼ À1. The exact solution of this equation is yðtÞ ¼ t À 1. First of all, let us determine the collocation points by the formula Therefore the collocation points are obtained as , the fundamental matrix equation of this problem is written as    and the augmented matrix for initial condition is obtained as By using the procedure in Sect. 3, we obtain the approximate solution as which is the exact solution.
Example 2 Consider the differential equation with variable delay t 2 2y 0 ðtÞ À tyðtÞ þ te 2t 2 yðt À t 2 Þ ¼ 4e 2t ; 0 t 1 subject to the initial condition yð0Þ ¼ 1. The exact solution of this equation is yðtÞ ¼ e 2t . The fundamental matrix equation is ÞÀe Àt 2 y t À t 2 À Á þ yðtÞ; 0 t 1 subject to the initial condition yð0Þ ¼ 1. The exact solution of this equation is yðtÞ ¼ e Àt . The fundamental matrix equation is After the collocation points substituted into this matrix equation, we can solve the system and we obtain the     Table 3. All exact, approximation, and corrected solutions of Example 3 for N ¼ 3; 4 are given in Fig. 5 and 6, respectively. The absolute and corrected errors of Example 3 in Table 4 are compared for N ¼ 3; 4 in Figs. 7 and 8, respectively.
Example 4 Consider the following delay differential equation [7] having variable delay ln t 2 þ 1 ð Þ y 0 ðtÞ ¼ t 2 þ 1 À Á e Àt À y t À ln t 2 þ 1 À Á À Á À yðtÞ; 0 t 2 subject to the initial condition yð0Þ ¼ 1. The exact solution of this equation is yðtÞ ¼ e Àt . Similarly, we can solve this problem by present method and we obtain the solutions in the form 4 of Example 4 for N ¼ 6 in the interval 0; 2 ½ . Then, we also compare the present solutions and Hybrid Taylor-Lucas Method [7] (HTL) solutions in Table 5. The present method has been shown to be suitable as graphically for nonhomogeneous differential equation with variable delays in Fig. 9.
In order to better define the solution space of the problems of Examples 2, 3 and 4 described above, the N value has been scanned up 1 to 100. The root-mean-square error (RMSE) value of the solution obtained for each N value is calculated and shown in Fig. 10. When N [ 12, the RMSE values of the solutions of both problems are oscillated between 10 À10 and 10 À16 . The reason of these oscillations is the truncation errors in the calculations.

Conclusion
A new approach using the Morgan-Voyce polynomials to solve numerically the first-order nonhomogeneous differential equations with variable delays is presented in this study. An error analysis technique based on residual function is also developed our problems. If the exact solution of the problem is not known, by using this technique it is possible to estimate the error function and also to reduce the error due to the residual function. It is seen that, the accuracy improves, when N is increased. To compute our solutions and error functions, we have written a code in Matlab and calculated all computations by means of this code.
Consequently, the present method has been shown to be convenient, reliable and effective for solving the first-order nonhomogeneous differential equation with variable delays.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http:// creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.