1 Introduction

In the field of engineering and applied sciences, particularly in combination of mathematics and physics, the ordinary differential equations (ODEs) play a key role for describing a real-world phenomenon. Differential equations also arises in mathematical modelling such as viscoelastic flow which is represented by fifth-order nonlinear ODEs with two-point boundary conditions and is studied by Davies [1]. Many other methods used by researchers such as Adomian decomposition technique (ADM) used by Wazwaz [2] to solve fifth-order ODE. Spline techniques like Sextic B splines as weighted function and Quartic B splines as basis function in Petrove–Galerkin methods are implemented to solve fifth order ODEs [3]. Variation of parameter technique is also used for numerical solution of fifth-order ODEs in [4]. Beside of these methods, other techniques have also been reported to solve fifth-order ODEs in [5, 6]. Apart from ODEs there are also some applied problems which have importance in mathematics and applied sciences [7,8,9,10,11].

Several alternative methods exist for approximating higher-order ODEs. For instance, direct explicit numerical integrators of RK-type tailored for a specific class of ninth-order ODEs are presented in [12]. For the approximate solution of the temporal fractional advection diffusion problem, a computational technique based on the finite difference scheme with redefined extended B-spline functions is provided in [13, 14]. The fractional boundary value problems were addressed using the spline collocation approach in [15, 16]. The numerical solution of different partial differential equations are given in [17,18,19,20,21]. Additionally, the utilization of a Newton-Gregory backward difference polynomial as a predictor-corrector technique is discussed in [22]. Moreover, a novel computational approach utilizing Chebyshev series in [23] provides a direct solution pathway for nonlinear higher-order ODEs. Another noteworthy method is presented in [24], which proposes a simple implementation of a Taylor series expansion-based approach for higher-order ODEs. These references offer diverse strategies for tackling higher-order ODEs, each with its unique advantages and applicability.

This paper aims to find the solution to the following nonlinear fifth-order ODE:

$$\begin{aligned} y^{(v)}+g(x,y,y',y'',y''',y^{(iv)})= f(x), \quad \textrm{for} \quad x \in (\lambda _0, \lambda _1). \end{aligned}$$
(1)

Here, we have taken different types of given information along with Eq. (1):

\({\textbf {Case 1:}}\):

Simple boundary conditions

$$\begin{aligned} y(\lambda _0)=\eta _0,\quad y(\lambda _1)=\eta _1,\quad y^{\prime }(\lambda _0)=\eta _2,\quad y^{\prime }(\lambda _1)=\eta _3,\quad y^{\prime \prime }(\lambda _0)=\eta _4.\quad ~ \end{aligned}$$
(2)
\({\textbf {Case 2:}}\):

Two points boundary conditions

$$\begin{aligned} \begin{aligned}&y(\lambda _0)+y(\lambda _1)=\zeta _0,\quad y(\lambda _0)+y^{\prime }(0)=\zeta _1,\quad y(\lambda _0)+y^{\prime }(\lambda _1)=\zeta _2,\qquad ~ \\ {}&y(\lambda _0)+y^{\prime \prime }(\lambda _0)=\zeta _3, y(\lambda _1)+y^{\prime }(\lambda _0)=\zeta _4. \end{aligned} \end{aligned}$$
(3)
\({\textbf {Case 3:}}\):

Two points integral boundary conditions

$$\begin{aligned} \begin{aligned}&\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _0, \qquad y(\lambda _0)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{1}, \\&y(\lambda _1)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{2}\\&y^{\prime }(\lambda _0)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{3}, \qquad y^{\prime }(\lambda _1)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{4}, \end{aligned} \end{aligned}$$
(4)

where \(\beta _0\), \(\zeta _i\), \(\eta _i\), \(\alpha _i\), such that \(i=0,1,2,3,4\) represents constants while g(x) is a given function.

In the early twentieth century, wavelets were utilized to find applications in various forums, such as engineering and applied sciences. Nowadays, its popularity are further extended in different disciplines such as numerical analysis and compression of data. Creating different images for medical purposes by focusing on wavelet theory also highlights the importance of wavelets. The benefit of the wavelet method is that it simplifies the understanding and study of complex functions that may otherwise be difficult to comprehend [25]. Biorthonormal spline wavelet used in fingerprint, different JPEG chip and electrocardiograph analysis are some uses of wavelets in practice [26]. Due to localization properties of wavelet based algorithms, it become famous in numerical analysis. Coiflet, Symlet and Daubechies are some techniques based on wavelet approach, used in numerical solutions of different problems. Wavelet families have some demerits that is the scaling of wavelet function, and therefore cannot provide an explicit representation. In order to integrate or differentiate these wavelets, the process is a little bit complicated.

The introduction of Haar wavelet become famous after implementing it to find the numerical solution of different problems. First of all, Alfred Haar is the one who introduced wavelets notation [27]. Approaches such as Chen & Hasio developed in [28, 29] are then used the wavelet to integrate ODE. After that, Ülo Lepik [30, 31] used direct method in which Haar functions are directly integrated. In order to calculate arbitrary-order integrals, direct technique is easy to implement, but operational matrix technique is applicable only for first-order integrals.

