1 Introduction

The initial value problems (IVPs) for nonlinear singular equations of Lane-Emdem type

$$ \frac{d^2u}{dx^2}+\frac{\lambda }{x}\frac{du}{dx}= -f(x,u), \quad x \in (0,a], \quad \lambda >0 $$
$$ u(0)=A, \quad \frac{du(0)}{dx}=0. $$

are encountered in many scientific and engineering fields [3, 12]. Several approximate analytical methods for solving such singular nonlinear problems have been proposed: Adomian’s decomposition method [25], perturbation technique based on an artificial parameter [2], linearization technique [18], homotopy perturbation method [17], integral transform method [13] etc. Mainly, these methods can be used for finding solutions only in a small vicinity of the point \(x=0\). Moreover, in the general case, there are no methods that would allow us to find an approximate analytical solution of singular IVPs for systems of nonlinear ODEs.

Standard numerical methods for solving this type of problem often also work badly since the equation has a singularity at \(x=0\). In [9, 11] it was established that the application of Runge-Kutta and linear multistep methods to singular IVPs leads to order reduction of these methods. This fact does not allow for the correct using any of the known algorithms for practical error estimation and automatic selection of step size. Moreover, in [11] it was shown that in a general case, the order of arbitrary s-stage explicit Runge-Kutta methods is at most two.

It should be noted that for solving singular IVPs collocation methods (see, e.g., [1, 10, 14]) may be used. Typically, collocation methods are applied to singular boundary value problems (BVPs), which are more difficult for numerical solving than IVPs. However, it is well known (see [6, p. 212], Theorem 7.7) that for IVPs the collocation methods are equivalent to implicit Runge-Kutta methods. Last time also hybrid block methods were developed [20,21,22,23], which allow solving the IVPs for the Lane-Emden problem with a variable step size. However, the above-mentioned methods are implicit and require big computational costs for solving systems of nonlinear algebraic equations by Newton’s iterative method, especially in the case of systems of ODEs of large dimensions. A nonlinear explicit one-step numerical schemes for IVPs with other types singularities are considered in [19]. We refer readers to [21, 22] and references therein to introduce present trends in solving the considered problem in more detail.

In this paper, we consider the next singular IVP

$$\begin{aligned}&\frac{1}{x^{\lambda }}\frac{d}{dx}\left[ x^{\lambda }K(x) \frac{du}{dx}\right] = -f(x,u), \quad x \in (0,a], \end{aligned}$$
(1)
$$\begin{aligned}&f(x,u):[0,a] \times \mathbb {R}^{s} \rightarrow \mathbb {R}^{s},\quad u:[0,a]\rightarrow \mathbb {R}^s, \quad K(x)\in \mathbb {R}^{s\times s},\nonumber \\&u(0)=A, \quad \frac{du(0)}{dx}=0, \end{aligned}$$
(2)

where \(\mathbb {R}^s\) is the space of s-measurable vectors with a scalar product (uv) and norm \(\Vert u\Vert =(u,u)^{1/2},\;\lambda>0,\;c_1\Vert u\Vert \le (K(x)u,u) \; \forall x\in [0,a],\; u\in \mathbb {R}^s,\; c_1>0\). Note that the last condition implies that there exists an inverse matrix \(K^{-1}(x)\) and \(\Vert K^{-1}(x)\Vert \le 1/c_1.\) It is known (see [24]) that the solutions u(x) and \(K(x)\frac{du}{dx}\) of the problem (1), (2) are continuous if \(K(x)=\{k_{ij}(x)\}_{i,j=1}^s, f(x,u)=\{f_i(x,u)\}_{i=1}^s\) satisfy the conditions

$$ k_{ij}(x)\in C^1[0,a],\quad f_i(x,u)\in C([0,a],\mathbb {R}^{s}), $$
$$ {\Vert f(x,U_1)-f(x,U_2)\Vert \le L\Vert U_1-U_2\Vert , \quad U_1,U_2\in \mathbb {R}^s.} $$

The problem (1), (2) arises when axial or central symmetry is used for reducing systems of partial differential equations to ordinary ones and it includes at least all systems of the Lane-Embden type equations. The interest in this problem is connected also with the fact that three-point difference schemes of high-order accuracy (see [5, 15]) for solving singular BVPs require the solution of the associated singular IVPs.

In our article, we present an approach that allows us to construct explicit fourth-order Runge-Kutta methods that do not lose their order in the solution of the singular problem (1)–(2). For the constructed methods, we developed an effective numerical algorithm for solving the problem (1)–(2) with a given tolerance. We also compared the efficiency of our methods with the implicit Runge-Kutta methods of collocation type, namely with one of the best codes RADAU5 (see [7]). The performed numerical experiments demonstrate a significant advantage of our approach over the implicit Runge-Kutta methods.

