1 Introduction

Singular perturbation problems (SPPs), also known as stiff, arise very frequently in various areas of applied science, such as fluid mechanics, heat transfer, materials science, chemical and electrical engineering, superconductor theory, and chemical reactor systems [19]. It is a well-known fact that SPPs exhibit stiff internal or boundary layers as the singular perturbation parameter approaches zero [1049]. As this happens, the stiffness ratio increases and the classical numerical methods become inadequate for solving such problems over standard locally uniform meshes, where nonphysical oscillations emerge in the numerical solution due to the stability restriction on the step-size. An interesting collection of examples of exotic numerical solutions of singular perturbation problems obtained using inadequate numerical discretization schemes can be found in [10]. The construction of special-purpose numerical methods for ensuring convergence regardless of the value of the perturbation parameter was first raised in [11, 12] using fitting factor (stabilization term) and fitting mesh (layer adapted mesh) techniques. It is well known that depending on the behavior of the differential operator coefficients in SPPs, the solutions exhibit a boundary layer, twin boundary-layers, or interior layer [3, 4, 1318]. A variety of numerical and semianalytical numerical methods for solving different classes of SPPs exhibiting a boundary layer, twin boundary-layers, or interior layer can be found in [1849]. In all of these SPP classes, a priori information about the location of the layers is used to construct appropriate numerical methods for SPPs. And consequently, the numerical methods developed for SPPs have different numerical integration algorithms depending on the location of the layers. The purpose of this paper is to present a noniterative absolutely stable difference scheme for solving a general class of SPPs having left, right, internal, or twin boundary layers. The method does not depend on asymptotic expansions and needs no prior information about the location of the layers, and so it is designed to be suitable for the practicing engineers and applied mathematicians who need a practical tool for solving SPPs (see, for example, [15, 38] for asymptotic techniques, designed for a similar purpose). The method depends on replacing the original two-point second-order SPP by a first-order approximate delay differential equation with a variable deviating argument. This delay differential equation is transformed into a three-term difference equation that can be solved using the Thomas algorithm [50]. The stability analysis of the method is discussed showing that the method is absolutely stable under a certain condition on the deviating argument whereas there is no stability restriction on the step-size. An optimal estimate for the deviating argument is obtained to take advantage of the second-order accuracy of the central finite difference method [48, 50] in addition to the absolute stability property [19, 28, 4850]. Several problems having left, right, interior, or twin boundary layers are considered to validate and illustrate the method. To analyze the effect of the deviating argument on the solution accuracy, the maximum absolute solution error is presented in tables and figures for constant and variable deviating argument values. The numerical results confirm that the deviating argument can stabilize the unstable discretized differential equation and that the new approach is effective in solving the considered class of singular perturbation problems.

2 Description of the method

Consider the following linear SPP:

$$ - \varepsilon y''(x) + p(x)y'(x) + q(x)y(x) = r(x), $$
(1)

with BCs

$$ y(a) = A, \qquad y(b) = B, $$

where \(0 < \varepsilon \ll 1\), a, b, A and B are given constants, and \(p(x)\), \(q(x)\) and \(r(x)\in C^{1}(x)\), \(x \in [a,b]\). Moreover, we assume that \(q(x) \ge 0\) for all \(x \in [a,b]\). Under these assumptions, problem (1) has a unique solution with boundary or interior layers [1349]. The interval \([a,b]\) is divided into N subintervals \([x_{i},x_{i + 1}]\), \(i = 0,1,2,\ldots,N - 1\), each of length h, i.e., \(h = (b - a)/N\) and \(x_{i} = a + ih\). For the sake of simplicity, we use \(p_{i} = p(x_{i})\), \(q_{i} = q(x_{i})\), \(r_{i} = r(x_{i})\), \(y_{i - 1} = y(x_{i - 1})\), \(y_{i + 1} = y(x_{i + 1})\), \(y'_{i} = y'(x_{i})\). Dividing Eq. (1) by −ε and letting \(\omega = 1/\varepsilon \) results in

$$ y''_{i} - \omega p_{i}y'_{i} - \omega q_{i}y_{i} = - \omega f_{i}. $$
(2)

Let \(\delta _{i} = \delta (x_{i})\) be a positive variable deviating argument (\(0 < \delta _{i} \ll 1\)). Then by using the Taylor expansion about the point \(x_{i}\), we have

