1 Introduction

Differential equations have a long and notable history, reaching back to the seventeenth century, when Isaac Newton and Gottfried Leibniz introduced calculus independently. They discovered the relationship between the derivative and the quantity’s rate of change, which prompted the development of differential calculus. One of the first fields in which differential equations were used was physics, where they were employed to describe how objects moved when subjected to forces. Another early and influential application of differential equations was in celestial mechanics, where ODEs were used to simulate the motion of planets and comets in the solar system. Leonhard Euler made substantial contributions to the theory of differential equations during the eighteenth century, including the creation of techniques for resolving both linear and nonlinear ODEs. The study of differential equations as a distinct field of study was made possible by Euler's work. The theory of differential equations was improved upon in the nineteenth century by mathematicians including Joseph Fourier, Jean-Baptiste Fourier, and Carl Gustav Jacobi. The invention of Fourier series, which are used to express periodic functions as an infinite sum of sine and cosine functions, was significantly aided by these mathematicians. The emergence of computers and numerical methods for solving differential equations in the twentieth century transformed the evaluation of differential equations. This enabled the study of complicated systems that could not be solved analytically, leading to the development of computational methods for solving differential equations.

The study of differential equations has been critical to numerous scientific breakthroughs, including the discovery of gravitational waves, the evolution of quantum physics, and the knowledge of fluid dynamics. They are employed in the modeling and forecasting of the behavior of complex processes, as well as to create efficient algorithms for problems that cannot be solved analytically. In almost every physical, technical, or biological activity, differential equations are used as a key component of the model. Many scientific and engineering topics require the knowledge of differential equations as a fundamental component. Models from the subject of mathematics that is relevant to science and engineering are clearly important for interpreting physical phenomena. Differential equations, like those employed to address problems in daily life, might not always be directly solved, i.e., lack closed form solutions. Numerical techniques can be used to approximate the solutions instead. Because the analytical solution of higher-order boundary value problems is a time-consuming process in general, researchers have switched their focus to approximate solutions. For example, Hossain and Islam [1] used the Galerkin method to find numerical solutions to higher-order differential equations. Tawfiq et al. [2] presented a semi-analytic technique, based on two-point oscillatory interpolation for solving higher-order ODEs with two-point boundary conditions. To estimate the solution of the boundary value problems as a weighted sum of polynomials, Bhowmik [3] used the spectral collocation method. Chawla [4] described the development of finite difference methods for the solution of differential equations that are described by boundary conditions at two points and involve non-linear terms in the equation. Kasi et al. [5] used the finite element method to solve a specific type of boundary value problem. In their research, they developed a numerical method based on the Petrov–Galerkin method with quintic B-splines as basis functions and septic B-splines as weight functions. The specific problem they addressed is a generic ninth order boundary value problem with a set of boundary conditions. Din [6] and Yildirim [7] used the homotopy perturbation method and modified variational iteration method to solve boundary value problems of ninth- and tenth-order. Nawaz et al. [8] used the optimal homotopy asymptotic method to present an approximate solution to linear and nonlinear tenth-order boundary value problems. By reformulating BVPs of a higher-order as an analogous system of integral equations, Nadjafi et al. [9] solved them using the homotopy perturbation method. Hassan and Erturk [10] solved fifth-, sixth-, ninth-, tenth-, and twelfth-order (linear and nonlinear) boundary value problems using the differential transformation method. In order to estimate solutions to higher-order boundary value problems with two-point boundary conditions, Wazwaz [11] introduced a powerful semi-numerical approach and to create such solutions, a modified version of the Adomian decomposition method was used.

While linear differential equations are easily solvable, higher-order and nonlinear equations are more complex to solve. Due to this impact, researchers are now concentrating on approximating solutions to these equations. But all the above-mentioned methods and many other methods have their own set of limitations, for example, majority of these methods involve time-consuming and complicated linearization, discretization, and perturbation techniques. To some extent, we can overcome these constraints by using the Residual Power Series Method (RPSM). It’s not necessary to discretize, perturb, or linearize data when using the RPSM [12]. RPSM is a numerical method that generates polynomial-based approximate solutions to nonlinear and linear higher-order IVPs and BVPs and then uses the residual function to iteratively improve the accuracy of the solution. This method is quite basic and easy to implement, and it can be mechanized with computer software. The power series can be shortened at any point to reach the appropriate level of precision, which enables the method to produce a solution with a high degree of accuracy. This method is especially beneficial when the solution to the differential equation contains a singularity or other peculiar properties, as it can handle these problems more easily than other numerical methods. Of course, the residual power series method, like any numerical method, has limitations and may not be the best option in every scenario. Even though, its versatility, accuracy, and simplicity make it a powerful tool in many numerical analysis applications. Many mathematicians have utilized RPSM to tackle a variety of issues. For example, Bayrak et al. [13] proposed a numerical approach for solving linear and nonlinear space–time fractional problems with Dirichlet boundary conditions. The approach involves using a modified form of the Adomian decomposition method (ADM) in conjunction with a new parameter λ to improve the accuracy of the solutions. The main principle of the method is to first solve the space–time fractional differential equation and then solve the resulting set of ordinary differential equations, which can be either linear or nonlinear. Following that, the ADM is used to iteratively solve the equation system that results. An approximate solution to a nonlinear time-fractional, two-component evolutionary system of order 2 using RPSM was provided by Alquran [14]. Qayyum and Fatima [15] implemented the RPSM to various stiff systems of ODEs, and they got closed-form solutions, which shows that the proposed strategy is effective for the stiff group of differential equations. These are initial value and reduced order problems. But when the order of the expansion is high and the problems are BVPs, the residual power series method can suffer from poor convergence and precision. To overcome this problem, an updated version of the method called the improved residual power series method (IRPSM) was developed.