The organization of this paper is as follows: In Sect. 2, using the substitution \(x=e^t\) we reduce the problem (1), (2) to an IVP on an infinite interval \((-\infty ,\ln a]\). For finding the numerical solution of this IVP near the singularity point, i.e., at the node \(t_0\) of some finite irregular grid \(\{t_n\in (-\infty ,\ln a],\) \(n=0,1,...,N, t_{N}=\ln a\}\) similarly to [16] we construct the Taylor series method and 3-stage Runge-Kutta type method of order 4. For finding the numerical solution at other points of nodes of the grid we apply the standard explicit four-order Runge-Kutta methods. In Sect. 3, we prove this approach allows for guaranteeing the fourth order of accuracy on the entire interval. In Sect. 4, the algorithm for error estimation and step size selection for numerical solving IVPs near the singular point with a given tolerance which is based on Richardson extrapolation is described. The effectiveness of the presented approach is demonstrated by numerical examples in Sect. 5.

2 Construction of Runge-Kutta type methods near the singular point

The problem (1), (2) can be rewritten in the following form

$$\begin{aligned}&\frac{du(x)}{dx}= K^{-1}(x)w(x),\end{aligned}$$
(3)
$$\begin{aligned}&\frac{dw(x)}{dx}= -f(x,u)-\frac{\lambda }{x}w(x) ,\quad 0<x\le a,\end{aligned}$$
(4)
$$\begin{aligned}&u(0)=A,\quad w(0) =0. \end{aligned}$$
(5)

We assume that the solution of the problem (3)–(5) exists, is unique and has the necessary properties of smooth.

Using the substitution \(x=e^t\) we reduce the problem (3)–(5) to the following one

$$\begin{aligned}&\frac{dU(t)}{dt}= e^t\tilde{K}^{-1}(t)W(t),\end{aligned}$$
(6)
$$\begin{aligned}&\frac{dW(t)}{dt}=-e^t\tilde{f}(t,U)-\lambda W(t) ,\quad -\infty <t\le \ln a,\end{aligned}$$
(7)
$$\begin{aligned}&\underset{t\rightarrow -\infty }{\lim }\,U(t)=A,\quad \underset{t\rightarrow -\infty }{\lim }\,W(t) =0, \end{aligned}$$
(8)

where \(U(t)=u(e^t),W(t)=w(e^t),\tilde{K}(t)=K(e^t),\tilde{f}(t,U)=f(e^t,U).\)

On the semi-infinite interval \(( {-\infty ,b}],\,b\le \ln a\) we choose the finite irregular grid \(\hat{\bar{{\omega } }}_{h} = \{ t_{n} \in ( {-\infty ,b}], n =0,1,...,N, t_{N} = b\}\) with the step sizes \(h_{n}=t_{n} -t_{n-1}>0,n=1,2,...,N\). Further on, we will use such a grid near the singularity point.

We postulate the next inequalities at the first node of the grid \(\hat{\bar{{\omega } }}_{h}\)

$$\begin{aligned} b-\frac{1}{h_{\min }}\le t_{0}\le b-\frac{1}{h_{\max }}, \end{aligned}$$
(9)

where \(h_{\max }= \underset{1\le n \le N}{\max }\, h_n, \; h_{\min }= \underset{1\le n \le N}{\min }\, h_n\). The inequalities

$$b-h_{\max }N\le t_{0}=b- h_{1}-h_{2}-...-h_{N}\le b -h_{\min }N $$

and (9) imply the following ones

$$ h_{\min }\le \frac{1}{b-t_{0}}\le \frac{1}{Nh_{\min }},\quad \frac{1}{Nh_{\max }}\le \frac{1}{b-t_{0}}\le h_{\max }. $$

Due to the conditions \(C_{1}\le {h_{\max }}/{h_{\min }}\le C_{2}\), which are satisfied for arbitrary finite grids, we further obtain the inequalities

$$ \frac{h_{\max }}{C_2}\le h_{\min }\le \frac{1}{\sqrt{N}},\quad C_2h_{\min }\ge h_{\max } \ge \frac{1}{\sqrt{N}}, $$

where \(C_1\) and \(C_2\) are real constants. It follows that

$$\begin{aligned} \begin{aligned} h_{\max } \le \frac{C_{2}}{\sqrt{N}},\quad \quad h_{\min }\ge \frac{1}{C_{2}\sqrt{N}},\quad \quad b-C_2\sqrt{N}\le t_0\le b-\frac{\sqrt{N}}{C_2}. \end{aligned} \end{aligned}$$
(10)

Note that from (10) we have \(h_{\max }\rightarrow 0, t_{0}\rightarrow -\infty \) as \(N\rightarrow \infty \). As an example, the next equidistant grid