$$ y(x_{i} - \delta _{i}) \cong y_{i} - \delta _{i}y'_{i} + \frac{\delta _{i}^{2}}{2}y''_{i}. $$
(3)

By substituting Eq. (3) into Eq. (2), we have

$$ 2y(x_{i} - \delta _{i}) - 2y_{i} + 2\delta _{i}y'_{i} - \delta _{i}^{2} \omega p_{i}y'_{i} - \delta _{i}^{2}\omega q_{i}y_{i} \cong - \delta _{i}^{2}\omega f_{i}. $$
(4)

Now, applying standard forward and centered finite difference formulas for \(y'_{i}\) in Eq. (4) results in

$$ 2y(x_{i} - \delta _{i}) - 2y_{i} + 2\delta _{i} \biggl\{ \frac{y_{i + 1} - y_{i}}{h} \biggr\} - \delta _{i}^{2} \omega p_{i} \biggl\{ \frac{y_{i + 1} - y_{i - 1}}{2h} \biggr\} - \delta _{i}^{2}\omega q_{i}y_{i} \cong - \delta _{i}^{2}\omega f_{i}. $$
(5)

Again, using the Taylor expansion and the standard backward finite difference, we obtain:

$$ y(x_{i} - \delta _{i}) \cong y_{i} - \delta _{i}\frac{y_{i} - y_{i - 1}}{h}. $$
(6)

By substituting Eq. (6) into Eq. (5), we get the following difference equation:

$$ E_{i}y_{i - 1} + F_{i}y_{i} + G_{i}y_{i + 1} \cong H_{i},\quad i = 1,2,\ldots,N - 1, $$
(7)

where

$$\begin{aligned}& E_{i} = \frac{2}{h\delta _{i}} + \frac{\omega p_{i}}{2h}, \end{aligned}$$
(8)
$$\begin{aligned}& F_{i} = - \frac{4}{h\delta _{i}} - \omega q_{i}, \end{aligned}$$
(9)
$$\begin{aligned}& G_{i} = \frac{2}{h\delta _{i}} - \frac{\omega p_{i}}{2h}, \end{aligned}$$
(10)
$$\begin{aligned}& H_{i} = - \omega f_{i}. \end{aligned}$$
(11)

The difference Eq. (7) and the two BCs in (1) results in a tridiagonal system that can be easily solved using the Thomas algorithm to obtain the unknowns \(y_{1}\) to \(y_{N - 1}\).

2.1 Thomas algorithm

A brief description of the Thomas algorithm [50], is presented as follows.

In this algorithm, the solution of the difference Eq. (7) can be written as

$$ y_{i} = W_{i}y_{i + 1} + T_{i},\quad i = 1,2,\ldots,N - 1. $$
(12)

where \(W_{i}\) and \(T_{i}\) are to be determined. From Eq. (12) we have

$$ y_{i - 1} = W_{i - 1}y_{i} + T_{i - 1}, $$
(13)

and substituting (12) and (13) into (7), we get

$$ y_{i} = - \frac{G_{i}}{F_{i} + E_{i}W_{i - 1}}y_{i + 1} + \frac{H_{i} - E_{i}T_{i - 1}}{F_{i} + E_{i}W_{i - 1}}. $$
(14)

Comparing (14) and (12) results in

$$\begin{aligned}& W_{i} = - \frac{G_{i}}{F_{i} + E_{i}W_{i - 1}},\quad i = 1,2,\ldots,N - 1, \end{aligned}$$
(15)
$$\begin{aligned}& T_{i} = \frac{H_{i} - E_{i}T_{i - 1}}{F_{i} + E_{i}W_{i - 1}},\quad i = 1,2,\ldots,N - 1. \end{aligned}$$
(16)

Starting with initial conditions \(W_{0} = 0\) and \(T_{0} = y_{0} = A\), the values of \(W_{i}\) and \(T_{i}\) for \(i = 1,2,\ldots,N - 1\) are computed in a forward process, from Eqs. (15)–(16), and then \(y_{i}\) is computed in a backward process, from Eq. (12), using the BC \(y_{N} = B\).

3 Uniqueness and stability analysis

In this section, the uniqueness and stability condition of the proposed algorithm for the difference Eq. (7) is analyzed.

Theorem 1

The numerical scheme\(E_{i}y_{i - 1} + F_{i}y_{i} + G_{i}y_{i + 1} \cong H_{i}\)defined in (7)(11) results in a unique stable solution provided

$$ \delta _{i} \le \frac{4}{\omega \vert p_{i} \vert }. $$
(17)

Proof

The existence of a unique solution to the tridiagonal system results from establishing that the tridiagonal coefficient matrix of the system is diagonally dominant. It is clear that \(E_{i}\) in (8) and \(G_{i}\) in (10) are nonnegative when \(\frac{2}{h\delta _{i}} + \frac{\omega p_{i}}{2h} \ge 0\) and \(\frac{2}{h\delta _{i}} - \frac{\omega p_{i}}{2h} \ge 0\), respectively. These inequalities are verified if the condition \(\delta _{i} \le \frac{4}{\omega \vert p_{i} \vert }\) is verified. Following this condition, \(F_{i}\) is negative and verifies the inequality \(\vert F_{i} \vert \ge \vert G_{i} \vert + \vert E_{i} \vert = \frac{4}{h\delta _{i}}\). Thus, under condition (17), the tridiagonal coefficient matrix is diagonally dominant, and the numerical scheme has a unique solution.

For stability analysis, suppose that a small numerical error \(\tau _{i - 1}\) was introduced in the calculation of \(W_{i - 1}\) so that it yields an approximate value \(\tilde{W}_{i - 1}\) such that

$$ \tilde{W}_{i - 1} = W_{i - 1} + \tau _{i - 1}. $$
(18)

Then, from (18) and (15), we have

$$\begin{aligned}& \begin{aligned}[b] \tau _{i} &= \biggl( - \frac{G_{i}}{F_{i} + E_{i} ( W_{i - 1} + \tau _{i - 1} )} \biggr) - \biggl( - \frac{G_{i}}{F_{i} + E_{i}W_{i - 1}} \biggr) \\ &= \biggl( - \frac{G_{i}E_{i}\tau _{i - 1}}{ ( F_{i} + E_{i} ( W_{i - 1} + \tau _{i - 1} ) ) ( F_{i} + E_{i}W_{i - 1} )} \biggr) \simeq \biggl( \frac{W_{i}^{2}E_{i}}{G_{i}} \biggr)\tau _{i - 1}, \end{aligned} \end{aligned}$$
(19)
$$\begin{aligned}& \vert \tau _{i} \vert \simeq \bigl\vert W_{i}^{2} \bigr\vert \biggl\vert \frac{E_{i}}{G_{i}} \biggr\vert \vert \tau _{i - 1} \vert = \biggl\vert \frac{G_{i}E_{i}}{ ( F_{i} + E_{i}W_{i - 1} )^{2}} \biggr\vert \vert \tau _{i - 1} \vert . \end{aligned}$$
(20)

Thus, the numerical scheme defined by (7)–(11) results in a unique stable solution under condition (17). □

Now, if we chose \(\delta _{i} = \frac{4}{\omega \vert p_{i} \vert }\), then for the left-end boundary layers, \(p_{i} < 0\), we have \(E_{i} = 0\), and the present scheme is reduced to a stable forward integration scheme. Also, on the other hand, for the right-end boundary layers, \(p_{i} > 0\), we have \(G_{i} = 0\), and the present scheme is reduced to a stable backward integration scheme. Moreover, in the above two cases, the propagation error in (20) has vanished.

Moreover, at \(p_{i} = 0\), for twin-boundary layers or internal layers, or at \(h \le \frac{2}{\omega \Vert p_{i} \Vert _{\infty }}\), we set \(\delta _{i} = 2h \le \frac{4}{\omega \vert p_{i} \vert }\), and the present scheme is reduced to the standard central finite difference scheme (CFD) in [48, 50]. Thus, to take advantage of the second-order accuracy of the standard central finite difference scheme in addition to the absolute stability property, \(\delta _{i}\) can be selected according to

$$ \delta _{i} = \delta _{\mathrm{op}} = \min \biggl\{ \frac{4}{\omega \vert p_{i} \vert }, 2h \biggr\} . $$
(21)

The stability in CFD is controlled by the step-size restriction whereas the present scheme is absolutely stable without any restrictions on the step-size.

These details are combined in the following algorithm:

3.1 Algorithm steps

Step I: compute

  • \(h = (b - a)/(N)\),

  • \(x = (a:h:b)\)

Step II: set \(xx = 0\), \(\mathrm{index} = 0\), \(w = 1/\varepsilon \)

  • Set \(W = [0,0,\ldots,0]\), \(T[0,0,\ldots,0]\) where the vector length is N

  • Set \(T(1) = A\), \(W(1) = 0\)

Step II: while \(xx \le b - h\), compute

  1. (i)

    \(xx = x(\mathrm{index})\);

  2. (ii)

    \(p = p(xx)\); \(q = q(xx)\); \(r = r(xx)\)

  3. (iii)

    \(\delta = \min (4/(w*\mathrm{abs}(p + 1E - 16)), 2h)\)

  4. (iv)

    \(E(\mathrm{index}) = 2/h + \delta wp/(2h)\)

  5. (v)

    \(G(\mathrm{index}) = 2/h - \delta wp/(2h)\)

  6. (vi)

    \(F(\mathrm{index}) = 4/h - \delta wq\)

  7. (vii)

    \(H(\mathrm{index}) = - \delta wf\)

  8. (viii)

    \(\mathrm{index} = \mathrm{index} + 1\)

Step III: Do Steps (i) and (ii) for \(\mathrm{index}2 = 1,2,3,\ldots,N - 1\)

  1. (i)

    Compute \(W(\mathrm{ind}) = - \frac{G(\mathrm{index}2)}{G(\mathrm{index}2) + E(\mathrm{index}2)*W(\mathrm{index}2 - 1)}\)

  2. (ii)

    Compute \(T(\mathrm{ind}) = \frac{F(\mathrm{index}2)*T(\mathrm{index}2 - 1) - H(\mathrm{index}2)}{G(\mathrm{index}2) + E(\mathrm{index}2)*W(\mathrm{index}2 - 1)}\)

Step IV: Compute the solution

  1. (i)

    set \(\mathrm{Sol} = [0,0,\ldots,0]\), where the vector length is \(N - 2\)

  2. (ii)

    Set \(\mathrm{Sol}(N) = B\)

  3. (iii)

    Compute \(\mathrm{Sol}(\mathrm{index}2 - 1) = W(\mathrm{index}2 - 1)*\mathrm{Sol}(\mathrm{index}2) + T(\mathrm{index}2 - 1)\) where \(\mathrm{index}2 = N,N - 1,\ldots,3,2,1\)

This algorithm is easily adaptable in any mathematical environment. We present the Matlab code in Appendix A.

4 Numerical results

To demonstrate the applicability of the method, we consider in the following several problems having left, right, interior, or twin boundary layers. These problems have been discussed in the literature and their approximate solutions are available for comparison.

4.1 Left-end boundary-layer problems

Example 1

Consider the following SPBVP [2, 7, 1315, 38]

$$ \varepsilon y''(x)+y'(x)-y(x)=0, \quad x \in[0,1], $$
(22)

with BCs \(y(0)=1\) and \(y(1)=1\). The exact solution is given by

$$ y(x)=\frac{(e^{m_{2}}-1)e^{m_{1} x}+(1-e^{m_{1}})e^{m_{2} x}}{e^{m_{2}}-e^{m_{1}}}, $$

where m 1 =(1+ 1 + 4 ε )/(2ε) and m 2 =(1 1 + 4 ε )/(2ε).

The solution errors are listed in Table 1 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The solutions for \(\varepsilon=10^{-4}\) using the present absolutely stable central difference (ASCD) and the standard CFD schemes are presented in Fig. 1.

Figure 1
figure 1

The solution of Example 1 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 1 The solution errors of Example 1 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

Example 2

Consider the following SPBVP [7, 1315, 38]

$$ \varepsilon y''(x) + y'(x) = 1 + 2x,\quad x \in [0,1], $$
(23)

with BCs \(y (0) = 0\) and \(y (1) = 1\). The exact solution is given by

$$ y(x)=x(x+1-2\varepsilon)+\frac{(2\varepsilon-1)(1-e^{-x/\varepsilon})}{1-e^{-1/\varepsilon}}. $$

The solution errors are presented in Table 2 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The solutions for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes are depicted in Fig. 2.

Figure 2
figure 2

The solution of Example 2 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 2 The solution errors of Example 2 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

Example 3

Consider the following SPBVP [47]

$$ - \varepsilon y''(x) - \frac{1}{1 + x}y'(x) = 0,\quad x \in [0,1], $$
(24)

with BCs \(y (0) = 0\) and \(y (1) = 1\). The exact solution is given by

$$ y(x)=\biggl[\frac{(1+x)^{(1-1/\varepsilon)}-1}{(2)^{(1-1/\varepsilon)}-1}\biggr]. $$

The solution errors are presented in Table 3 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The solutions for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes are present in Fig. 3.

Figure 3
figure 3

The solution of Example 3 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 3 The solution errors of Example 3 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

The results in Tables 1, 2 and 3 show that at \(\delta_{i}=4/\omega|p_{i}|\) or \(\delta_{i}=\delta_{\mathrm{op}}=4/\omega|p_{i}|\), there is no propagation error with the Thomas algorithm (20). Also, at \(\varepsilon=10^{-3}\) the ASCD is reduced to the CFD scheme, where \(\delta_{\mathrm{op}}=2h\), and the results are identical. Although the ASCD stability is verified at \(\delta _{i} = 4/\omega \vert p_{i} \vert \), selecting \(\delta _{i} = \delta _{\mathrm{op}}\) takes advantage of the second-order accuracy of the CFD in addition to the absolute stability property depending on the step-size value. The solution obtained at \(\varepsilon=10^{-4}\) using the ASCD is more accurate than that obtained by CFD due to the absolute stability property of the ASCD, while the stability restriction of CFD results in nonphysical oscillations in the numerical solution as illustrated in Figs. 1, 2 and 3. Figure 4 shows the solution error of Example 3 at \(\varepsilon=10^{-4}\) using different values of the deviating argument \(\delta_{i}=k/\omega|p_{i}|\), \(k = 4, 3, 2, 1\). The results in Fig. 4 reveal that a more accurate solution is obtained at \(\delta_{i}=4/\omega|p_{i}|\). Moreover, Fig. 5 depicts the solution error of Example 3 at \(\varepsilon=10^{-4}\) using constant and variable deviating arguments \(\delta_{i}=4/\omega|p_{i}|_{\infty}\), \(\delta_{i}=4/\omega|p_{i}|\), respectively. Figure 5 reveals that a more accurate solution is obtained using a variable deviating argument \(\delta_{i}\).

Figure 4
figure 4

The solution errors of Example 3 for \(\varepsilon=10^{-4}\) and different values of \(\delta_{i}\)

Figure 5
figure 5

The solution errors of Example 3 for \(\varepsilon=10^{-4}\) using constant and variable deviating argument \(\delta_{i}\)

4.2 Right-end boundary-layer problems

Example 4

Consider the following SPBVP [2, 13]

$$ \varepsilon y''(x) - y'(x) = 0,\quad x \in [0,1], $$
(25)

with BCs \(y (0) = 1\) and \(y (1) = 0 \). The exact solution is given by

$$ y(x) = \frac{e^{(x - 1)/\varepsilon } - 1}{e^{ - 1/\varepsilon } - 1}. $$

The solution errors are reported in Table 4 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The numerical solution using the ASCD and CFD schemes for \(\varepsilon=10^{-4}\) are presented in Fig. 6.

Figure 6
figure 6

The solution of Example 4 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 4 The solution errors of Example 4 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

Example 5

Consider the following SPBVP

$$ \varepsilon y ''(x ) - y '(x ) -(1+ \varepsilon)y(x)=0, $$
(26)

with BCs \(y (0) =1+ \exp(-(1+\varepsilon ) /\varepsilon )\) and \(y (1) =1+ \exp(-1) \). The exact solution is given by

$$ y(x)=e^{(1+\varepsilon)(x-1)/\varepsilon}+e^{-x}. $$

The solution errors are presented in Table 5 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The numerical solution using the ASCD and CFD schemes for \(\varepsilon=10^{-4}\) are given in Fig. 7.

Figure 7
figure 7

The solution of Example 5 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 5 Solution errors of Example 5 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

The results in Tables 4 and 5 and Figs. 6 and 7 show that the ASCD can handle problems with right-end boundary layers effectively as well as those with left-end boundary layers.

4.3 Internal or twin-boundary-layer problems

Example 6

Consider the following SPBVP [49] given by

$$ \varepsilon y''(x)+xy'(x)=0,\quad x \in[-1,1], $$
(27)

with BCs \(y (-1) = 0\) and \(y (1) = 2\). The exact solution is given by

y(x)=1+ e r f ( x / 2 x ) e r f ( 1 / 2 x ) .

The solution errors are listed in Table 6 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The numerical solutions using the ASCD and CFD schemes for \(\varepsilon=10^{-4}\) are presented in Fig. 8.

Figure 8
figure 8

The solution of Example 6 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 6 The solution errors of Example 6 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

Example 7

Consider the following SPBVP with twin boundary layer [40, 42]

$$ \varepsilon y''(x)-2(2x-1)y'(x)-4y(x)=0, \quad x\in[0,1], $$
(28)

with BCs \(y (0) =1\) and \(y (1) =1\). The exact solution is given by

$$ y(x) = e^{2x(x - 1)/\varepsilon }. $$

The solution errors are listed in Table 7 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\). The numerical solutions using the ASCD and CFD methods for \(\varepsilon=10^{-4}\) are presented in Fig. 9.