Wavelet methodologies have garnered increased attention as a computational solver for both linear and nonlinear differential equations, encompassing significant to the direct and inverse problems. Initially, Chen and Hsiao formulated a collocation approach utilizing Haar wavelets (CAHW) to address nonlinear stiff systems [28, 29]. Subsequently, Ülo Lepik, a distinguished Estonian mathematician, harnessed the CAHW to tackle a diverse array of applied phenomena within optimal control theory, elastic beam buckling and free vibrations concerning Euler-Bernoulli and Timoshenko beams [30, 31]. In his famous book, he also demonstrated the versatility of the CAHW by adapting it to address integral, evolution, differential and fractional differential equations [31]. It is noteworthy to mention that a machine learning algorithm focus on CAHW has also been designed for damage detection [32]. These remarkable accomplishments have underscored the prominence of CAHW among various researchers, leading many to regard it as a viable solver for their pertinent problems. A concise summary of CAHW with its adaptation to address a wide spectrum of problems can be found in [25, 32,33,34,35,36,37,38,39,40,41,42,43,44]. In 2018, M. Ahsan et al. applied CAHW to discern various types of source functions within the realm of inverse problems [45]. Moreover, CAHW effectively tackles challenging fractional differential equations [46,47,48,49,50]. Furthermore, CAHW has demonstrated its efficacy in resolving a plethora of diverse direct and inverse problems, as documented in [51,52,53,54,55,56,57,58].

Therefore, CAHW is utilized to approximate solutions for ordinary, partial, integral, and fractional differential equations. However, it’s crucial to acknowledge a technical limitation of the Haar wavelet, which lacks continuity and differentiability. Interestingly, this drawback can sometimes serve as an advantage when addressing certain challenging differential equations which have jumps or non-continuities in their solution, as discussed in [34, 45, 56, 59].

1.1 The aim of this study

Up to now, fifth-order ODEs with two-point boundary conditions or two-point integral boundary conditions have not been successfully addressed in the literature by adopting CAHW. This study pioneers the application of the CAHW method to solve fifth-order linear and nonlinear ODEs, specifically addressing specialized cases of boundary conditions like two-point boundary conditions or two-point integral boundary conditions. Hence, this is referred to as the novelty of the paper. Furthermore, in tackling nonlinear equations, numerous researchers have traditionally relied on methods such as Newton’s or Broyden’s method and both of these techniques necessitate the computation of the Jacobian matrix; a procedure known to be time consuming and often considered a drawback of the method. Therefore, a quasi-linearization technique is coupled with CAHW, and calculating the Jacobian is not required. Therefore, the proposed CAHW is efficient as well.

The paper follows a structured flow, beginning with an introduction in which the application of fifth-order ODEs along with a literate survey are elaborated upon in detail. Following this, Sect. 2 provides a comprehensive discussion of the Haar functions, laying the groundwork for the subsequent sections. In Sect. 3, the focus shifts towards the development of numerical approximation techniques designed to handle various types of given conditions effectively. Sect. 4 delves into the convergence analysis of the proposed methods, while Sect. 5 presents the results obtained from applying this technique. Lastly, Section 6 brings together the main discoveries from our study and offers closing thoughts along with potential directions for future research.

2 Haar functions

Representation of generalized Haar wavelet in \([\lambda _0, \lambda _1]\) is given as follows [28, 29]