Inspired by Gul et al. [16], who have extended RPSM to the approximate solutions to boundary value problems, they solved the 5th and 6th-order boundary value problems by using IRPSM. They were the first ones to give proper shape to IRPSM. Later on, Khan et al. [17] solved the 12th-order linear and nonlinear BVPs by using IRPSM. They compared the results of IRPSM with some other methods and the exact solutions of the considered problems. Recently, Dawar et al. [18] implemented the IRPSM in the field of fluid mechanics by solving the thin film flow problem over a planar surface. They compared their results with some numerical and analytical methods and found a good agreement among all the results. In this article, the authors have extended the same method to solve the 13th and 14th-order boundary value problems. The results of the present analysis will be compared with the previous studies in which the authors used the Differential Transform Method (DTM) and the Homotopy Perturbation Method (HPM). Furthermore, the present results will be compared with the exact solution and residual error of the considered problem. The study is organized as follows: Sect. 2 presents the basic idea of IRPSM. Section 3 presents solutions to boundary value problems by IRPSM. Section 4 presents the discussion of the obtained results. Section 5 presents the conclusion of the analysis.

2 Basic idea of IRPSM

For determining the solution of IVPs, RPSM contains the power series expansion around the initial point \(u = u_{0}\). We extract initial conditions from the exact solution for BVPs. Using IRPSM, we assume the boundary conditions as initial conditions by inserting dummy variables and find out later with the help of boundary conditions. To understand the basic idea of IRPSM, consider below nth order BVP:

$$ y^{\left( n \right)} \left( u \right) = g\left( {u,y^{\left( m \right)} \left( u \right)} \right),0 \le u \le a,m = 0,1,2,...,n - 1, $$
(1)

with boundary conditions:

$$ y^{\left( n \right)} \left( u \right) = \beta_{m} ,m = 0,1,2,...,n - 1. $$
(2)

and initial conditions:

$$ y^{\left( n \right)} \left( 0 \right) = \alpha_{m} ,m = 0,1,2,...,n - 1. $$
(3)

In Eqs. (1) and (3), \(y\) is unknown, and \(g\) and \(\alpha_{m}\) are known constants or functions. Assume the kth truncated power series as:

$$ y\left( u \right) = \mathop \sum \limits_{j = 0}^{k} P_{j} u^{j} ,k = 0,1,2,...,n - 1, $$
(4)

where \(P_{j}\) are the unknowns to be calculated. Since the BVP is of nth order, we shall determine the value of the constants \(P_{j}\) for \(j = 0,\,1,\,2,...,n - 1\). For \(k = 0\), Eq. (4) reduces as:

$$ y\left( u \right) = \mathop \sum \limits_{j = 0}^{0} P_{j} u^{j} . $$
(5)

Putting \(u = 0\) in Eq. (5) and comparing with the initial condition, we have:

$$ P_{0} = \alpha_{0} . $$
(6)

For \(k = 1\), taking first derivative of Eq. (4) and then substitute \(u = 0\). Comparing with the initial condition yields to:

$$ P_{1} = \frac{{\alpha_{1} }}{1!}. $$
(7)

Repeating the same procedure for \(k = 2\) one can get:

$$ P_{2} = \frac{1}{2!}\alpha_{2} . $$
(8)

For \(k = n - 1\), taking the \(\left( {n - 1} \right)\) times derivative of Eq. (4) and then substitute \(u = 0\). Comparing with the initial condition we get:

$$ P_{n - 1} = \frac{1}{{\left( {n - 1} \right)!}}\alpha_{n - 1} . $$
(9)

It should be noted that for boundary value problems, we rely on boundary conditions to determine the value of unknown initial conditions after assuming their value. Rest of the constants \(P_{j}\) for \(k = n,n + 1,n + 2,...\), can be obtained by employing the following method. First consider the kth truncated series as:

$$ y\left( u \right) = y_{initial} \left( u \right) + \mathop \sum \limits_{j = n}^{k} P_{j} u^{j} , $$
(10)

where \(y_{initial}\) is the kth truncated series. For \(k = 0,1,2,...,n - 1\), \(y_{initial}\) is given as:

$$ y_{initial} \left( u \right) = y^{{\left( {n - 1} \right)}} \left( u \right) = P_{0} + P_{1} u + P_{2} u^{2} + \ldots + P_{n - 1} u^{n - 1} . $$
(11)

Substituting the values \(P_{j}\) of in Eq. (11), we get:

$$ y_{initial} \left( u \right) = \alpha_{0} + \alpha_{1} u + \frac{1}{2!}\alpha_{2} u^{2} + \ldots + \frac{1}{{\left( {n - 1} \right)!}}\alpha_{n - 1} u^{n - 1} . $$
(12)

Rewriting Eq. (1) in the form given below:

$$ y^{\left( n \right)} \left( u \right) - g\left( {u,y^{\left( m \right)} \left( u \right)} \right) = 0. $$
(13)

Using Eq. (4) in Eq. (13) to obtain the following kth order residual function:

$$ Res^{k} \left( u \right) = \mathop \sum \limits_{j = n}^{k} j\left( {j - 1} \right)\left( {j - 2} \right) \ldots \left( {j - n + 1} \right)P_{j} u^{j - n} - g\left( {u,\mathop \sum \limits_{j = m}^{k} j\left( {j - 1} \right)\left( {j - 2} \right) \ldots \left( {j - m + 1} \right)P_{j} u^{j - m} } \right). $$
(14)

By RPSM, we have:

$$ \frac{{{\text{d}}^{k - n} }}{{{\text{d}}u^{k - n} }}Res^{k} \left( 0 \right) = 0. $$
(15)

To obtain the nth approximate solution set \(k = n\) (\(n\) is the order of the problem) in Eq. (15), we get:

$$ Res^{n} \left( u \right) = \mathop \sum \limits_{j = n}^{n} j\left( {j - 1} \right)\left( {j - 2} \right) \ldots \left( {j - n + 1} \right)P_{j} u^{j - n} - g\left( {u,\mathop \sum \limits_{j = m}^{n} j\left( {j - 1} \right)\left( {j - 2} \right) \ldots \left( {j - m + 1} \right)P_{j} u^{j - m} } \right) $$
(16)

Differentiating Eq. (16) (k − n) times with respect to \(u\) and setting \(u = u_{0}\), we get:

$$ \frac{{d^{k - n} }}{{du^{k - n} }}{\text{Res}}^{k} \left( {u_{0} } \right) = \left\{ \begin{gathered} \,\,\,\,\,\frac{{d^{k - n} }}{{du^{k - n} }}\left( {\mathop \sum \limits_{j = n}^{k} j\left( {j - 1} \right)\left( {j - 2} \right) \ldots \left( {j - n + 1} \right)P_{j} u^{j - n} } \right) - \hfill \\ \frac{{d^{k - n} }}{{du^{k - n} }}\left\{ {g\left( {u,\mathop \sum \limits_{j = m}^{k} j\left( {j - 1} \right)\left( {j - 2} \right) \ldots \left( {j - m + 1} \right)P_{j} u^{j - m} } \right)} \right\}\,\,\, \hfill \\ \end{gathered} \right\},\,\,\,\,m = 0,1,2,...,n - 1. $$
(17)

From this, we obtained the value of \(P_{n}\). So, the nth truncated series will become:

$$ y^{n} \left( u \right) = P_{0} + P_{1} u + P_{2} u^{2} + \cdots + P_{n} u^{n} . $$
(18)

To obtain the required accuracy, repeat this procedure.

3 Solution of the boundary value problems by IRPSM

3.1 Solution of the 13th order linear boundary value problem

Apply IRPSM to solve the below given 13th-order linear boundary value problem:

$$ y^{{\left( {13} \right)}} \left( u \right) = \cos \left( u \right) - \sin \left( u \right), $$
(19)

with the boundary conditions:

$$ \begin{gathered} \,\,\,\,\,\,y\left( 0 \right) = y^{\left( 1 \right)} \left( 0 \right) = y^{\left( 4 \right)} \left( 0 \right) = y^{\left( 5 \right)} \left( 0 \right) = 1,\,\,\,y^{\left( 2 \right)} \left( 0 \right) = y^{\left( 3 \right)} \left( 0 \right) = y^{\left( 6 \right)} \left( 0 \right) = - 1, \hfill \\ \,\,y\left( 1 \right) = \cos \left( 1 \right) + \sin \left( 1 \right),\,\,\,y^{\left( 1 \right)} \left( 1 \right) = \cos \left( 1 \right) - \sin \left( 1 \right),\,\,\,y^{\left( 2 \right)} \left( 1 \right) = - \cos \left( 1 \right) - \sin \left( 1 \right), \hfill \\ y^{\left( 3 \right)} \left( 1 \right) = - \cos \left( 1 \right) + \sin \left( 1 \right),\,\,\,y^{\left( 4 \right)} \left( 1 \right) = \cos \left( 1 \right) + \sin \left( 1 \right),\,\,\,y^{\left( 5 \right)} \left( 1 \right) = \cos \left( 1 \right) - \sin \left( 1 \right). \hfill \\ \end{gathered} $$
(20)

Analytic solution of the Eq. (19) is given as:

$$ y\left( u \right) = \cos \left( u \right) + \sin \left( u \right). $$
(21)

We know that the given Eq. (19) is of thirteen-order, so we need thirteen initial conditions. Since, seven initial conditions are given and the rest of the boundary conditions will be considered as initial conditions by assigning dummy variables. Later on, we will find these initial conditions by mean of boundary conditions. Therefore, we assume that:

$$ \begin{gathered} y\left( 0 \right) = 1,y^{(1)} \left( 0 \right) = 1,y^{(2)} \left( 0 \right) = - 1,y^{(3)} \left( 0 \right) = - 1,y^{(4)} \left( 0 \right) = 1,y^{(5)} \left( 0 \right) = 1,y^{(6)} \left( 0 \right) = - 1, \hfill \\ y^{(7)} \left( 0 \right) = a,y^{(8)} \left( 0 \right) = b,y^{(9)} \left( 0 \right) = c,y^{(10)} \left( 0 \right) = d,y^{(11)} \left( 0 \right) = e,y^{(12)} \left( 0 \right) = f, \hfill \\ \end{gathered} $$
(22)

where a, b, c, d, e and f, are the missing conditions which have to be determined. Consider the following truncated series:

$$ y\left( u \right) = \sum\limits_{j = 0}^{k} {y_{j} u^{j} ,} \,\,\,j = 0,1,2,...,k. $$
(23)

Using Eq. (23) to find the values of constants \(y_{j}\). Putting \(k = 0\) in (23), we have:

$$ y_{0} = 1. $$
(24)

For \(j = 1\), differentiating Eq. (23) one time and substitute \(u = 0\), we have:

$$ y_{1} = 1. $$
(25)

Furthermore, we have obtained the following constants:

$$ \left\{ \begin{gathered} y_{2} = - \frac{1}{2},\,\,y_{3} = - \frac{1}{3!},\,\,\,y_{4} = \frac{1}{4!},\,\,\,y_{5} = \frac{1}{5!},\,\,\,y_{6} = - \frac{1}{6!},\,\,\,y_{7} = \frac{a}{7!}, \hfill \\ \,\,\,\,\,\,\,\,y_{8} = \frac{b}{8!},\,\,\,y_{9} = \frac{c}{9!},\,\,\,y_{10} = \frac{d}{10!},\,\,\,y_{11} = \frac{e}{11!},\,\,\,y_{12} = \frac{f}{12!}. \hfill \\ \end{gathered} \right\} $$
(26)

Rewriting the given boundary value problem Eq. (19) in the form:

$$ y^{{\left( {13} \right)}} \left( u \right) - \cos u + \sin u = 0 $$
(27)

The kth residual function can be written as:

$$ \frac{{{\text{d}}^{k - 13} }}{{{\text{d}}u^{k - 13} }}Res^{k} \left( u \right) = 0,\,\,\,\, k = 13,14,15, \ldots . $$
(28)

Thus, the kth residual function of Eq. (27) can be written as:

$$ \frac{{{\text{d}}^{k - 13} }}{{{\text{d}}u^{k - 13} }}\left\{ {\mathop \sum \limits_{j = 13}^{k} \left( \begin{gathered} j\left( {j - 1} \right)\left( {j - 2} \right)\left( {j - 3} \right)\left( {j - 4} \right)\left( {j - 5} \right)\left( {j - 6} \right)\left( {j - 7} \right) \hfill \\ \,\,\,\,\,\,\left( {j - 8} \right)\left( {j - 9} \right)\left( {j - 10} \right)\left( {j - 11} \right) \left( {j - 12} \right)y_{j} u^{j - 13} \hfill \\ \end{gathered} \right) - {\text{cos}}\left( u \right) + {\text{sin}}\left( u \right)} \right\} = 0. $$
(29)

For \(k = 13\) at \(u = 0\), we have:

$$ y_{13} = \frac{1}{6{,}227{,}020{,}00}. $$
(30)

Similarly, the following results are obtained:

$$ y_{14} = - \frac{1}{87{,}178{,}291{,}200},\,\,\,y_{15} = - \frac{1}{1{,}307{,}674{,}368{,}000}, $$
(31)

and so on.

Now, by inserting the values \(y_{i} \left( {i = 0 - 30} \right)\) in Eq. (23), we can obtain the following approximate solution in terms of dummy variables:

$$ y\left( u \right) = \left\{ \begin{gathered} 1 + u - \frac{{u^{2} }}{2} - \frac{{u^{3} }}{6} + \frac{{u^{4} }}{24} + \frac{{u^{5} }}{120} - \frac{{u^{6} }}{720} + \frac{{au^{7} }}{5040} + \frac{{bu^{8} }}{40{,}320} + \frac{{cu^{9} }}{362{,}880} + \frac{{du^{10} }}{3{,}628{,}800} + \frac{{eu^{11} }}{39{,}916{,}800} \hfill \\ + \frac{{fu^{12} }}{479{,}001{,}600} + \frac{{u^{13} }}{6{,}227{,}020{,}800} - \frac{{u^{14} }}{87{,}178{,}291{,}200} - \frac{{u^{15} }}{1{,}307{,}674{,}368{,}000} + \frac{{u^{16} }}{20{,}922{,}789{,}888{,}000} \hfill \\ + \frac{{u^{17} }}{355{,}687{,}428{,}096{,}000} - \frac{{u^{18} }}{6{,}402{,}373{,}705{,}728{,}000} - \frac{{u^{19} }}{121{,}645{,}100{,}408{,}832{,}000} + \hfill \\ \frac{{u^{20} }}{2{,}432{,}902{,}008{,}176{,}640{,}000} + \frac{{u^{21} }}{51{,}090{,}942{,}171{,}709{,}440{,}000} - \frac{{u^{22} }}{1{,}124{,}000{,}727{,}777{,}607{,}680{,}000} - \hfill \\ \frac{{u^{23} }}{25{,}852{,}016{,}738{,}884{,}976{,}640{,}000} + \frac{{u^{24} }}{620{,}448{,}401{,}733{,}239{,}439{,}360{,}000} + \hfill \\ \frac{{u^{25} }}{15{,}511{,}210{,}043{,}330{,}985{,}984{,}000{,}000} - \frac{{u^{26} }}{403{,}291{,}461{,}126{,}605{,}635{,}584{,}000{,}000} - \hfill \\ \frac{{u^{27} }}{10{,}888{,}869{,}450{,}418{,}352{,}160{,}768{,}000{,}000} + \frac{{u^{28} }}{304{,}888{,}344{,}611{,}713{,}860{,}501{,}504{,}000{,}000} + \hfill \\ \frac{{u^{29} }}{8{,}841{,}761{,}993{,}739{,}701{,}954{,}543{,}616{,}000{,}000} - \frac{{u^{30} }}{265{,}252{,}859{,}812{,}191{,}058{,}636{,}308{,}480{,}000{,}000} \hfill \\ \end{gathered} \right\}. $$
(32)

Using the boundary conditions to find the values of the dummy variables in Eq. (32), we have:

$$ \left\{ \begin{gathered} \,\,\,a = 1.0000000001528646,\,\,\,b = 1.0000000054366935,\,\,\,c = 0.9999999119447364, \hfill \\ d = - 0.9999991998813114,\,\,\,e = - 1.0000040314881915,\,\,\,f = 1.0000089254343427. \hfill \\ \end{gathered} \right\} $$
(33)

Substituting these values in Eq. (33), we get:

$$ y\left( u \right) = \left\{ \begin{gathered} 1 + u - \frac{{u^{2} }}{2} - \frac{{u^{3} }}{6} + \frac{{u^{4} }}{24} + \frac{{u^{5} }}{120} - \frac{{u^{6} }}{720} - 0.0001984126984430287u^{7} + 0.00002480158743642593u^{8} \hfill \\ + 0.000002755731679741888u^{9} - 2.755729717485976 \times 10^{ - 7} u^{10} - 2.5052209382720 \times 10^{ - 8} u^{11} \hfill \\ + 2.087694332199188 \times 10^{ - 9} u^{12} + \frac{{u^{13} }}{6{,}227{,}020{,}800} - \frac{{u^{14} }}{87{,}178{,}291{,}200} - \frac{{u^{15} }}{1{,}307{,}674{,}368{,}000} \hfill \\ + \frac{{u^{16} }}{20{,}922{,}789{,}888{,}000} + \frac{{u^{17} }}{355{,}687{,}428{,}096{,}000} - \frac{{u^{18} }}{6{,}402{,}373{,}705{,}728{,}000} - \frac{{u^{19} }}{121{,}645{,}100{,}408{,}832{,}000} \hfill \\ + \frac{{u^{20} }}{2{,}432{,}902{,}008{,}176{,}640{,}000} + \frac{{u^{21} }}{51{,}090{,}942{,}171{,}709{,}440{,}000} - \frac{{u^{22} }}{1{,}124{,}000{,}727{,}777{,}607{,}680{,}000} - \hfill \\ \frac{{u^{23} }}{25{,}852{,}016{,}738{,}884{,}976{,}640{,}000} + \frac{{u^{24} }}{620{,}448{,}401{,}733{,}239{,}439{,}360{,}000} + \frac{{u^{25} }}{155{,}112{,}100{,}433{,}309{,}859{,}840} - \hfill \\ \frac{{u^{26} }}{403{,}291{,}461{,}126{,}605{,}635{,}584{,}000{,}000} - \frac{{u^{27} }}{10{,}888{,}869{,}450{,}418{,}352{,}160{,}768{,}000{,}000} \hfill \\ + \frac{{u^{28} }}{304{,}888{,}344{,}611{,}713{,}860{,}501{,}504{,}000{,}000} + \frac{{u^{29} }}{8{,}841{,}761{,}993{,}739{,}701{,}954{,}543{,}616{,}000{,}000} \hfill \\ - \frac{{u^{30} }}{265{,}252{,}859{,}812{,}191{,}058{,}636{,}308{,}480{,}000{,}000}. \hfill \\ \end{gathered} \right\} $$
(34)

Equation (34) is the required approximate solution of the problem under consideration.

3.2 Solution of the 13th order nonlinear boundary value problem

Apply IRPSM to solve the below given 13th order nonlinear boundary value problem:

$$ y^{{\left( {13} \right)}} \left( u \right) = {\text{e}}^{ - u} y^{2} \left( u \right), $$
(35)

with the boundary conditions:

$$ \begin{gathered} y\left( 0 \right) = y^{\left( 1 \right)} \left( 0 \right) = y^{\left( 2 \right)} \left( 0 \right) = y^{\left( 3 \right)} \left( 0 \right) = y^{\left( 4 \right)} \left( 0 \right) = y^{\left( 5 \right)} \left( 0 \right) = y^{\left( 6 \right)} \left( 0 \right) = 1, \hfill \\ y\left( 1 \right) = y^{\left( 1 \right)} \left( 1 \right) = y^{\left( 2 \right)} \left( 1 \right) = y^{\left( 3 \right)} \left( 1 \right) = y^{\left( 4 \right)} \left( 1 \right) = y^{\left( 5 \right)} \left( 1 \right) = e. \hfill \\ \end{gathered} $$
(36)

Exact solution of the given problem is:

$$ u\left( x \right) = e^{x} . $$
(37)

We know that Eq. (35) is of thirteen-order, so we need thirteen initial conditions. Following the basic idea of IRPSM, the following initial conditions are determined:

$$ \left\{ \begin{gathered} y\left( 0 \right) = 1,y^{\left( 1 \right)} \left( 0 \right) = 1,y^{\left( 2 \right)} \left( 0 \right) = 1,y^{\left( 3 \right)} \left( 0 \right) = 1,y^{\left( 4 \right)} \left( 0 \right) = 1,y^{\left( 5 \right)} \left( 0 \right) = 1,y^{\left( 6 \right)} \left( 0 \right) = 1, \hfill \\ \,\,\,y^{\left( 7 \right)} \left( 0 \right) = a,y^{\left( 8 \right)} \left( 0 \right) = b,y^{\left( 9 \right)} \left( 0 \right) = c,y^{{\left( {10} \right)}} \left( 0 \right) = d,y^{{\left( {11} \right)}} \left( 0 \right) = f,y^{{\left( {12} \right)}} \left( 0 \right) = g. \hfill \\ \end{gathered} \right\} $$
(38)

where a, b, c, d, f and g, are the missing conditions which have to be determined. Consider the following truncated series:

$$ y\left( u \right) = \sum\nolimits_{j = 0}^{k} {y_{j} u^{j} ,} \,\,\,j = 0,1,2,...,k. $$
(39)

Using Eq. (39) to find the values of constants \(y_{j}\). Putting \(k = 0\) in (39), we have:

$$ y_{0} = 1. $$
(40)

For \(j = 1\), differentiating Eq. (39) one time and substitute \(u = 0\), we have:

$$ y_{1} = 1. $$
(41)

Furthermore, we have obtained the following constants:

$$ \left\{ \begin{gathered} y_{2} = \frac{1}{2!},\,\,\,y_{3} = \frac{1}{3!}, \,\,\,y_{4} = \frac{1}{4!},\,\,\,y_{5} = \frac{1}{5!},\,\,\,y_{6} = \frac{1}{6!},\,\,\,y_{7} = \frac{a}{7!}, \hfill \\ \,\,\,\,\,y_{8} = \frac{b}{8!},\,\,\,y_{9} = \frac{c}{9!},\,\,\,y_{10} = \frac{d}{10!},\,\,\,y_{11} = \frac{f}{11!},\,\,\,y_{12} = \frac{g}{12!}. \hfill \\ \end{gathered} \right\} $$
(42)

Rewriting the given boundary value problem in the below form:

$$ y^{{\left( {13} \right)}} \left( u \right) - {\text{e}}^{ - u} y^{2} \left( u \right) = 0. $$
(43)

The kth residual function can be written as:

$$ \frac{{{\text{d}}^{k - 13} }}{{{\text{d}}u^{k - 13} }}Res^{k} \left( u \right) = 0,\,\,\,\, k = 13,\,14,\,15, \ldots . $$
(44)