Figure 9
figure 9

The solution of Example 7 for \(\varepsilon=10^{-4}\) using the ASCD and CFD schemes

Table 7 The solution errors of Example 7 for \(\varepsilon=10^{-3}\) and \(\varepsilon=10^{-4}\) at \(h=0.001\)

The results in Table 6 and Fig. 8 show that the ASCD and CFD lead to stable and accurate results for the internal layer problem (26). The reason for absenting the stability restriction of CFD in solving internal layer problems is that the internal layer occurs at a turning point \(x = x_{\mathrm{in}}\) at which \(p(x_{\mathrm{in}}) = 0\). The results in Table 7 show that the solution obtained for the twin boundary layer problem (28) at \(\varepsilon=10^{-4}\) using the ASCD is more accurate than those of the CFD and thus is due to the absolute stability property of the ASCD, while for the CFD the stability restriction results in nonphysical oscillations in the numerical solution as shown in Fig. 9.

Figure 10 depicts the solution error of Example 7 for \(\varepsilon=10^{-4}\) using different values of the deviating argument \(\delta_{i}=k/\omega|p_{i}|\), \(k = 4, 3, 2, 1\). The results in Fig. 10 show that a more accurate solution is obtained at \(\delta_{i}=4/\omega|p_{i}|\). Figure 11 illustrates the solution error of Example 7 for \(\varepsilon=10^{-4}\) when adopting constant and variable deviating arguments \(\delta_{i}=4/\omega|p_{i}|_{\infty}\), \(\delta_{i}=4/\omega|p_{i}|\), respectively. Figure 11 reveals that a more accurate solution is obtained using a variable deviating argument.