$$\begin{aligned} H_i(x)={\left\{ \begin{array}{ll} 1 &{} \textrm{for} \quad x\in [\varrho _1(i),\varrho _2(i)),\\ -1 &{} \textrm{for} \quad x\in [\varrho _2(i),\varrho _3(i)),\\ 0 &{} \textrm{elsewhere}, \end{array}\right. } \end{aligned}$$
(5)

where

$$\begin{aligned} \left\{ \begin{array}{l} \varrho _1(i)=\lambda _0+\frac{(\lambda _1-\lambda _0)t_p}{m_r}, \quad \varrho _2(i)=\lambda _0+\frac{(\lambda _1-\lambda _0)(t_p+0.5)}{m_r}, \\ \varrho _3(i)=\lambda _0+\frac{(\lambda _1-\lambda _0)(t_p+d_p)}{m_r}, \\ i=m_r+t_p+1, \quad t_p=0,1,\dots ,m_r-1, \quad m_r=2^{d_p},\;d_p=0,1,\dots ,D_p. \end{array} \right. \end{aligned}$$
(6)

Dilation parameter is denoted by \(d_p\) having its maximum value \(D_p\), and the translation parameter is represented by \(t_p\). The graphical presentation of Haar functions is given in Fig. 1.

Fig. 1
figure 1

Graphical presentation of first sixteen Haar wavelets

To simplify the derivations, the s th-order integrals of the Haar functions are introduced, denoted as \(\rho _{i,s}(x)\), where \(i=1,2,3,\dots \). It is important to note that these values can be obtained through analytical calculations, yielding the following expressions:

$$\begin{aligned} \rho _{i,s}(x)&= {\left\{ \begin{array}{ll} 0 &{} \textrm{for} \quad x<\varrho _1(i),\\ \frac{1}{s!}\Big (x-\varrho _1(i)\Big )^s &{} \textrm{for} \quad x\in [\varrho _1(i),\varrho _2(i)),\\ \frac{1}{s!}\Big ((x-\varrho _1(i))^s-2(x- \varrho _2(i))^s\Big ) &{} \textrm{for} \quad x\in [\varrho _2(i),\varrho _3(i)),\\ \frac{1}{s!}\Big ((x-\varrho _1(i))^s-2(x- \varrho _2(i))^s+(x-\varrho _3(i))^s\Big ) &{} \textrm{for}\quad x\ge \varrho _3(i). \end{array}\right. } \end{aligned}$$

For \(i=1\), the Haar scale function is defined as:

$$\begin{aligned} H_1(x)={\left\{ \begin{array}{ll} 1 &{} \textrm{for} \quad x\in [\lambda _0,\lambda _1],\\ 0 &{} \textrm{elsewhere}, \end{array}\right. } \end{aligned}$$

and

$$\begin{aligned} \rho _{1,s}(x)=\frac{(x-a)^{s}}{s!}. \end{aligned}$$

3 Collocation approach utilizing Haar wavelets (CAHW)

Chen and Hsiao, who implemented CAHW for the first time to solve differential equations, made significant contributions to the field and achieved notable results [28, 29]. Here, the CAHW is extended to solve (1) with the boundary conditions given in (2). According to this method, the approximation of highest derivative term in (1) is performed by the following Haar series

$$\begin{aligned} y^{(v)}=\sum _{i=1}^{R_{M}}a_iH_i(x), \quad \textrm{where}, ~R_M=2R_m=2^{D_p+1}. \end{aligned}$$
(7)

The coefficients \(a_1,\dots , a_{R_{M}}\) are the unknown series constants. We can now obtain the following expression by integrating Eq. (7) five times with respect to x consecutively.

$$\begin{aligned}{} & {} y^{(iv)} = \sum _{i=1}^{R_{M}} a_i\rho _{i,1}(x) + c_1, \qquad ~\qquad ~\qquad ~\qquad ~\qquad \end{aligned}$$
(8)
$$\begin{aligned}{} & {} y^{\prime \prime \prime } = \sum _{i=1}^{R_{M}} a_i\rho _{i,2}(x) + c_1x + c_2, \qquad ~\qquad ~\qquad ~\qquad ~ \end{aligned}$$
(9)
$$\begin{aligned}{} & {} y^{\prime \prime } = \sum _{i=1}^{R_{M}} a_i\rho _{i,3}(x) + c_1\frac{x^2}{2} + c_2x+c_3,\qquad ~\qquad ~\qquad \end{aligned}$$
(10)
$$\begin{aligned}{} & {} y^{\prime } = \sum _{i=1}^{R_{M}} a_i\rho _{i,4}(x) + c_1\frac{x^3}{6} + c_2\frac{x^2}{2}+c_3x+c_4,\qquad ~\quad ~ \end{aligned}$$
(11)
$$\begin{aligned}{} & {} y = \sum _{i=1}^{R_{M}} a_i\rho _{i,5}(x) + c_1\frac{x^4}{24} + c_2\frac{x^3}{6} + c_3\frac{x^2}{2}+c_4x+c_5,\quad \end{aligned}$$
(12)

where \(c_i\), for \(i=1,\dots ,5,\) is the unknown integration constant. Utilizing (7)–(12) into (1) and then introducing the collocation points \(x_i=\lambda _0+\frac{(\lambda _1-\lambda _0)(i-0.5)}{R_{M}}\), the \(R_{M}\) equations with \(R_{M}+5\) unknowns can be obtained. By utilizing any of the three cases of boundary conditions, the remaining five equations can be obtained. After finding all the integration constants along with \(a_i\)s, these values will be used in (12) to obtain the numerical solution.

Just for better understanding of the proposed technique, a special case of (1), such that \(g(x,y,y',y'',y''',y^{(iv)})=f_1(x)y^2\) having the same integral conditions given in (4) is presented here step by step.

$$\begin{aligned} y^{(v)}+f_1(x)y^2=f(x) \quad \textrm{for} \quad x \in (\lambda _0, \lambda _1), \end{aligned}$$
(13)

where \(f_1\) and f are some functions.

In the first step, the following iterative scheme is designed.

$$\begin{aligned} \begin{aligned}&\left[ y^{(v)}\right] ^{z+1}+\left[ f_1(x)\right] ^{z+1}\left[ y^2\right] ^{z+1}=[f(x)]^{z+1}, \end{aligned} \end{aligned}$$
(14)

where \(z=1,2,\dots , z_m\) is the iteration number with maximum iteration \(z_m\). The values of g(x) and f(x) being the function of independent variable do not change due to z, therefore we replaced \(\left[ f(x)\right] ^{z+1}\) by f(x) and \(g(x)]^{z+1}\) by g(x). In the second step, the following quasi-linearization approach is introduced [60] to linearized the nonlinear term in (14)

$$\begin{aligned} \left[ y^2\right] ^{z+1} \approx 2\left[ y\right] ^z\left[ y\right] ^{z+1}-([y^z])^2. \end{aligned}$$
(15)

Putting (15) in (14), the linearized form of (13) is

$$\begin{aligned}{}[y^{(v)}]^{z+1}+2\left[ y\right] ^zf_1(x)\left[ y\right] ^{z+1}=f(x)+([y^z])^2f_1(x). \end{aligned}$$
(16)

In the third step, Eq. (16) can be converted into Haar functions using (7) through (12), which is

$$\begin{aligned} \begin{aligned}&\sum _{i=1}^{R_{M}} a_i \Big (H_i(x)+2f_1(x)\left[ y\right] ^z(\rho _{i,5}(x))\Big )+2c_1f_1(x)\left[ y\right] ^z \left( \frac{x^{4}}{24}\right) \\&\quad + 2c_2\left[ y\right] ^zf_1(x) \left( \frac{x^{3}}{6}\right) +2c_3\left[ y\right] ^zf_1(x) \left( \frac{x^{2}}{2}\right) \\&\quad + 2c_4\left[ y\right] ^zf_1(x) \big (x\big )+2c_5\left[ y\right] ^zf_1(x) = f(x)+f_1(x)\big ([y^z]\big )^2. \end{aligned} \end{aligned}$$
(17)

In the fourth step, the collocation points are used in (17) to get \(R_{M}\) equation in \(R_{M}+5\) unknowns:

$$\begin{aligned} \begin{aligned} \sum _{i=1}^{R_{M}}&a_i \left( H_i(x_{i})+2f_1(x_{i})\left[ y\right] ^z(\rho _{i,5}(x_{i}))\right) +2c_1f_1(x_{i})\left[ y\right] ^z \left( \frac{x_{i}^{4}}{24}\right) \\&+ 2c_2f_1(x_{i})\left[ y\right] ^z \left( \frac{x_{i}^{3}}{6}\right) +2c_3f_1(x_{i})\left[ y\right] ^z \left( \frac{x_{i}^{2}}{2}\right) \\&+ 2c_4f_1(x_{i})\left[ y\right] ^z \big (x_{i}\big )+2c_5f_1(x_{i})\left[ y\right] ^z = f(x_{i})+f_1(x_{i})\big ([y^z]\big )^2. \end{aligned} \end{aligned}$$
(18)

In the fifth step, the five other equations can be obtained from (4), which are presented one by one as follow:

$$\begin{aligned}&\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _0 \implies \sum _{i=1}^{R_{M}} a_i\beta _0 \Big (\rho _{i,6}(\lambda _1)-\rho _{i,6}(\lambda _0)\Big )+c_1\beta _0\Big (\frac{\lambda _1^5-\lambda _0^5}{120}\Big )\nonumber \\&\quad +c_2\beta _0\Big (\frac{\lambda _1^4-\lambda _0^4}{24}\Big ) +c_3\beta _0\Big (\frac{\lambda _1^3-\lambda _0^3}{6}\Big )+c_4\beta _0\Big (\frac{\lambda _1^2-\lambda _0^2}{2}\Big )+c_5\beta _0\Big (\lambda _1-\lambda _0\Big )=\alpha _{0}, \end{aligned}$$
(19)
$$\begin{aligned}&y(\lambda _0)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{1}\implies \sum _{i=1}^{R_{M}} a_i \Big [\beta _0\big (\rho _{i,6}(\lambda _1)-\rho _{i,6}(\lambda _0)\big )+\rho _{i,5}(\lambda _0)\Big ]\nonumber \\&\quad +c_1\big [\beta _0\big (\frac{\lambda _1^5-\lambda _0^5}{120}\big )+\frac{\lambda _0^4}{24}\big ] +c_2\big [\beta _0\Big (\frac{\lambda _1^4-\lambda _0^4}{24}\Big )+\frac{\lambda _0^3}{6}\big ] +c_3\big [\beta _0\Big (\frac{\lambda _1^3-\lambda _0^3}{6}\Big )+\frac{\lambda _0^2}{2}\big ]\nonumber \\&\quad +c_4\big [\beta _0\Big (\frac{\lambda _1^2-\lambda _0^2}{2}\Big )+\lambda _0\big ]+c_5\big [\beta _0\Big (\lambda _1-\lambda _0\Big )+1\big ]=\alpha _{1}, \end{aligned}$$
(20)
$$\begin{aligned}&y(\lambda _1)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{2}\implies \sum _{i=1}^{R_{M}} a_i \Big [\beta _0\big (\rho _{i,6}(\lambda _1)-\rho _{i,6}(\lambda _0)\big )+\rho _{i,5}(\lambda _1)\Big ]\nonumber \\&\quad +c_1\big [\beta _0\big (\frac{\lambda _1^5-\lambda _0^5}{120}\big )+\frac{\lambda _1^4}{24}\big ] +c_2\big [\beta _0\Big (\frac{\lambda _1^4-\lambda _0^4}{24}\Big )+\frac{\lambda _1^3}{6}\big ] +c_3\big [\beta _0\Big (\frac{\lambda _1^3-\lambda _0^3}{6}\Big )+\frac{\lambda _1^2}{2}\big ]\nonumber \\&\quad +c_4\big [\beta _0\Big (\frac{\lambda _1^2-\lambda _0^2}{2}\Big )+\lambda _1\big ]+c_5\big [\beta _0\Big (\lambda _1-\lambda _0\Big )+1\big ]=\alpha _{2}. \end{aligned}$$
(21)
$$\begin{aligned}&y^{\prime }(\lambda _0)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{3}\implies \sum _{i=1}^{R_{M}} a_i \Big [\beta _0\big (\rho _{i,6}(\lambda _1)-\rho _{i,6}(\lambda _0)\big )+\rho _{i,4}(\lambda _0)\Big ]\nonumber \\&\quad +c_1\big [\beta _0\big (\frac{\lambda _1^5-\lambda _0^5}{120}\big )+\frac{\lambda _0^3}{6}\big ] +c_2\big [\beta _0\Big (\frac{\lambda _1^4-\lambda _0^4}{24}\Big )+\frac{\lambda _0^2}{2}\big ] +c_3\big [\beta _0\Big (\frac{\lambda _1^3-\lambda _0^3}{6}\Big )+\lambda _0\big ]\nonumber \\&\quad +c_4\big [\beta _0\Big (\frac{\lambda _1^2-\lambda _0^2}{2}\Big )+1\big ]+c_5\big [\beta _0\Big (\lambda _1-\lambda _0\Big )\big ]=\alpha _{3}, \end{aligned}$$
(22)
$$\begin{aligned}&y^{\prime }(\lambda _1)+\beta _0\int _{\lambda _0}^{\lambda _1} y(x)\textrm{d}x=\alpha _{4}\implies \sum _{i=1}^{R_{M}} a_i \Big [\beta _0\big (\rho _{i,6}(\lambda _1)-\rho _{i,6}(\lambda _0)\big )+\rho _{i,4}(\lambda _1)\Big ]\nonumber \\&\quad +c_1\big [\beta _0\big (\frac{\lambda _1^5-\lambda _0^5}{120}\big ) +\frac{\lambda _1^3}{6}\big ]+c_2\big [\beta _0\Big (\frac{\lambda _1^4-\lambda _0^4}{24}\Big )+\frac{\lambda _1^2}{2}\big ] +c_3\big [\beta _0\Big (\frac{\lambda _1^3-\lambda _0^3}{6}\Big )+\lambda _1\big ]\nonumber \\&\quad +c_4\big [\beta _0\Big (\frac{\lambda _1^2-\lambda _0^2}{2}\Big )+1\big ]+c_5\big [\beta _0\Big (\lambda _1-\lambda _0\Big )\big ]=\alpha _{4}. \end{aligned}$$
(23)

In the six step, combining the equations of step four and five, the following system will be obtained

$$\begin{aligned} {{\mathcal {J}}}{{\mathcal {U}}}={\mathcal {W}}, \end{aligned}$$
(24)

where \({\mathcal {U}}\) is unknown vectors containing as and cs and \({\mathcal {J}}\) contains the Haar functions and \({\mathcal {W}}\) is the right side known values. In the last step, solve (24) and then putting the calculated values of Haar coefficient and integration constant in Eq. (12) the required solution of the given nonlinear ODEs can be achieved.

4 Convergence analysis

Convergence rate of the proposed CAHW is second order.

Theorem 1

Assume that \(y^{(p)}\), where \(p=i,ii,iii,iv,v,vi\), exist and show bounded in \([\lambda _0,\lambda _1]\). For any \({R_M}\), if \(y_E\) and \(y_{R_{M}}\) are the representations of exact and Haar wavelet based solution, then \( \Vert y_E-y_{R_{M}}\Vert _\infty \le {\mathcal {O}}\big (\frac{1}{R_M}\big )^2 ~\textrm{as}~R_M\rightarrow \infty .\)

Proof

See in [41]. \(\square \)

4.1 Stability

Definition 1

Let us suppose, we have the Eq. (24) (\({{\mathcal {J}}}{{\mathcal {U}}}={\mathcal {W}}\)), representing a sequence of equations obtained from ODEs using the numerical technique. Any numerical technique is said to be stable if \({\mathcal {J}}^{-1}\) is bounded [61]:

$$\begin{aligned} \Vert {\mathcal {J}}^{-1} \Vert \le C_o, \end{aligned}$$

where \(C_o\) is some constant.

To analyze the stability of the CAHW, we have followed the definition 1 and find the least values of eigenvalues of \({\mathcal {J}}\) that reflects the spectral radius magnitudes of \({\mathcal {J}}^{-1}\), which are shown in Figs. 3, 5, 7, 9, 11, 13, 15 and 17. Moreover, with an increase in resolution \(R_M\) as observed in the mentioned figures, the 2-norm of \({\mathcal {J}}^{-1}\) for various cases does not rise rapidly. Therefore, the method satisfies the stability condition presented in Definition 1 and hence, CAHW is stable.

Another way to check the stability is the invertibility of a matrix \({\mathcal {J}}\). The invertibility of a matrix \({\mathcal {J}}\) is crucial in solving differential equations using numerical techniques, especially the (24). It refers to the property of a square matrix, whether an inverse exists or not. In practical terms, the invertibility of \({\mathcal {J}}\) ensures a unique solution to the system of equations. If \({\mathcal {J}}\) is not invertible (i.e., singular), it suggests that the system is either underdetermined or the equations are linearly dependent, resulting in non-unique or inconsistent solutions. To assess this, the determinants of \({\mathcal {J}}\) were calculated in Table 1 for Case 1, Case 2, and Case 3 at different \(D_p\), observing values that are non-zero. Ensuring the invertibility of matrices derived from the discretization of differential equations is vital for the stability and accuracy of numerical methods. Thus, this crucial aspect of maintaining the robustness of the solution using CAHW is processed and also preventing computational errors.

Table 1 The condition number of CAHW method at various values of \(D_p\)

5 Results with discussion

We have implemented the CAHW method to solve linear and nonlinear ODEs. The numerical computations have been carried out using the “MATLAB R2015b” software. The results have been obtained on a Toshiba Laptop equipped with an Intel(R) Celeron(R) B830 CPU running at 1.80 GHz and 2 GB of RAM. In order to observe the correctness and reliability of the obtained results, the \(L_\infty \) error has been utilized which is defined as:

$$\begin{aligned} L_\infty (y)=\max \Vert y_E-y_{R_{m}}\Vert . \end{aligned}$$

To check the applicability of the CAHW, the rate of convergence (\(C_{R}\)) of CAHW is an important factor, which is define as:

$$\begin{aligned} C_{R}=\frac{\log \left( L_\infty \left( \frac{R_m}{2}\right) \right) -{\log (L_\infty (R_m))}}{\log (2)}. \end{aligned}$$

Example 1

Considering the nonhomogeneous fifth-order ODE having constant coefficient, which is given as:

$$\begin{aligned} y^{(v)}-y=-15e^{x}-10xe^{x}. \end{aligned}$$
(25)

The exact solution is provided in [5]:

$$\begin{aligned} y(x)=(x-x^2)e^{x}. \end{aligned}$$
(26)

The following three different forms of boundary conditions are studied with (25) to get the particular solutions.

\({\textbf {Case 1:}}\):

Simple boundary conditions:

$$\begin{aligned}{}[y(0) \quad y(1)\quad y^{\prime }(0) \quad y^{\prime }(1) \quad y^{\prime \prime }(0)] = [ 0 \quad 0 \quad 1 \quad -e\quad 0]. \end{aligned}$$
(27)
\({\textbf {Case 2:}}\):

Two-points boundary conditions:

$$\begin{aligned} \begin{aligned}&y^{\prime }(0)+y(0)=1, \quad y^{\prime \prime }(0)+y(0)=0,\quad y(0)+y(1)=0,\\&y^{\prime }(1)+y(0)=-e,\quad y^{\prime }(0)+y^{\prime \prime }(0)=1. \end{aligned} \end{aligned}$$
\({\textbf {Case 3:}}\):

Two-points integral boundary conditions:

$$\begin{aligned} \begin{aligned}&\int _{0}^{1} y(x){dx}+y(0)=ln(4)-1,\quad y(1)+\int _{0}^{1} y(x){dx}=ln(4)+ln(2)-1,\\&\int _{0}^{1} y(x){dx}+y^{\prime }(0)=ln(4),\quad y^{\prime \prime }(0)+\int _{0}^{1} y(x){dx}=ln(4)-2, \\&\int _{0}^{1} y(x){dx}=ln(4)-1. \end{aligned} \end{aligned}$$

Various methodologies, such as the polynomial sextic spline method(PSSM) [62], sixth-degree B-spline method(SB-SM) [63], quartic spline method(QSM) [64], non-polynomial sextic spline method(NSSM) [6], sextic-spline method(S-SM) [65], non-polynomial spline method(NSM) [66] and cubic B-spline method(CB-SM) [5] have been applied to tackle Test Problem 1. The comparative results of CAHW with other methods are documented in Table 2, where the CAHW accuracy is better than the reported methods even at less amount of grid points n (but for CAHW \(n=R_M=2^{D_p+1}\)). The largest values of absolute errors for various cases are meticulously documented in Table 3. A visual representation of Case 1 of Test Problem 1 is displayed in Fig. 2 using different values of \(D_p\), where comparisons between the exact and numerical solutions are performed as well. Results for Case 2 and Case 3 of this problem are also displayed in Fig. 4 using \(D_p=6\). The stability of CAHW is evident in Fig. 3 for Case 1 and Fig. 5 for Cases 2 and 3. Analyzing the tables and figures, provides insights into the performance of the proposed CAHW, and the proposed method outcomes are promising, showcasing its better effectiveness over the other mentioned methodologies.

Table 2 Comparison of \(L_{\infty }\) error of various methods with CAHW for Case 1 of Test Problem 1
Fig. 2
figure 2

The numerical and exact solution comparison along with absolute errors for Case 1 at low and high resolutions ( Test Problem 1)

Fig. 3
figure 3

The spectral radius and the 2-norm of \({\mathcal {J}}^{-1}\) for Test Problem 1, Case 1

Table 3 The \(L_{\infty }\) error of Test Problem 1 for the given information in Case 2 and Case 3 at various \( D_p \)
Fig. 4
figure 4

Comparison of the numerical and exact solutions along with absolute errors of Test Problem 1 for different Cases at \(D_p=6 \)

Fig. 5
figure 5

The 2-norm and spectral radius of \({\mathcal {J}}^{-1}\) for Case 2 and Case 3 (Test Problem 1)

Example 2

Considering the important non homogeneous fifth-order ODE with variable coefficients

$$\begin{aligned} xy^{(v)}+xy=5(x-1)\sin (x)+5(x-x^{2}-5)\cos (x). \end{aligned}$$
(28)

The exact solution is reported in [67]:

$$\begin{aligned} y=5(1-x)\cos (x). \end{aligned}$$
(29)

The Eq. (28) is coupled with the following three various form of conditions:

\({\textbf {Case 1:}}\):

Simple boundary conditions:

$$\begin{aligned}{}[y(0)\quad y^{\prime }(0) \quad y^{\prime \prime }(0)\quad y^{\prime }(1) \quad y(1)] = [ 5 \quad -5 \quad -5 \quad -5\cos (1)\quad 0]. \end{aligned}$$
(30)
\({\textbf {Case 2:}}\):

Two-points boundary conditions:

$$\begin{aligned} \begin{aligned}&y(0)+y^{\prime }(0)=0,\quad y^{\prime \prime }(0)+y(0)=0,\quad y(1)+y(0)=5, \\&y(0)+y^{\prime }(1)=5-5\cos (1),\quad y^{\prime \prime }(0)+y^{\prime }(0)=-10. \end{aligned} \end{aligned}$$
(31)
\({\textbf {Case 3:}}\):

Two-points integral boundary conditions:

$$\begin{aligned} \begin{aligned}&y(0)+\int _{0}^{1} y(x){dx}=10-5\cos (1),\quad \int _{0}^{1} y(x){dx}=5-5\cos (1), \\&\int _{0}^{1} y(x){dx}+y(1)=5-5\cos (1),\\&y^{\prime }(0)+\int _{0}^{1} y(x){dx}=-5\cos (1),\quad \int _{0}^{1} y(x){dx}+y^{\prime \prime }(0)=-5\cos (1). \end{aligned} \end{aligned}$$
(32)
Table 4 Comparison of different methods with CAHW in terms of \(L_{\infty }\) error of Case 1, Test Problem 2

The performance of the CAHW technique has been assessed through a comparative analysis in Table 4 with the cubic B-spline method(CB-SM) [5] and the quartic spline method(QSM) [67]. The collocation points of CAHW depend on \({R_M}\), where \(R_M\) is the resolution (\(2^{D_p+1}\) number of collocation points (n)). We see that the CAHW results are better than the CB-SM and are comparable with QSM. Here, it should be noted that the n of CAHW is smaller than the other methods. In Fig. 6, the solutions at low and high resolutions are presented, along with the absolute errors for Case 1. The behavior of the \(L_{\infty }\) error against the resolution (\(D_p\)) is shown in Table 5 and the error decreases as \(D_p\) increases, for both Case 1 and Case 2. The solutions with absolute errors are also displayed in Fig. 8 at \(D_p=6\) for both Case 2 and Case 3. The stability of CAHW can be seen in Fig. 7 for Case 1 and Fig. 9 for Case 2 and Case 3. The experimental rate of convergence, CPU time, and \(L_\infty \) errors of Test Problem 1 and Test Problem 2 are presented in Table 6. These results conclude that the current CAHW performs effectively for the numerical solution of different linear problems.

Fig. 6
figure 6

Test Problem 2, the exact and approximate solution for Case 1 at different values of \(D_p\) along with absolute errors

Fig. 7
figure 7

The spectral radius of \({\mathcal {J}}^{-1}\) and the 2-norm of \({\mathcal {J}}^{-1}\) Test Problem 2 (Case 1)

Table 5 The \(L_{\infty }\) error of Test Problem 2 for different Cases
Fig. 8
figure 8

The exact and approximate solution for Test Problem 2 along with absolute errors at resolution \(D_p=6\)

Fig. 9
figure 9

The 2-norm of \({\mathcal {J}}^{-1}\) and spectral radius of \({\mathcal {J}}^{-1}\) for Case 1 and Case 2 of Test Problem 2

Table 6 The \(L_{\infty }\) error and experimental rate of convergence for Case 1

Example 3

Considering the fith-order nonlinear homogeneous differential equation of the following form:

$$\begin{aligned} y^{(v)}-e^{-x}y^{2}=0, \end{aligned}$$
(33)

where the exact solution to (33) is

$$\begin{aligned} y=e^{x}. \end{aligned}$$
(34)

With Eq. (33), we have considered three different types of given information:

\({\textbf {Case 1:}}\):

Simple boundary conditions:

$$\begin{aligned}{}[y(0)\quad y^{\prime }(0) \quad y^{\prime \prime }(0)\quad y^{\prime }(1) \quad y(1)] = [ 1 \quad 1 \quad 1 \quad e\quad e]. \end{aligned}$$
(35)
\({\textbf {Case 2:}}\):

Two-points boundary conditions:

$$\begin{aligned} \begin{aligned}&y^{\prime }(0)+y(0)=2,\quad y(0)+y^{\prime }(0)=2,\quad y(1)+y(0)=1+e, \\ {}&y(0)+y^{\prime }(1)=1+e,\quad y^{\prime \prime }(0)+y^{\prime }(0)=2. \end{aligned} \end{aligned}$$
(36)
\({\textbf {Case 3:}}\):

Two-points integral boundary conditions:

$$\begin{aligned} \begin{aligned}&\int _{0}^{1} y(x){dx}=e-1,\quad y(0)+\int _{0}^{1} y(x){dx}=e, \quad \int _{0}^{1} y(x){dx}+y^{\prime }(0)=e,\\ {}&y^{\prime \prime }(0) +\int _{0}^{1} y(x){dx}=e, \quad \int _{0}^{1} y(x){dx}+y(1)=2e-1. \end{aligned} \end{aligned}$$
(37)

The proposed method has been compared with the Sixth-order Degree Spline Method(S-OSM) [63] and the Variational Iteration Method(VIM) [68] and is given in Table 7 for various values of \(x\in [0,1]\). Various cases of the given information are discussed in Table 8 using different values of \(D_p\), and as the value of \(D_p\) increases, the maximum absolute error decreases. Results for Case 1 are visually presented in Fig. 10, while other cases are illustrated in Fig. 12. The satisfaction of the stability condition can be seen in Figs. 11 and 13.

Table 7 The absolute errors obtained by CAHW are compared with different methods for Case 1 of Test Problem 3
Table 8 The \(L_{\infty }\) error of Test Problem 3 for Case 2 and Case 3
Fig. 10
figure 10

Comparison of the numerical and exact solution of Test Problem 3 for Case 1 using \(D_p=5\) and \(D_p=7\), along with absolute error

Fig. 11
figure 11

Spectral radius and the 2-norm of \({\mathcal {J}}^{-1}\) of Test Problem 3 (Case 1)

Fig. 12
figure 12

Comparison of the numerical and exact solution of Test Problem 3 for Case 2 and Case 3 using \(D_p=6\), along with absolute errors

Fig. 13
figure 13

Spectral radius of \({\mathcal {J}}^{-1}\) and the 2-norm of \({\mathcal {J}}^{-1}\) for Case 1 and Case 2 of Test Problem 3

Table 9 Comparison of absolute errors of Test Problem 4 for Case 1
Fig. 14
figure 14

Comparison of the numerical and exact solution of Test Problem 4 for Case 1 along with absolute errors

Fig. 15
figure 15

Spectral radius of \({\mathcal {J}}^{-1}\) and the 2-norm of \({\mathcal {J}}^{-1}\) for Case 1 of Test Problem 4

Fig. 16
figure 16

Comparison of the numerical and exact solution of Test Problem 4 for Case 2 and Case 3 along with absolute errors at \(D_p=6\)

Fig. 17
figure 17

The 2-norm and spectral radius of \({\mathcal {J}}^{-1}\) for Case 1 and Case 2 of Test Problem 4

Table 10 The \(L_{\infty }\) error of Test Problem 4 for Case 2 and Case 3
Table 11 The exact, numerical and maximum absolute errors for Case 1 at \(D_p=4\)
Table 12 The \(L_{\infty }\) error and experimental rate of convergence for Case 1

Example 4

Consider a nonhomogeneous fifth-order nonlinear differential equation of the following form:

$$\begin{aligned} y^{(v)}+24e^{-5y}=\frac{48}{(1+x)^{2}}. \end{aligned}$$
(38)

The exact solution is

$$\begin{aligned} y(x)=ln(1+x). \end{aligned}$$
(39)

For this nonlinear problem, we have consider the following three different types of information.

\({\textbf {Case 1:}}\):

Simple boundary conditions:

$$\begin{aligned}{}[y(0) \quad y(1)\quad y^{\prime }(1) \quad y^{\prime }(0) \quad y^{\prime \prime }(0)] = [ 0 \quad ln(2) \quad 0.5 \quad 1\quad -1]. \end{aligned}$$
(40)
\({\textbf {Case 2:}}\):

Two-points boundary conditions:

$$\begin{aligned} y(0)+y(1)=ln(2),\quad y(0)+y^{\prime }(0)=1,\quad y^{\prime }(1)+y(0)=0.5, \end{aligned}$$
(41)
$$\begin{aligned} y(0)+y^{\prime \prime }(0)=-1,\quad y^{\prime }(0)+y(1)=ln(2)+1. \end{aligned}$$
\({\textbf {Case 3:}}\):

Two-points integral boundary conditions:

$$\begin{aligned} \begin{aligned}&\int _{0}^{1} y(x){dx}=ln(4)-1,\quad \int _{0}^{1} y(x){dx}+y(0)=ln(4)-1, \\&y^{\prime }(0)+\int _{0}^{1} y(x){dx}=ln(4),\\&\int _{0}^{1} y(x){dx}+y^{\prime \prime }(0)=ln(4)-2, \quad y(1)+\int _{0}^{1} y(x){dx}=ln(4)+ln(2)-1. \end{aligned} \end{aligned}$$
(42)

Following the same quasilinearized scheme given in [69] for (4), we have

$$\begin{aligned}{} & {} (y^{(v)}(x))^{z+1}-120e(-5(y)^{z})(y)^{z+1} =\frac{48}{(1+x)^{2}}-120(y)^{z}e^{-5(y)^{z}}\nonumber \\{} & {} \quad \ -24e^{-5(y)^{z}} \ \textrm{for} \ z=0,1,2,\dots \end{aligned}$$
(43)

Incorporating the Haar wavelet representations defined in (7)–(12) into (43) and then following the same procedure discussed in Sect. 5, the solutions can be obtained. The proposed method has been systematically compared with the Spectral Symmetry Method (SSM) [63] at different values of \(D_p\)s in Table 9. Analyzing the table reveals a decreasing trend in error as the value of \(D_p\) increases, implying that higher collocation points contribute to enhanced accuracy. Specifically, the results for Case 2 and Case 3 at various \(D_p\)s are presented in Table 10. Remarkably, the CAHW consistently outperforms the SSM [63]. Figure 14 illustrates the exact and approximate solutions for Case 1 across different \(D_p\) values, while the other two cases are depicted in Fig. 16. The stability behavior of CAHW is shown in Fig. 15 for Case 1 and Fig. 17 for Case 2 and Case 3. In order to check the accuracy, the absolute errors are calculated from exact and numerical values for Test Problem 3 and Test Problem 4 at \(R_M=32\), as displayed in Table 11. The comprehensive evaluation continues with the maximum absolute error, experimental convergence rate, and CPU time for Test Problem 3 and Test Problem 4 presented in Table 12. These results collectively affirm the efficiency and convergence capability of the proposed method.

6 Conclusion

In this investigation, the CAHW method is employed to solve fifth-order linear and nonlinear differential equations, considering both homogeneous and nonhomogeneous cases with constant and variable coefficients. The advantage of the current CAHW is its applicability to various types of given information called boundary conditions, such as simple, two points, and integral conditions. To make the method easy and efficient in the case of nonlinear differential equations, a method known as quasilinearization is adopted. The results of the proposed CAHW exhibit numerical stability as well. The CAHW stands out for its efficiency, delivering solutions that are both acceptable and accurate. Additionally, the CAHW proves to be a straightforward and precise numerical approach applicable to both linear and nonlinear ODEs. Its versatility, which extends to solving PDEs with various boundary conditions, will make it a more adaptable choice compared to other numerical methods.