$$\begin{aligned} \bar{{\omega }}_{h} = \{ t_{n}=b -\sqrt{N}+nh,n = 0,1,...,N, h = \frac{1}{\sqrt{N}}\}. \end{aligned}$$
(11)

satisfies the conditions (10) with \(C_1=C_2=1\).

Based on (3)–(5), the following statement can be proved.

Lemma 1

Suppose that \(f(x,u)=\{f_i(x,u)\}_{i=1}^s:f_i(x,u)\in C^{(m)}\left( [0,x_0]\times \Omega _{\lambda } ([0,\right. \) \(\left. x_0],r_{\lambda })\right) ,\) \(K(x)=\{k_{ij}(x)\}_{i,j=1}^{s}:k_{ij}(x)\in C^{(m-1)}[0,x_0]\). Then following relations are satisfied

$$\begin{aligned} w(x_0)=&-\frac{h_0}{1+\lambda }f(0,A)-\sum _{i=2}^{m} \frac{h_0^{i}}{(i-1)!(i+\lambda )} {\left. \frac{d^{i-1}f(x,u)}{dx^{i-1}}\right| _{x=0}}\nonumber \\&+\frac{h_0^{m+1}}{(m+1)!} \frac{d^{m+1}w(\xi _1)}{dx^{m+1}},\quad h_0=x_0=e^{t_0},\quad \xi _1=\theta _1 h_0, \quad |\theta _1|< 1, \end{aligned}$$
(12)
$$\begin{aligned} u(x_0)=&A-\frac{h_0^2}{2(1+\lambda )}K^{-1}(0)f(0,A)\nonumber \\&- \sum _{i=3}^{m} \frac{h_0^{i}}{i!} \left[ \sum _{j=0}^{i-2} \left( {\begin{array}{c}i-1\\ j\end{array}}\right) \left. \frac{i-j-1}{i-j-1+\lambda }\left. \frac{d^{j}}{dx^{j}} K^{-1}(x)\right| _{x=0} {\frac{d^{i-j-2}f(x,u)}{dx^{i-j-2}}}\right| _{x=0}\right] \nonumber \\&+\frac{h_0^{m+1}}{(m+1)!} \frac{d^{m+1}u(\xi _2)}{dx^{m+1}},\quad \xi _2=\theta _2 h_0, \quad |\theta _2|< 1, \end{aligned}$$
(13)

where \(\displaystyle \left( {\begin{array}{c}i\\ j\end{array}}\right) \) are binomial coefficients,

$$ {\begin{matrix} &{} \Omega _{\lambda } ([0,x_0],r_{\lambda })= \biggl \{ u(x)=\{u_i(x)\}_{i=1}^s: \ u_i(x),\sum _{i=1}^{s}k_{ij}(x) \frac{du_i}{dx} \in C[0,x_0], \biggr .\\ &{}\biggl .{ \left\| u-{u}_{0} \right\| }_{1,\infty , [0,x_0]}^*\le r_{\lambda }\biggr \}, \quad {\Vert u \Vert }_{0,\infty ,[0,x_0]}= \max \limits _{x \in [0,x_0]} \Vert u(x)\Vert ,\\ &{}{\Vert u\Vert }_{1,\infty ,[0,x_0]}^*= \max \left\{ {\Vert u \Vert }_{0,\infty ,[0,x_0]}, \ {\left\| K(x)\frac{du}{dx}\right\| }_{0,\infty ,[0,x_0]} \right\} ,\\ &{}{r_{\lambda } \text{ is } \text{ a } \text{ real } \text{ positive } \text{ number }.} \end{matrix}} $$

Notice that the formulas (12), (13) hold only near the singularity point \(x=0\). The proof of the lemma is based on the fact that in Taylor’s formula, the limits as \(x\rightarrow 0\) of all singular at a point \(x=0\) derivatives of functions w(x) can be calculated. For more details see please [16].

For the problem (3)–(5), we construct 3-stage explicit Runge-Kutta type methods which have the fourth order near the singularity point \(x=0\) the following form

$$ {\begin{matrix} &{}g_1=-{f(0,A)},\\ &{}g_2=-f\left( c_2h_0,A+h_0^2 a_{21}K^{-1}(0)g_1\right) ,\\ &{}g_3=-f\left( c_3h_0,A+h_0^2 \left[ \left( a_{31}K^{-1}(0)+ r_{31}K^{-1}(c_2h_0)\right) g_1+ a_{32}K^{-1}(0)g_2 \right] \right) , \end{matrix}} $$
$$\begin{aligned} {\begin{matrix} &{} y_0=A+h_0^2\left[ \left( d_{1}K^{-1}(0) + p_{1}K^{-1}(c_2h_0) + q_{1}K^{-1}(c_3h_0)\right) g_1+\right. \\ &{} {\hspace{4cm}} + \left. \left( d_{2}K^{-1}(0) + p_{2}K^{-1}(c_2h_0)\right) g_2 + d_{3}K^{-1}(0)g_3 \right] ,\\ &{}v_0=h_0(b_1g_1+b_2g_2+b_3g_3), \end{matrix}} \end{aligned}$$
(14)