Figure 10
figure 10

The solution errors of Example 7 at \(\varepsilon=10^{-4}\) and different values of \(\delta_{i}\)

Figure 11
figure 11

Solution errors of Example 7 at \(\varepsilon=10^{-4}\) using constant and variable deviating argument \(\delta_{i}\)

5 Conclusions

This paper presented an absolutely stable noniterative central difference scheme for solving a general class of SPPs having left, right, internal, or twin boundary layers. The original two-point second-order SPPs is approximated by a first-order delay differential equation with a variable deviating argument. This delay differential equation was transformed into a three-term difference equation that was solved using the Thomas algorithm. The stability analysis of the method is discussed showing that the method is absolutely stable under a certain condition on the deviating argument without stability restriction on the step-size. An optimal estimation for the deviating argument is obtained taking advantage of the second-order accuracy of the central finite difference method in addition to the absolute stability property. Several examples having left, right, interior, or twin boundary layers were considered to illustrate the method. To analyze the effect of the deviating argument on the solution accuracy, the maximum absolute error is reported in several tables and figures for constant and variable deviating argument values. The results confirm that the variable deviating argument results in more accurate results than the constant one. Moreover, the results reveal that the deviating argument can stabilize the unstable discretized differential equation and that the present method is effective in solving the considered class of SPPs.