Thus, the kth residual function of Eq. (27) can be written as:

$$ \frac{{{\text{d}}^{k - 13} }}{{{\text{d}}u^{k - 13} }}\left\{ {\mathop \sum \limits_{j = 13}^{k} \left( \begin{gathered} j\left( {j - 1} \right)\left( {j - 2} \right)\left( {j - 3} \right)\left( {j - 4} \right)\left( {j - 5} \right)\left( {j - 6} \right)\left( {j - 7} \right) \hfill \\ \,\,\,\,\,\left( {j - 8} \right)\left( {j - 9} \right)\left( {j - 10} \right)\left( {j - 11} \right)\left( {j - 12} \right)y_{j} u^{j - 13} \hfill \\ \end{gathered} \right) - {\text{e}}^{ - u} \left( {\mathop \sum \limits_{j = 0}^{13} y_{j} u^{j} } \right)^{2} } \right\} = 0. $$
(45)

For \(k = 13\) at \(u = 0\), we have:

$$ y_{13} = \frac{1}{6{,}227{,}020{,}800}. $$
(46)

Similarly, the following results are obtained:

$$ y_{14} = \frac{1}{87{,}178{,}291{,}200},\,\,\,y_{15} = \frac{1}{1{,}307{,}674{,}368{,}000}. $$
(47)

and so on.

Now, by inserting the values \(y_{i} \left( {i = 0 - 25} \right)\) in Eq. (39), we obtained the following approximate solution in terms of dummy variables:

$$ y\left( u \right) = \left\{ \begin{gathered} 1 + u + \frac{{u^{2} }}{2} + \frac{{u^{3} }}{6} + \frac{{u^{4} }}{24} + \frac{{u^{5} }}{120} + \frac{{u^{6} }}{720} + \frac{{au^{7} }}{5040} + \frac{{bu^{8} }}{40{,}320} + \frac{{cu^{9} }}{362{,}880} + \frac{{du^{10} }}{3{,}628{,}800} + \frac{{fu^{11} }}{39{,}916{,}800} \hfill \\ + \frac{{gu^{12} }}{479{,}001{,}600} + \frac{{u^{13} }}{6{,}227{,}020{,}800} + \frac{{u^{14} }}{87{,}178{,}291{,}200} + \frac{{u^{15} }}{1{,}307{,}674{,}368{,}000} + \frac{{u^{16} }}{20{,}922{,}789{,}888{,}000} \hfill \\ + \frac{{u^{17} }}{355{,}687{,}428{,}096{,}000} + \frac{{u^{18} }}{6{,}402{,}373{,}705{,}728{,}000} + \frac{{u^{19} }}{121{,}645{,}100{,}408{,}832{,}000} - \hfill \\ \frac{{u^{20} }}{2{,}432{,}902{,}008{,}176{,}640{,}000} + \frac{{au^{20} }}{1{,}216{,}451{,}004{,}088{,}320{,}000} - \frac{{u^{21} }}{51{,}090{,}942{,}171{,}709{,}440{,}000} + \hfill \\ \frac{{bu^{21} }}{25{,}545{,}471{,}085{,}854{,}720{,}000} - \frac{{u^{22} }}{1{,}124{,}000{,}727{,}777{,}607{,}680{,}000} + \frac{{cu^{22} }}{562{,}000{,}363{,}888{,}803{,}840{,}000} \hfill \\ - \frac{{u^{23} }}{25{,}852{,}016{,}738{,}884{,}976{,}640{,}000} + \frac{{du^{23} }}{12{,}926{,}008{,}369{,}442{,}488{,}320{,}000} - \hfill \\ \frac{{u^{24} }}{620{,}448{,}401{,}733{,}239{,}439{,}360{,}000} + \frac{{fu^{24} }}{310{,}224{,}200{,}866{,}619{,}719{,}680{,}000} - \hfill \\ \frac{{u^{25} }}{15{,}511{,}210{,}043{,}330{,}985{,}984{,}000{,}000} + \frac{{gu^{25} }}{7{,}755{,}605{,}021{,}665{,}492{,}992{,}000{,}000} \hfill \\ \end{gathered} \right\}. $$
(48)

Using the boundary conditions to find the values of the dummy variables in Eq. (48), we have:

$$ \left\{ \begin{gathered} a = 0.9999999993169848,\,\,\,b = 1.0000000239098972,\,\,\,c = 0.9999996172466545, \hfill \\ d = 1.0000034468309997,\,\,\,f = 0.999982755640125,\,\,\,g = 1.0000379587046038. \hfill \\ \end{gathered} \right\} $$
(49)

Substituting these values in Eq. (48), we get:

$$ y\left( u \right) = \left\{ \begin{gathered} 1 + u + \frac{{u^{2} }}{2} + \frac{{u^{3} }}{6} + \frac{{u^{4} }}{24} + \frac{{u^{5} }}{120} + \frac{{u^{6} }}{720} + 0.0001984126982771795u^{7} + \hfill \\ 0.000024801587894590704u^{8} + 0.000002755730867632976u^{9} \hfill \\ + 2.755741420940806 \times 10^{ - 7} u^{10} + 2.505167637786909 \times 10^{ - 8} u^{11} \hfill \\ + 2.087754944251968 \times 10^{ - 9} u^{12} + \frac{{u^{13} }}{6227020800} + \frac{{u^{14} }}{87178291200} \hfill \\ + \frac{{u^{15} }}{1307674368000} + \frac{{u^{16} }}{20922789888000} + \frac{{u^{17} }}{355687428096000} + \hfill \\ \frac{{u^{18} }}{6402373705728000} + \frac{{u^{19} }}{121645100408832000} + \hfill \\ 4.110317617697346 \times 10^{ - 19} u^{20} + 1.957294199936448 \times 10^{ - 20} u^{21} \hfill \\ + 8.896784581897299 \times 10^{ - 22} u^{22} + 3.868196836479508 \times 10^{ - 23} u^{23} \hfill \\ + 1.61168198434302 \times 10^{ - 24} u^{24} + 6.447439720087697 \times 10^{ - 26} u^{25} \hfill \\ \end{gathered} \right\}. $$
(50)