where \(c_2, c_3, a_{21}, a_{31}, r_{31},a_{32}, d_{1},p_{1}, q_{1}, d_{2}, p_{2},\) \(d_{3}, b_1, b_2, b_3\) are real coefficients.

Then we compare the Taylor expansions for numerical solution \(y_0,v_0\) and for exact solution \(u_0,w_0\) (see (13), (12)) and equate equal powers of \(h_0\) up to \(h_0^4\). As a result, we obtain the next system of equations with respect to unknown coefficients:

$$\begin{aligned}{} & {} d_{1}+p_{1}+q_{1}+ d_{2}+ p_{2}+d_{3}=\frac{1}{2(1+\lambda )},\nonumber \\{} & {} (d_{2}+p_{2})c_2+ d_{3}c_3 = \frac{1}{3(2+\lambda )},\nonumber \\{} & {} (d_{2}+p_{2})c_2^2+d_{3}c_3^2 = \frac{1}{4(3+\lambda )}, \end{aligned}$$
(15)
$$\begin{aligned} {\begin{matrix} &{}b_1+b_2+b_3= \frac{1}{1+\lambda }, \\ &{}b_2c_2+b_3c_3= \frac{1}{2+\lambda },\\ &{}b_2c_2^2+b_3c_3^2=\frac{1}{3+\lambda },\\ &{}b_2c_2^3+b_3c_3^3= \frac{1}{4+\lambda }, \end{matrix}} \end{aligned}$$
(16)
$$\begin{aligned} {\begin{matrix} &{}b_3 a_{32} {c}_{2} = \frac{1}{3(4+\lambda )(2+\lambda )},\\ &{}b_3r_{31}{c}_{2} = \frac{1}{3(4+\lambda )(1+\lambda )}, \end{matrix}} \end{aligned}$$
(17)
$$\begin{aligned} {\begin{matrix} &{} (p_{1}+p_{2}){c}_2 + q_{1}{c}_3 =\frac{1}{3(1+\lambda )},\\ &{}(p_{1} + p_{2}){c}_2^2 + q_{1}{c}_3^2= \frac{1}{4(1+\lambda )},\\ \end{matrix}} \end{aligned}$$
(18)
$$\begin{aligned} p_{2}c_2^2= \frac{1}{4(2+\lambda )}, \end{aligned}$$
(19)
$$\begin{aligned} a_{21}=\frac{c_2^2}{2(1+\lambda )},\quad r_{31}+a_{31}+a_{32}=\frac{c_3^2}{2(1+\lambda )}. \end{aligned}$$
(20)

This system has the solution

$$ {\begin{matrix} &{}c_3=\frac{\lambda ^2+6\lambda +12}{(\lambda +3)(\lambda +4)},\quad c_2=\frac{3(\lambda +2)}{4(\lambda +3)},\quad b_1=\frac{(6-\lambda )(\lambda +4)}{3(\lambda +1)(\lambda +2)^2(\lambda ^2+6\lambda +12)},\\ &{}b_2=\frac{64(\lambda +3)}{3(\lambda +2)^2(\lambda ^2+6\lambda +24)},\quad b_3=\frac{(\lambda +3)(\lambda +4)^2}{(\lambda ^2+6\lambda +12)(\lambda ^2+6\lambda +24)}. \end{matrix}} $$
$$ {\begin{matrix} &{}a_{21}=\frac{9(\lambda +2)^2}{32(\lambda +1)(\lambda +3)^2},\quad a_{32}=\frac{4(\lambda ^2+6\lambda +12) (\lambda ^2+6\lambda +24)}{9(\lambda +2)^2(\lambda +4)^3},\\ &{}r_{31}=\frac{4(\lambda ^2+6\lambda +12)(\lambda ^2+6\lambda +24)}{9(\lambda +1)(\lambda +2)(\lambda +4)^3},\\ &{}a_{31}=-\frac{(\lambda ^2+6\lambda +12)(7\lambda ^5+90\lambda ^4+672\lambda ^3+2736\lambda ^2+5184\lambda +3456)}{18(\lambda +1)(\lambda +2)^2(\lambda +3)^2(\lambda +4)^3}. \end{matrix}} $$
$$ {\begin{matrix} &{}d_2=-\frac{4(\lambda +3)}{9(\lambda +2)^3},\quad p_1=-\frac{4(\lambda +3)(3\lambda ^3+23\lambda ^2+54\lambda +24)}{9(\lambda +1)(\lambda +2)^3(\lambda ^2+6\lambda +24)},\\ &{}p_2=\frac{4(\lambda +3)^2}{9(\lambda +2)^3},\quad q_1=\frac{(\lambda +3)(\lambda +4)^2}{(\lambda +1)(\lambda ^2+6\lambda +24)(\lambda ^2+6\lambda +12)}. \end{matrix}} $$
$$ d_1=\frac{\lambda ^5+18\lambda ^4+126\lambda ^3+408\lambda ^2+600\lambda +288}{18(\lambda +1)(\lambda +2)^3(\lambda ^2+6\lambda +12)}, \quad d_{3}=0. $$

3 Error estimation and convergence for Runge-Kutta type methods

The IVP (6)–(8) can be rewritten in the following form

$$\begin{aligned} {\begin{matrix} &{}\frac{dZ(t)}{dt}=F(t,Z),\quad -\infty <t\le \ln a,\\ &{}\underset{t\rightarrow -\infty }{\lim }\,Z(t)=\left( {{\begin{array}{c} A \\ 0\\ \end{array} }} \right) , \end{matrix}} \end{aligned}$$
(21)

where

$$ Z(t)=\left( {{\begin{array}{c} U(t) \\ W(t)\\ \end{array} }} \right) ,\quad F(t,Z)=\left( {{\begin{array}{c} \displaystyle e^t\tilde{K}^{-1}(t)W(t)\\ -e^t\tilde{f}(t,U)-\lambda W(t)\\ \end{array} }} \right) . $$

Then the numerical solution of problem (21) at the grid nodes \(\hat{\bar{{\omega } }}_{h}\) can be obtained by a step-by-step procedure

$$\begin{aligned} {\begin{matrix} &{}Y_0=\left( {{\begin{array}{l} A+h_0^2\left[ \left( d_{1}K^{-1}(0) + p_{1}K^{-1}(c_2h_0) + q_{1}K^{-1}(c_3h_0)\right) g_1+\right. \\ {\hspace{2cm}} + \left. \left( d_{2}K^{-1}(0) + p_{2}K^{-1}(c_2h_0)\right) g_2 + d_{3}K^{-1}(0)g_3 \right] \\[0.4cm] h_0(b_1g_1+b_2g_2+b_3g_3)\\ \end{array} }} \right) , \end{matrix}} \end{aligned}$$
(22)
$$\begin{aligned} Y_{n+1}=Y_{n}+h_{n+1}\Phi (t_n,Y_n,h_{n+1}),\quad n=0,1,...,N-1, \end{aligned}$$
(23)

where

$$\begin{aligned}{} & {} Y_{n}=\left( {{\begin{array}{c} y_n \\ v_n \\ \end{array} }} \right) , \quad n=0,1,...,N,\quad h_0=e^{t_0},\\{} & {} \Phi (t_n,Y_n,h_{n+1})=b_1k_1+b_2k_2+b_3k_3+b_4k_4,\\{} & {} k_1 = F\left( {t_n,Y_n } \right) , \\{} & {} k_2 = F\left( {t_n + c_2 h_{n+1} ,Y_n + h_{n+1} a_{21} k_1 } \right) , \\{} & {} k_3 = F\left( {t_n + c_3 h_{n+1} ,Y_n + h_{n+1} (a_{31} k_1 + a_{32} k_2) }\right) , \\{} & {} k_4 = F\left( {t_n + c_4 h_{n+1} ,Y_n + h_{n+1} (a_{41} k_1 + a_{42} k_{2} + a_{43} k_{3}) } \right) . \end{aligned}$$

Let the conditions

$$ c_1\Vert u\Vert \le (K(x)u,u), \quad \forall x\in [0,a],\quad u\in \mathbb {R}^s,\quad c_1>0, $$
$$ \Vert f(x,U_1)-f(x,U_2)\Vert \le L\Vert U_1-U_2\Vert , \quad \forall x\in [0,a],\quad U_1,U_2\in \mathbb {R}^s $$

and assumptions of Lemma 1 be fulfilled.

If conditions (15)–(20) and the order conditions for (23)

$$ {\begin{matrix} &{} b_1 + b_2 + b_3 + b_4 = 1,\quad b_2 c_2 + b_3 c_3 + b_4 c_4 = \frac{1}{2},\\ &{}b_2c_2^2 + b_3 c_3^2 + b_4 c_4^2 = \frac{1}{3}, \quad b_2c_2^3 + b_3 c_3^3 + b_4 c_4^3 = \frac{1}{4},\\ &{}b_3 c_3 a_{32} c_2 +b_4 c_4 (a_{42} c_2 + a_{43} c_3)=\frac{1}{8},\\ &{}b_3 c_3 a_{32} c_2^2 +b_4 c_4 (a_{42} c_2^2 + a_{43} c_3^2)=\frac{1}{12},\\ &{}b_4 a_{43} a_{32} c_2 = \frac{1}{24},\quad c_2 = a_{21} ,\\ &{}c_3 = a_{31} + a_{32} , \quad c_4 = a_{41} +a_{42} + a_{43} \end{matrix}} $$