Equation (50) is the required approximate solution of the problem under consideration.

3.3 Solution of the 14th order nonlinear boundary value problem

Apply IRPSM to solve the below given 14th order nonlinear boundary value problem:

$$ y^{{\left( {14} \right)}} \left( u \right) = {\text{e}}^{ - u} y^{2} \left( u \right), $$
(51)

with the boundary conditions:

$$ \left\{ \begin{gathered} y\left( 0 \right) = y^{\left( 2 \right)} \left( 0 \right) = y^{\left( 4 \right)} \left( 0 \right) = y^{\left( 6 \right)} \left( 0 \right) = y^{\left( 8 \right)} \left( 0 \right) = y^{{\left( {10} \right)}} \left( 0 \right) = y^{{\left( {12} \right)}} \left( 0 \right) = 1, \hfill \\ \,\,y\left( 1 \right) = y^{\left( 2 \right)} \left( 1 \right) = y^{\left( 4 \right)} \left( 1 \right) = y^{\left( 6 \right)} \left( 1 \right) = y^{\left( 8 \right)} \left( 1 \right) = y^{{\left( {10} \right)}} \left( 1 \right) = y^{{\left( {12} \right)}} \left( 1 \right) = e. \hfill \\ \end{gathered} \right\} $$
(52)

Exact solution of the given problem is:

$$ y\left( u \right) = e^{u} . $$
(53)

We know that Eq. (51) is of fourteen-order, so we need fourteen initial conditions. Following the basic idea of IRPSM, the following initial conditions are determined:

$$ \left\{ \begin{gathered} \,\,\,\,\,y\left( 0 \right) = 1,\,\,\,y^{\left( 1 \right)} \left( 0 \right) = a,\,\,\,y^{\left( 2 \right)} \left( 0 \right) = 1,\,\,\,y^{\left( 3 \right)} \left( 0 \right) = b,\,\,\,y^{\left( 4 \right)} \left( 0 \right) = 1,\,\,\,y^{\left( 5 \right)} \left( 0 \right) = c,\,\,\,y^{\left( 6 \right)} \left( 0 \right) = 1,\,\,\, \hfill \\ y^{\left( 7 \right)} \left( 0 \right) = d,\,\,\,y^{\left( 8 \right)} \left( 0 \right) = 1,\,\,\,y^{\left( 9 \right)} \left( 0 \right) = f,\,\,\,y^{{\left( {10} \right)}} \left( 0 \right) = 1,\,\,\,y^{{\left( {11} \right)}} \left( 0 \right) = g,\,\,\,y^{{\left( {12} \right)}} \left( 0 \right) = 1,\,\,\,y^{{\left( {13} \right)}} \left( 0 \right) = h. \hfill \\ \end{gathered} \right\} $$
(54)

where a, b, c, d, f, g and h, are the missing conditions which have to be determined. Consider the following truncated series:

$$ y\left( u \right) = \sum\limits_{j = 0}^{k} {y_{j} u^{j} ,} \,\,\,j = 0,1,2,...,k. $$
(55)

Using Eq. (55) to find the values of constants \(y_{j}\). Putting \(k = 0\) in (3.3.5), we have:

$$ y_{0} = 1. $$
(56)

For \(j = 1\), differentiating Eq. (55) one time and substitute \(u = 0\), we have:

$$ y_{1} = a. $$
(57)

Furthermore, we have obtained the following constants:

$$ \left\{ \begin{gathered} \,\,\,\,\,y_{2} = \frac{1}{2},\,\,\,y_{3} = \frac{b}{3!},\,\,\,y_{4} = \frac{1}{4!},\,\,\,y_{5} = \frac{c}{5!},\,\,\,y_{6} = \frac{1}{6!},\,\,\,y_{7} = \frac{d}{7!},\,\, \hfill \\ y_{8} = \frac{1}{8!},\,\,\,y_{9} = \frac{f}{9!},\,\,\,y_{10} = \frac{1}{10!},\,\,\,y_{11} = \frac{g}{11!},\,\,\,y_{12} = \frac{1}{12!},\,\,\,y_{13} = \frac{h}{13!}. \hfill \\ \end{gathered} \right\} $$
(58)

Rewriting the given boundary value problem in the below form:

$$ y^{{\left( {14} \right)}} \left( u \right) - e^{ - u} y^{2} \left( u \right) = 0. $$
(59)

The kth residual function can be written as:

$$ \frac{{d^{k - 14} }}{{du^{k - 14} }}{\text{Res}}^{k} \left( u \right) = 0,\,\,\,\, k = 14,\,\,15,\,\,16, \ldots . $$
(60)

Thus, the kth residual function of Eq. (59) can be written as:

$$ \frac{{d^{k - 14} }}{{du^{k - 14} }}\left\{ {\sum\limits_{j = 14}^{k} {\left( \begin{gathered} j\left( {j - 1} \right)\left( {j - 2} \right)\left( {j - 3} \right)\left( {j - 4} \right)\left( {j - 5} \right)\left( {j - 6} \right)\left( {j - 7} \right) \hfill \\ \left( {j - 8} \right)\left( {j - 9} \right)\left( {j - 10} \right)\left( {j - 11} \right) \left( {j - 12} \right)\left( {j - 3} \right)y_{j} u^{j - 14} \hfill \\ \end{gathered} \right)} - e^{ - u} \left( {\mathop \sum \limits_{j = 0}^{14} y_{j} u^{j} } \right)^{2} } \right\} = 0. $$
(61)

For \(k = 14\) at \(u = 0\), we have:

$$ y_{14} = \frac{1}{87178291200}. $$
(62)

Similarly, the following results are obtained:

$$ y_{15} = \frac{ - 1 + 2a}{{1307674368000}},\,\,\,y_{16} = \frac{{3 - 4a + 2a^{2} }}{20922789888000}, $$
(63)

and so on.

Now, by inserting the values \(y_{i} \left( {i = 0 - 25} \right)\) in Eq. (63), we obtained the following approximate solution in terms of dummy variables:

$$ y\left( u \right) = \left\{ \begin{gathered} 1 + au + \frac{{u^{2} }}{2} + \frac{{bu^{3} }}{6} + \frac{{x^{4} }}{24} + \frac{{cu^{5} }}{120} + \frac{{u^{6} }}{720} + \frac{{du^{7} }}{5040} + \frac{{u^{8} }}{40320} + \frac{{fu^{9} }}{362880} + \frac{{u^{10} }}{3628800} + \frac{{gu^{11} }}{39916800} \hfill \\ + \frac{{u^{12} }}{479001600} + \frac{{hu^{13} }}{6227020800} + \frac{{u^{14} }}{87178291200} - \frac{{u^{15} }}{1307674368000} + \frac{{au^{15} }}{653837184000} \hfill \\ + \frac{{u^{16} }}{6974263296000} - \frac{{au^{16} }}{5230697472000} + \frac{{a^{2} u^{16} }}{10461394944000} - \frac{{u^{17} }}{50812489728000} + \hfill \\ \frac{{au^{17} }}{29640619008000} - \frac{{a^{2} u^{17} }}{59281238016000} + ... + \frac{{gu^{25} }}{7755605021665492992000000} \hfill \\ \end{gathered} \right\}. $$
(64)

Using the boundary conditions to find the values of the dummy variables in Eq. (64), we have:

$$ \left\{ \begin{gathered} a = 0.9999999999999992,\,\,\,b = 0.9999999999999996, \hfill \\ \,c = 1.0000000000000022,d = 0.9999999999999742, \hfill \\ \,f = 1.000000000000243,\,\,\,g = 0.9999999999978826, \hfill \\ \,\,h = 1.0000000000132956. \hfill \\ \end{gathered} \right\} $$
(65)

Substituting these values in Eq. (64), we get:

$$ y\left( u \right) = \left\{ \begin{gathered} 1 + 0.9999999999999992u + \frac{{u^{2} }}{2} + 0.16666666666666657u^{3} + \frac{{u^{4} }}{24} \hfill \\ + 0.008333333333333352u^{5} + + \frac{{u^{6} }}{720} + 0.0001984126984126933u^{7} \hfill \\ + \frac{{u^{8} }}{40320} + 0.000002755731922399259u^{9} + \frac{{u^{10} }}{3628800} + ... + \hfill \\ + 1.611737571097584 \times 10^{ - 24} u^{24} + 6.44695028436102 \times 10^{ - 26} u^{25} \hfill \\ \end{gathered} \right\}. $$
(66)

Equation (66) is the required approximate solution of the problem under consideration.

4 Discussion

This section presents the discussion about obtained results by using IRPSM. Here, we have compared our results with the previous results obtained by Iftikhar et al. [19] and Zari et al. [20]. Iftikhar et al. [19] solved the 13th-order linear and nonlinear problems by using DTM and Zari et al. [20] solved the 14th-order nonlinear problem by using HPM. The results obtained by using IRPMS are compared with those published results of Iftikhar et al. [19] are shown in Tables 1 and 2. From these tables, we can see that the error analysis of the present applied method (IRPSM) are very close to the exact solution when compared to the results obtained by Iftikhar et al. [19]. Thus, one can say that the IRPSM is of better interest than the DTM for solving both the 13th-order linear and nonlinear problems. Additionally, Figs. 1 and 2 are displayed for the comparison of absolute and residual analysis. Figures 3 and 4 are displayed for the comparison of the exact and approximate solutions obtained by IRPSM, respectively. In Table 3, the 14th-order nonlinear problem is solved by IRPSM and compared the present results with HPM. The obtained results are compared with the published results of Zari et al. [20]. Zari et al. [20] used the HPM technique for solving the 14th-order nonlinear problem. Here, we can see that the error analysis of the present applied method (IRPSM) are very close to the exact solution when compared to the results obtained by Zari et al. [20]. Thus, one can say that the IRPSM is of better interest than the HPM for solving the 14th-order nonlinear problem. Additionally, Figs. 5 and 6 are displayed for the comparison of exact and approximate solutions, and absolute and residual errors, respectively. Overall, the results obtained by IRPSM are closely related to the exact solution when compared to the DTM and HPM results.

Table 1 Comparison of the IRPSM and DTM results
Table 2 Comparison of the IRPSM and VIM results
Fig. 1
figure 1

Comparison of absolute and residual errors

Fig. 2
figure 2

Comparison of absolute and residual errors

Fig. 3
figure 3

Comparison of the approximate and exact solutions

Fig. 4
figure 4

Comparison of the approximate and exact solutions

Table 3 Comparison of the IRPSM and HPM results
Fig. 5
figure 5

Comparison of the approximate and exact solutions

Fig. 6
figure 6

Comparison of absolute and residual errors

5 Conclusion

Boundary value problems can be resolved using the improved residual power series method (IRPSM) without an exact solution being known. In this paper, the thirteen and fourteen-order linear and nonlinear BVPs are solved by using IRPSM. Mathematica 12.0 was used to do simulations related to the three examples covered here. When the resulting outcomes are compared to previous studies in the literature, the IRPSM is proven to be more trustworthy and effective than other methods. The results of this method are remarkably close to the exact solution. Absolute errors have been computed to ensure accuracy. The procedure provided greater precision, demonstrating the effectiveness of the given method.