are satisfied then the method (22), (23) is of order 4.

Let \((Z,Y)_{\mathbb {R}^{2s}}=(U,Y^{(1)})+(W,Y^{(2)})\) be a scalar product of vectors \(Z=(U,W)\), \(Y=(Y^{(1)},Y^{(2)})\in \mathbb {R}^{2s}\) and \(\Vert Z\Vert _{\mathbb {R}^{2s}}=(Z,Z)^{1/2}_{\mathbb {R}^{2s}}\) is the norm of vector \(Z\in \mathbb {R}^{2s}\). For the fourth-order method (22), the local error estimations, which follow from the relations \(y_0-u_0=O(h_0^5),v_0-w_0=O(h_0^5)\) and the analogous relations for the standard Runge-Kutta methods, have the following form

$$\begin{aligned} {\begin{matrix} &{}\Vert e_0\Vert _{\mathbb {R}^{2s}}=\Vert Y_0-Z_0\Vert _{\mathbb {R}^{2s}}\le Ch_0^5,\\ &{}\Vert e_{n}\Vert _{\mathbb {R}^{2s}}=\Vert Z_{n-1}-Z_{n}+h_{n}\Phi (t_{n-1},Z_{n-1},h_{n})\Vert _{\mathbb {R}^{2s}}\le Ch_n^5, \quad n=1,2,...,N, \end{matrix}} \end{aligned}$$
(24)

where the constant C is independent of \(h_n\).

Taking into account the equality

$$ \begin{aligned}&\left( F(t,Z_1)-F(t,Z_2),Z_1-Z_2\right) _{\mathbb {R}^{2s}}=e^t\left( U_1-U_2,\tilde{K}^{-1}(t)(W_1-W_2)\right) \\&-e^t\left( \tilde{f}(t,U_1)-\tilde{f}(t,U_2),W_1-W_2\right) -\lambda \Vert W_1-W_2\Vert ^2, \end{aligned} $$

the Cauchy-Schwarz inequality, the Lipschitz condition for function \(\tilde{f}(t,U)=f(e^t,U)\), the condition \(\Vert \tilde{K}^{-1}(t)\Vert =\Vert K^{-1}(e^t)\Vert \le \frac{1}{c_1}\) and the inequality \(|ab|\le \frac{1}{2}(a^2+b^2)\) we obtain

$$ \begin{aligned}&\left( F(t,Z_1)-F(t,Z_2),Z_1-Z_2\right) _{\mathbb {R}^{2s}}\le e^t|(U_1-U_2,\tilde{K}^{-1}(t)(W_1-W_2)|\\&\hspace{2cm}+e^t|(\tilde{f}(t,U_1)-\tilde{f}(t,U_2),W_1-W_2)|\\&\le e^t\Vert \tilde{K}^{-1}(t)\Vert \Vert U_1-U_2\Vert \Vert W_1-W_2\Vert +e^t\Vert \tilde{f}(t,U_1)-\tilde{f}(t,U_2)\Vert \Vert W_1-W_2\Vert \\&\le \left( \frac{1}{c_1}+L\right) e^t\Vert U_1-U_2\Vert \Vert W_1-W_2\Vert \le \mathcal {L}e^t\Vert Z_1-Z_2\Vert ^2_{\mathbb {R}^{2s}}, \end{aligned} $$

where \(\mathcal {L}=\frac{1}{2}(1/c_1+L).\)

Now, we can prove the next theorem.

Theorem 1

Suppose that \(l(t)=\mathcal {L}e^t\) is one-sided Lipschitz constant for F in the neighborhood \(\Delta =\{(t,Z(t))|t_0\le t\le \ln a\}\) of the exact solution Z(t) of the problem (21) and the local error estimates (24) are valid. Then the global error \(E=Y_N-Z_N\) can be estimated by

$$\begin{aligned} \Vert E\Vert _{\mathbb {R}^{2s}}\le h^4Ce^{\mathcal {L}a}\left[ a+E_{1}\left( \mathcal {L} x_0\right) -E_{1}\left( \mathcal {L}a\right) \right] , \end{aligned}$$
(25)

where \(h=\max \{h_0,h_{\max }\},x_0=e^{t_0}\), \(E_{1}(x)\) is the following exponential integral

$$ E_{1}(x)=\int _{1}^{\infty }\frac{e^{-tx}}{t}dt. $$

Proof

From Theorem 10.6 (see [6, p. 61]) with \(\delta =0\) we have

$$ \Vert E_n\Vert _{\mathbb {R}^{2s}}\le e^{\mathcal {L}(a-e^{t_n})}\Vert e_n\Vert _{\mathbb {R}^{2s}},\quad n=0,1,...,N. $$

Then we insert it into the estimation for the global error

$$ \Vert E\Vert _{\mathbb {R}^{2s}}\le \sum _{n=0}^{N}\Vert E_n\Vert _{\mathbb {R}^{2s}}. $$

Taking into account that \(x_0=e^{t_0}\), we get

$$ {\begin{matrix} &{}\Vert E\Vert _{\mathbb {R}^{2s}}\le h^4C\left( h_0e^{\mathcal {L}(a-e^{t_0})}+h_1e^{\mathcal {L}(a-e^{t_1})} +h_2e^{\mathcal {L}(a-e^{t_2})}+...+h_N\right) \\ &{}\hspace{0.8cm}\le h^4C\left( x_0e^{\mathcal {L}(a-e^{t_0})}+\int _{t_0}^{\ln a} e^{\mathcal {L}(a-e^{t})}dt\right) \\ &{}\hspace{0.8cm}\le h^4C\left\{ x_0e^{\mathcal {L}(a-e^{t_0})}+e^{\mathcal {L}a}\left[ E_{1}\left( \mathcal {L} x_0\right) -E_{1}\left( \mathcal {L}a\right) \right] \right\} \\ &{}\hspace{0.8cm}\le h^4Ce^{\mathcal {L}a}\left[ a+E_{1}\left( \mathcal {L} x_0\right) -E_{1}\left( \mathcal {L}a\right) \right] . \end{matrix}} $$

\(\square \)

From the inequality (25) it follows that the method (22) is convergent of the fourth order for fixed \(t_n,n=0,1,...,N\) as \(N\rightarrow \infty \).

4 Algorithm for numerical solving singular IVPs

In this section, we describe the algorithm that automatically selects the node \(t_0=b-\sqrt{N}\) of the grid (11) and the step size \(h_0=e^{t_0}\) to achieve a prescribed tolerance of the local error.

Using a fixed Runge-Kutta-type method of order 4 (14) for a given N and \(b=\ln a\) with a step \(h_0=e^{b-\sqrt{N}}\) we find a solution of IVP (6)–(8) \(y_0,v_0\) at the point \(t_0=b-\sqrt{N}\). Based on point \((t_0,y_0,v_0)\) and step size \(h=1/\sqrt{N}\), we compute two steps, using a fixed standard Runge-Kutta method of order 4, and obtain the numerical solution of IVP (6)–(8) \(y_1^h,v_1^h\), \(y_2^h,v_2^h\) at points \(t_1=t_0+h,t_2=t_1+h\) respectively. Starting from point \((t_0,y_0,v_0)\), we also compute one step with step size \(2h=2/\sqrt{N}\) to obtain the solution \(y_2^{2h},v_2^{2h}\) at the point \(t_2=t_0+2h\). Then, according to the Richardson extrapolation algorithm, the error estimations of \(y_2^h,v_2^h\) are as follows

$$ err_{1,i}=\frac{1}{15}|y_{2,i}^h-y_{2,i}^{2h}|,\quad err_{2,i}=\frac{1}{15}|v_{2,i}^h-v_{2,i}^{2h}|, \quad i=1,2,...,s. $$
Table 1 Numerical results for problem (26) by our algorithm and code DOPRI5

We want these errors to satisfy the componentwise conditions

$$ {\begin{matrix} &{}err_{1,i}\le Atol+\max \left( |y_{2,i}^h|,|y_{0,i}|\right) Rtol,\\ &{}err_{2,i}\le Atol+\max \left( |v_{2,i}^h|,|v_{0,i}|\right) Rtol,\quad i=1,2,...,s, \end{matrix}} $$

where Atol and Rtol are the desired tolerances prescribed by the user (relative ones are considered for \(Atol=0\), absolute — for \(Rtol=0\); usually both tolerances are different from zero). Then, if the componentwise conditions are fulfilled, the computed step is accepted. Otherwise, the step is rejected and the computations are repeated with \(N_{new}=4N\), \(b_{new}=t_2\).

With increasing N the grid node \(t_0=b-\sqrt{N}\) approaches the point \(t=-\infty \). At the same time step size \(h=1/\sqrt{N}\) decreases. Due to this reason, we used the local Richardson’s strategy for practical error estimation and step size selection, and not some other approach.

The values

$$ \hat{y}_2=y_2^h+\frac{1}{15}\left( y_{2}^h-y_{2}^{2h}\right) ,\quad \hat{v}_2=v_2^h+\frac{1}{15}\left( v_{2}^h-v_{2}^{2h}\right) $$

are approximations of order 5 for \(u(t_0+2h)\) and \(w(t_0+2h)\) correspondingly.

The numerical solutions \(\hat{y}_2^h,\hat{v}_2^h\) or \(y_2^h,v_2^h\) at the node \(t_2=t_0+2h\), calculated by the above-described algorithm, we use as initial conditions for solving the problem (6)–(8) with the same tolerance on interval \((t_2,\ln a]\). For this, we can apply the standard explicit Runge-Kutta methods of order 4 with Richardson strategy or embedded Runge-Kutta methods 5(4) (see, e.g., [6, pp. 164–168]).

Table 2 Numerical results for problem (26) by our algorithm and code DLSODE
Table 3 Numerical results for problem (26) by implicit Runge-Kutta method (code RADAU5)

5 Numerical examples

Example 1

Let us consider the singular IVP for system of ODEs

$$\begin{aligned} {\begin{matrix} &{}\frac{1}{x^2} \frac{d}{dx}\left[ x^2\frac{du_1}{dx} \right] =-(6+4x^4)u_1+4u_1u_2,\\ &{}\frac{1}{x^2} \frac{d}{dx}\left[ x^2\frac{du_2}{dx} \right] =6-20\ln u_1,\quad x \in (0;1],\\ &{}u_1(0)=1, \quad \frac{du_1(0)}{dx}=0,\\ &{}u_2(0)=0, \quad \frac{du_2(0)}{dx}=0 \end{matrix}} \end{aligned}$$
(26)

with the exact solution \( \displaystyle u_1(x)=e^{-x^2},\; u_2(x)=x^2+x^4.\)

We solved the problem (26) with a given tolerance, using our algorithm near the singular point. At other points of the interval we applied embedded Dormand-Prince-5(4) methods [4] (code DOPRI5 [6]) and Adams methods with functional iteration (code DLSODE [8]) accordingly. The results of the solving are given in Tables 1 and 2. In the tables, NSTEP and NFUN denote the number of steps and the number of right-hand side evaluations of the differential equations,

$$ {\begin{matrix} &{}\displaystyle Er=\left\| y-u \right\| _{1,\infty ,\hat{\bar{\omega }}_{h}} =\max \left\{ \left\| y-u \right\| _{0,\infty ,\hat{\bar{\omega }}_{h}}, \left\| v-\frac{du}{dx}\right\| _{0,\infty ,\hat{\bar{\omega }}_{h}}\right\} ,\\ &{} \Vert y\Vert _{0,\infty ,\hat{\bar{\omega }}_{h}}=\max \limits _{0\le n\le N} |y_n|\quad y_n\approx u(e^{t_n}),\quad v_n\approx \frac{du(e^{t_n})}{dx},\\ \end{matrix}} $$

CPU denotes the time needed to solve the problem.

To compare the results we have solved the problem (26) by implicit Runge-Kutta (code RADAU5 [7]). The results of the solving are given in Table 3, where NJAC is the number of Jacobian evaluations, and NDEC is the number of LU-decompositions of matrices.

The code RADAU5 requires using of the iterative Newton method, and therefore the Jacobian evaluations and solving systems of linear equations. As a consequence of it, computational costs to solve the problem (26) for our approach are less than for implicit Runge-Kutta methods.

Table 4 Numerical results for problem (27) by our algorithm and code DOPRI5
Table 5 Numerical results for problem (27) by our algorithm and code DLSODE

Example 2

Consider one more IVP

$$\begin{aligned} {\begin{matrix} &{}\frac{1}{x^2} \frac{d}{dx}\left[ x^2\frac{du_1}{dx} \right] =u_1^2-u_2^2-6u_2+6+6x^2,\\ &{}\frac{1}{x^2} \frac{d}{dx}\left[ x^2\frac{du_2}{dx} \right] =u_2^2-u_1^2+6u_2+6-6x^2,\quad x \in (0;1],\\ &{}u_1(0)=1, \quad \frac{du_1(0)}{dx}=0, \\ &{} u_2(0)=-1, \quad \frac{du_2(0)}{dx}=0 \end{matrix}} \end{aligned}$$
(27)

with the exact solution \( \displaystyle u_1(x)=x^2+e^{x^2},\;u_2(x)=x^2-e^{x^2}.\)

Table 6 Numerical results for problem (26) by implicit Runge-Kutta method (code RADAU5)

The results of numerical solving of the problem (27) presented in Tables 4, 5, and 6 show the same trend. That is, the approach proposed in the article requires fewer computing resources compared to implicit methods. This advantage of our algorithm obviously will only increase when solving singular systems of higher dimensions.

6 Conclusion

Thus, we presented an approach that demonstrates how to construct explicit fourth-order Runge-Kutta methods that do not lose their order in the numerical solution of the singular IVP. It allowed us to develop a numerical algorithm for solving IVPs with a given tolerance. The results of numerical experiments demonstrate that the combination of presented explicit Runge-Kutta methods for finding the solution near the singularity point with standard explicit Runge-Kutta or linear multistep ones is a very effective way for solving singular initial value problems. This approach can be also generalized for a wider class of IVPs.