1 Introduction

Ordinary differential equations (ODEs) have considerable applications in physics, economics, biological and chemical process. The population growth model, change in climate and Newton law of cooling etc, are modeled by ODEs. In this article, we describe numerical solution of linear and nonlinear second order ODEs, the singular perturbed BVPs and the system of obstacle BVPs.

Consider a general form of ODE given as

$$\begin{aligned} \pounds (w(v))=h(v), ~~ \alpha \le {v} \le \beta , \end{aligned}$$
(1.1)

where \(\pounds \) is any second order differential operator which may be linear or nonlinear and h(v) is any smooth function. One can decompose \(\pounds \) as,

$$\begin{aligned} L(w(v))+N(w(v))=h(v), \end{aligned}$$
(1.2)

where L is linear and N nonlinear differential operator. The corresponding boundary condition are described as:

$$\begin{aligned} w(\alpha )=a, \quad w(\beta )=b, \end{aligned}$$
(1.3)

where a and b are real constant.

Next, we consider a singular perturbed second order BVP of the form

$$\begin{aligned} \epsilon {w^{''}}+h(v)w=b(v), \qquad \text {where} \qquad \alpha \le {v} \le {\beta }, \end{aligned}$$
(1.4)

subject to boundary conditions (1.3). Here \(\epsilon \) is a positive small parameter, h(v) and b(v) are sufficiently smooth functions. Equation (1.4) has great importance by its nature of singularity in various field of applied sciences and engineering. This equation arises in quantum mechanics, newtonian fluid mechanics, fluid dynamics, convection diffusion process, aerodynamics and chemical reactor process etc. The solution of such model is described by various methods reported in [1, 2] and the references there in.

These methods usually required to: define boundary layer for the problem, and introduce new models in the inner region by re-scaling independent variable in the original model and incorporate these new models in a sense to attain a uniform definite solution. Ultimately to generate a new model according to these methods, is not an easy job. Therefore, a class of numerical technique have been used for the solution of such type of problems. All singular perturbed problems are taken from [3, 4], where the authors used spline technique and non-polynomial sextic spline technique for the approximate solution.

Finally, we consider a system of obstacle BVPs as follow:

$$\begin{aligned} w^{''}(v)= {\left\{ \begin{array}{ll} h(v), &{} { \quad \alpha \le v< \gamma },\\ b(v)w(v)+h(v)+p, &{} { \quad \gamma \le v \le \eta },\\ h(v), &{} { \qquad \eta < v \le \beta }, \end{array}\right. } \end{aligned}$$
(1.5)

with corresponding boundary conditions defined in Eq. (1.3). The function w and \(w'\) are continuous in \({[\gamma , \eta ]}\). Further h(v) and b(v) are smooth functions and the parameter abp are specific real constants. The mathematical formulation of unilateral, contact, equilibrium and obstacle problems happen in area of structural analysis, optimal control, elasticity, economics, transportation sciences and computer networking can be studied in the form of above system. Several techniques have been applied for the solution of Eq. (1.5). Noor [5] added their contribution in computation of system of BVPs using VIM. Rashidinia [6] introduced non-polynomial spline technique (NPST) to describe solution of obstacle BVPs. Similarly B-spline approach and many other technique were also used for such models, see [7, 8] and the references there in.

In the present work, we applied the collocation method based on RBFs for the solution of above mentioned BVPs. RBFs is the convenient and most powerful technique to solve multivariate problems. Owing to its fast convergence, ease implementation, low computational cost, simple to understand and flexibility to higher dimensions RBFs technique have given preference over the traditional methods. The researchers have used RBF based meshless method for solution of various class of Partial differential equations (PDEs), e.g. Marjan [9,10,11] applied Kansa method to approximate solution of complex modified Korteweg-de Vries, Kuramoto–Sivashinsky equation and time fractional PDEs. Haq [12, 13] studied KdV-Burgers’ and Kawahara equation using RBF approximation method. Dehgan [14] studied numerical solution of nonlinear Klein-Gordon equation, whereas Khattak [15] obtained numerical solution of nonlinear PDEs using meshfree collocation method. Recently, Hussain and their co-worker used the meshless RBFs for various classes of fractional PDEs [16,17,18]. In this article, we experienced the application of RBFs meshless method for numerical solution of boundary value problems. For computation we use MATLAB 2013, using Intel core-i7 computer having 4GB Ram. Rest of the paper is organized as in Sect. 2 methodology of the scheme is discussed, in Sect. 3 quasi-linearization for nonlinear term is defined, in Sect. 4 numerical problems have been given while at the end paper is finalized with conclusion.

2 Description of the Proposed Method

In this section, we explain mesh-free collocation method using RBFs for general BVPs defined in Eq. (1.1) along with boundary conditions given in Eq. (1.3). Let us approximate w(v) by

$$\begin{aligned} w{(v)}=\sum _{j=1}^{M}\leftthreetimes _{j}\Upsilon {(r_{j})}=A\lambda , ~~ r_{j}=\Vert v-v_{j} \Vert , \end{aligned}$$
(2.1)

where \(\Upsilon ({r_{j}})\) are RBFs, \(\leftthreetimes \)’s are unknown coefficients and \(\Vert \cdot \Vert \) is the Euclidean norm. Application of differential operators L and N in Eq. (2.1) leads to

$$\begin{aligned} L(w(v))=\sum _{j=1}^{M}\leftthreetimes _{j}{L(\Upsilon {(r_{j})})} = \sum _{j=1}^{M}\leftthreetimes _{j}\Upsilon _{L}{(r_{j})},\end{aligned}$$
(2.2)
$$\begin{aligned} N(w(v))=\sum _{j=1}^{M}\leftthreetimes _{j}{N(\Upsilon {(r_{j})})} = \sum _{j=1}^{M}\leftthreetimes _{j}\Upsilon _{N}{(r_{j})}. \end{aligned}$$
(2.3)

Plugging these values in Eq. (1.2) and using boundary conditions defined in (1.3) we get

$$\begin{aligned} \sum _{j=1}^{M}{[\Upsilon _{L}{(r_{ij})}+ \Upsilon _{N}{(r_{ij})}]\leftthreetimes _{j}}=h{(v_{i})}, \qquad i=2,3,...M-1, \end{aligned}$$
(2.4)
$$\begin{aligned} \sum _{j=1}^{M}{[\Upsilon {(r_{ij})}]\leftthreetimes _{j}}=w{(v_{i})}, \qquad i=1,M, \nonumber \\ r_{ij}=\Vert v_{i}-v_{j} \Vert . \end{aligned}$$
(2.5)

In more compact form Eqs. (2.42.5) can be written as

$$\begin{aligned} H\leftthreetimes =B \quad \Rightarrow \quad \leftthreetimes =H^{-1}B. \end{aligned}$$
(2.6)

Here H is \(M\times M\) matrix, B and \(\leftthreetimes \) are \(M \times 1\) vectors. Hon et al. [19] studied the invertibility of matrix H. The entries of matrix H and vector B are as follow:

$$\begin{aligned} H={[H_d ~+~ H_b]}, \ \ \text{ and } \ \ B={[w{(\alpha )},\ h_2\ h_3.......\ h_M,\ w{(\beta )}]^{\textit{t}}}, \end{aligned}$$

where \(w{(\alpha )}\) and \(w{(\beta )}\) are the given boundary conditions, and for \(j=1,...,M\) the \(H_{d}\) and \(H_{b}\) can be written as:

$$\begin{aligned}{}[H_{d}]_{ij}= {\left\{ \begin{array}{ll} \Upsilon _{L}{(r_{ij})}+ \Upsilon _{N}{(r_{ij})}, \quad &{}\hbox { }\ i={2,...,M-1},\\ 0, \qquad &{}\hbox { }\ i={1,M}, \end{array}\right. } \end{aligned}$$
(2.7)
$$\begin{aligned}{}[H_{b}]_{ij}= {\left\{ \begin{array}{ll} 0, \quad &{}\hbox { }\ i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{}\hbox { }\ i={1,M}. \end{array}\right. } \end{aligned}$$
(2.8)

In Eq. (2.4 or 2.7) the nonlinear operator N is linearized using quasilinearization technique. From Eq. (2.6) the unknowns vector \(\leftthreetimes \) can be computed easily which then provide solution at any nodal point via Eq. (2.1).

2.1 Stability Analysis

To check the stability of the system (2.6), we use a spectral radius of the amplification matrix. Let w denote approximate solution while u represent the exact solution, and then the error can be defined as:

$$\begin{aligned} E^{n}=u^{n}-w^{n}, \end{aligned}$$
(2.9)

From Eq. (2.1) we know \(w^{n}=A\lambda ^{n}\Rightarrow \lambda ^{n}=A^{-1}w^{n}\), by putting the value of \(\lambda \) for any n in Eq. (2.6) and after rearranging we have

$$\begin{aligned} w^{n+1}=AH^{-1}FA^{-1}w^{n}. \end{aligned}$$
(2.10)

Similarly if u is the exact solution of ODE then it must satisfy the difference equation such that [22]

$$\begin{aligned} u^{n+1}=AH^{-1}FA^{-1}u^{n}. \end{aligned}$$
(2.11)

Substituting the values from Eqs. (2.9) and (2.11) in Eq. (2.9) we have:

$$\begin{aligned} E^{n+1}=u^{n+1}-w^{n+1}=AH^{-1}FA^{-1}E^{n}=ME^{n}, \end{aligned}$$
(2.12)

here \(M=AH^{-1}FA^{-1}\) is the amplification matrix. The scheme (2.10) is stable when the spectral radius \(\rho (M)\) of matrix M is such that \(\rho (M)\le 1\), where \(\rho (M)=max(\kappa _{i})_{i=1}^{N}\) and \(\kappa \) are the eigenvalue of matrix M.

2.2 Quasilinearization

Quasilinearization technique is generalization of Newton–Raphson method for a functional equations. It converges quadratically. Consider a nonlinear mth order differential equation as

$$\begin{aligned} \psi ^{(m)}(v)=g(v,\psi ,\psi ^{'},\psi ^{''},...,\psi ^{(m-1)}),~~ \text {where} ~v\in \Gamma . \end{aligned}$$
(2.13)

Using quasilinearization technique, Eq. (2.13) reduces to following form

$$\begin{aligned} \psi ^{(m)}_{s+1}=g(v,\psi ,\psi ^{'},\psi ^{''},...,\psi ^{(m-1)})+ \sum _{i=0}^{m-1}({\psi _{s+1}^{i}}-{\psi _{s}^{i}}) g_{\psi ^{i}}(v,\psi _{s},\psi ^{'}_{s},\psi ^{''}_{s},...,\psi ^{(m-1)}_{s}), \end{aligned}$$
(2.14)

which is \(m^{th}\) order linear differential equation in iterated form and s denotes number of iterations. From Eq. (2.14) one can easily compute \(\psi \) at \((s+1)^{th}\) iteration, when it is known at sth iteration. For better understanding, we consider a second order nonlinear differential equation of the form

$$\begin{aligned} \psi ^{''}(v)=g(v, \psi , \psi ^{'}), ~~\text {for}~~ v\in \Gamma \end{aligned}$$
(2.15)

where \(\psi ^{'}\) is another function, then by using Eq. (2.14) we linearize Eq. (2.15) as

$$\begin{aligned} \psi _{s+1}^{''}(v)=g(v, \psi _{s}, \psi ^{'}_{s})+(\psi _{s+1}-\psi _{s})g_{\psi }(v,\psi _{s},\psi _{s}^{'})+(\psi _{s+1}^{'}-\psi _{s}^{'})g_{\psi ^{'}}(v,\psi _{s},\psi _{s}^{'}) \end{aligned}$$
(2.16)

Eq. (2.16) is always a linear differential equation and can be solved recursively, where \(\psi _{s}(v)\) is known and one can use for obtaining \(\psi _{s+1}(v)\).

3 Numerical Experiment

In this section we apply the proposed method to some linear, nonlinear and to the afore discussed models. The nonlinear term should be linearized by quasilinearization technique. The obtained result are compared with available results in the literature.

3.1 Second Order ODEs

Problem 1

Consider second order linear convection diffusion equation [21].

$$\begin{aligned} -\frac{d^2w}{d v^2}+q\frac{dw}{dv}=0 \quad v\in (0,1),~~q>0, \end{aligned}$$
(3.1)

with boundary conditions

$$\begin{aligned} w{(0)}=1, \qquad w{(1)}=0. \end{aligned}$$
(3.2)

The exact solution is

$$\begin{aligned} w{(v)}=\frac{e^q-e^{qv}}{e^q-1}. \end{aligned}$$

Comparing the given equation with the general form of ODE (1.2), we have

$$\begin{aligned} L=-\frac{d^{2}}{dv^{2}}+q\frac{d}{dv},~~ N=0,~~ h=0. \end{aligned}$$
(3.3)

The matrix H in Eq. 2.6 has entries for \(j=1,...,M\) are

$$\begin{aligned} H= {\left\{ \begin{array}{ll} -\Upsilon ^{''}{(r_{ij})}+ q\Upsilon {(r_{ij})}, \quad &{}\hbox { }\ i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{}\hbox { }\ i={1,M}, \end{array}\right. } \end{aligned}$$
(3.4)

and vector B is

$$\begin{aligned} B={[1,0,...0,0]}^{\textit{t}}. \end{aligned}$$
(3.5)

The solution is computed using multiquadric (MQ) and inverse multiquadric (IMQ) RBFs with the value of shape parameters \(c=0.5,~ 0.6\), respectively. The value of c has been selected on trial basis in both type of RBFs. In Table 1 the results of MQ, IMQ are compared with that of wavelet solution given in [21]. Where i represent index of nodal points \(v_{i}=\alpha +(i-1)dv\), and M is the total number of collocation points. For this problem we choose \(M=32\) and \(dv=(\beta - \alpha )/M\), where \(\alpha \), \(\beta \) are the end points of the given domain. From the table it is clear that the results of both MQ and IMQ are better than that of [21]. Also we observe that the results of IMQ are better than that of MQ. In Fig. 1 approximate solution of both type of RBFs are plotted against the exact solutions which show good agreement. The error plot are also given for both the cases which show accuracy of the proposed method.

Table 1 Comparison of absolute errors for problem 1
Fig. 1
figure 1

Solution profiles, and absolute errors for problem 1

Problem 2

Consider the inhomogeneous linear differential equation.

$$\begin{aligned} \frac{d^2w}{dv^2}=e^{4v}, \qquad v\in (-1, \, 1), \end{aligned}$$
(3.6)

with exact solution

$$\begin{aligned} w(v)=\frac{1}{16}e^{4v}. \end{aligned}$$
(3.7)

The boundary conditions are extracted from the exact solution. Comparing the given equation with the general form of ODE (1.2), we have

$$\begin{aligned} L=\frac{d^{2}}{dv^{2}},~ h=e^{4v},~ N=0. \end{aligned}$$
(3.8)

In the proposed scheme (2.6), the matrix H has entries for \(j=1,...,M\) are

$$\begin{aligned} H= {\left\{ \begin{array}{ll} \Upsilon ^{''}{(r_{ij})}, \quad &{}\hbox { }\ i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{}\hbox { }\ i={1,M}, \end{array}\right. } \end{aligned}$$
(3.9)

and vector B is

$$\begin{aligned} B={\left[ \frac{1}{16}e^{-4},e^{4v_{2}},...,e^{4v_{M-1}},\frac{1}{16}e^{4}\right] }^{\textit{t}}. \end{aligned}$$
(3.10)

The given problem has been solved using MQ, IMQ RBFs with shape parameter \(c=1,1.4\), collocation points \(M=32\) and step size \(dv=(\beta -\alpha )/M\). Here also the shape parameter have been calculated experimentally. The computed solutions are matched with exact solution at different nodal points shown in Table 2 where i represent index of nodal points \(v_{i}=\alpha +(i-1)dv\). In the same table absolute error is also recorded for different collocation points showing well agreement between exact and computed solutions. Figure 2 displayed exact vs numerical solutions and absolute error plots. it is obvious from the figure that the RBFs numerical solution approaches to the true solution in the given domain.

Table 2 Comparison of absolute errors for problem 2
Fig. 2
figure 2

Solution profiles, and absolute errors for problem 2

Problem 3

Consider the second order nonlinear boundary value problem.

$$\begin{aligned} \frac{d^2w}{dv^2}=\frac{1}{2}{(1+v+w)}^3, \qquad w(0)=0, \ \, w(1)=1. \end{aligned}$$
(3.11)

with the exact solution is given as

$$\begin{aligned} w(v)=\frac{2}{(2-v)-v-1}. \end{aligned}$$
(3.12)

The nonlinear part is linearized by quasi-linearization we have

$$\begin{aligned} \frac{1}{2}\left( 1+v+w_{s+1} \right) ^{3}=\frac{1}{2}\left( \left( 1+v+w_{s}\right) ^{3}+3(w_{s+1}-w_{s})(1+v+w_{s})^{2}\right) . \end{aligned}$$
(3.13)

Using Eq. (3.13) in Eq. (3.11) and simplifying, we get

$$\begin{aligned} \frac{d^2w^{s+1}}{dv^2}-\frac{3}{2}\left( 1+v+w^{s}\right) ^{2}w^{s+1}= \frac{1}{2}\left\{ \left( 1+v+w^{s}\right) ^{3}+3w^{s}\left( 1+v+w^{s}\right) ^{2}\right\} , \end{aligned}$$
(3.14)

where s is number of iteration. The entries of matrix H and vector B for \(j=1,...,M\) then becomes

$$\begin{aligned} H= {\left\{ \begin{array}{ll} \Upsilon ^{''}{(r_{ij})}-\frac{3}{2}{(1+v_{i}+w^{s}_{i})^{2}}\Upsilon {(r_{ij})}, \quad &{}\hbox { }\ i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{}\hbox { }\ i={1,M}, \end{array}\right. } \end{aligned}$$
(3.15)

and vector B is

$$\begin{aligned} B={\left[ 0,\frac{1}{2}{(1+v_{i}+w^{s}_{i})}^{3}-\frac{3}{2}{(1+v_{i}+w^{s}_{i})}^{2}{w^{s}_{i},0}\right] }^{\textit{t}},\ \ ~ i=2,...,M-1. \end{aligned}$$
(3.16)

The unknowns \(\leftthreetimes _{j}\)’s are updated as

$$\begin{aligned} H \leftthreetimes ^{s+1}=B^{s}, \end{aligned}$$
(3.17)

providing initial guess \(w^{0}\), the approximate solution can be found using MQ, IMQ and Gaussain RBFs with \(c=0.2,0.4\) and 7, and number of collocation points \(M=64\). The computed results are compared with exact at various collocation points given in Table 3 where i shows index of nodal point \(v_{i}=\alpha +(i-1)dv\) and \(dv=(\beta -\alpha )/M\). It is clear from the table that the results of three RBFs are head to head with each other. The graphical solution and absolute error are plotted in Fig. 3 which shows well agreement between exact and computed solution.

Table 3 Comparison of absolute errors for problem 3
Fig. 3
figure 3

Solutions profile, and absolute errors for problem 3

3.2 Singular Perturbed Boundary Value Problem

Problem 4

Consider a second order perturbed value problem taken from [3].

$$\begin{aligned} \epsilon ~\frac{d^2w}{dv^2}+w=0, \qquad w(0)=0, \ \, w(1)=1, \end{aligned}$$
(3.18)

having exact solution

$$\begin{aligned} w(v)={\sin {(v/\sqrt{\epsilon })}}/{\sin {(1/\sqrt{\epsilon })}}, ~~\epsilon \ne (n\pi )^{-2}, \end{aligned}$$
(3.19)

where \(\epsilon \) is small positive parameter. Comparing Eq. (3.18) with Eq. (1.2), we have

$$\begin{aligned} L=\epsilon \frac{d^2}{dv^2}+1,~ h=0,~ N=0 \end{aligned}$$
(3.20)

In the proposed scheme (2.6), for \(j=1,...,M\) the matrix H has entries

$$\begin{aligned} H= {\left\{ \begin{array}{ll} \epsilon \Upsilon ^{''}{(r_{ij})}+\Upsilon {(r_{ij})}, \quad &{}\hbox { }\ i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{}\hbox { }\ i={1,M}, \end{array}\right. } \end{aligned}$$
(3.21)

and vector B is

$$\begin{aligned} B={\left[ 0,0,...,0,1\right] }^{\textit{t}}. \end{aligned}$$
(3.22)

The problem has been studied for different number of collocation points M and \(\epsilon \) using MQ(\(c=0.5\)), IMQ(\(c=1\)) RBFs. In Table 4 the computed maximum absolute errors are compared with [3]. From the table it is verified that RBFs results are superior than that of spline method given in [3]. Solution profile and absolute errors for \(M=64\) and \(\epsilon =1/64\) are displayed in Fig. 4 which shows that approximate RBF solution is reasonably accurate in the given domain.

Table 4 Comparison of absolute errors for problem 4
Fig. 4
figure 4

Solutions profiles, and absolute errors for problem 4

Problem 5

Consider second order singular perturbed problem [4]

$$\begin{aligned} -\epsilon \frac{d^2w}{dv^2}+w=v, \ \, 0\le v \le 1, \end{aligned}$$

where \(\epsilon \) is small positive parameter, and \(w=w(v)\) is smooth function. The corresponding boundary conditions are

$$\begin{aligned} w(0)=1, \quad \quad w(1)=1+\exp \left( \frac{-1}{\sqrt{\epsilon }}\right) . \end{aligned}$$

The analytical solution of the problem is

$$\begin{aligned} w(v)=v+\exp \left( \frac{-v}{\sqrt{\epsilon }}\right) . \end{aligned}$$

From given equation the operators are identified as

$$\begin{aligned} L=-\epsilon \frac{d^2}{dv^2}+1,~ h=v,~ N=0. \end{aligned}$$
(3.23)

In the proposed scheme (2.6), the matrix H has entries

$$\begin{aligned} H= {\left\{ \begin{array}{ll} -\epsilon \Upsilon ^{''}{(r_{ij})}+\Upsilon {(r_{ij})}, \quad &{} \forall j \,and\, i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{}{ \forall j \quad \,and\, \quad i={1,M}}, \end{array}\right. } \end{aligned}$$
(3.24)

and vector B is

$$\begin{aligned} B={\left[ 1,v_{2},...,v_{N-1},1+\exp \left( \frac{-1}{\sqrt{\epsilon }}\right) \right] }^{\textit{t}}. \end{aligned}$$
(3.25)

For numerical computation, we choose various values of \(\epsilon \) and collocation points M in order to compare our result with those given in [4]. Two different RBFs, MQ and Gaussian are used in this computation with \(c=0.26, 6.96\). The maximum absolute errors listed in Table 5 showing that the present method gives better accuracy than non-polynomial spline technique in [4]. It is also observed that the accuracy improves as number of collocation point increases. The approximate vs exact solution and absolute error for \(M=64\), \(\epsilon =1/64\) are displayed in Fig. 5 which shows good agreement between approximate and exact solution.

Table 5 Comparison of absolute errors for problem 5
Fig. 5
figure 5

Solution profiles, and absolute errors for problem 5

3.3 Obstical value problem

Problem 6

Consider the system of second order differential equation [23].

$$\begin{aligned} w^{''}(v)= {\left\{ \begin{array}{ll} 0, &{}{ \quad 0 \le v< \pi /4 },\\ w-1, &{} { \quad \pi /4 \le v \le 3\pi /4 },\\ 0, &{} { \quad 3\pi /4 < v \le \pi }, \end{array}\right. } \end{aligned}$$
(3.26)

subject to the boundary conditions \(w(0)=w(\pi )=0\), where \(w,~w^{'}\) are continuous at \(v=\pi /4, ~ 3\pi /4\). The exact solution of the system is given as

$$\begin{aligned} w(v)= {\left\{ \begin{array}{ll} \frac{4v}{\alpha _{1}}, &{} 0 \le v< \pi /4 ,\\ 1-\frac{4}{\beta _{1}}{\cosh (\frac{\pi }{2}-v)}, &{} \pi /4 \le v \le 3\pi /4 ,\\ \frac{4}{\alpha _{1}}{(\pi -v)}, &{} 3\pi /4 < v \le \pi , \end{array}\right. } \end{aligned}$$
(3.27)

where \(\alpha _{1}=\pi +4\coth {(\pi /4)}\) and \(\beta _{1}=\pi \sinh {(\pi /4)}+4\cosh {(\pi /4)}\).

In the proposed scheme (2.6), the matrix H is of the form

$$\begin{aligned} H=\left[ H_{1},H_{2},H_{3}\right] , \end{aligned}$$
(3.28)

where the entries of \(H_{1},~H_{2}\) and \(H_{3}\) for \(j=1,...,M\) are

$$\begin{aligned} H_{1}= & {} {\left\{ \begin{array}{ll} \Upsilon ^{''}{(r_{ij})}, \quad &{}i={2,...,M-1},\\ \Upsilon {(r_{ij})}, \qquad &{} {i={1,M}}, \end{array}\right. } \end{aligned}$$
(3.29)
$$\begin{aligned} H_{2}= & {} {\left\{ \begin{array}{ll} \Upsilon ^{''}{(r_{ij})}-\Upsilon {(r_{ij})}, \quad &{} {i={2,...,M-1}},\\ \Upsilon {(r_{ij})}, \qquad &{}{i={1,M}}, \end{array}\right. } \end{aligned}$$
(3.30)
$$\begin{aligned} H_{3}= & {} {\left\{ \begin{array}{ll} \Upsilon ^{''}{(r_{ij})}, \quad &{}{i={2,...,M-1}},\\ \Upsilon {(r_{ij})}, \qquad &{} {i={1,M}}. \end{array}\right. } \end{aligned}$$
(3.31)

The vector B can be written as

$$\begin{aligned} B=\left[ B_{1},B_{2},B_{3}\right] ^{\textit{t}}, \end{aligned}$$
(3.32)

where

$$\begin{aligned} B_{1}={\left[ w(0),0,...,0,w(\pi /4)\right] }^{\textit{t}},\end{aligned}$$
(3.33)
$$\begin{aligned} B_{2}={\left[ w(\pi /4),-1,...,-1,w(3\pi /4)\right] }^{\textit{t}},\end{aligned}$$
(3.34)
$$\begin{aligned} B_{3}={\left[ w(3\pi /4),0,...,0,w(\pi )\right] }^{\textit{t}}. \end{aligned}$$
(3.35)

The problem is solved in the given domain \([0,\pi ],\) for different number of collocation points M. Three different RBFs, MQ, IMQ and Gaussain have been used. In Table 6 the obtained maximum absolute errors are compared with the errors reported in [23]. From the table it is observed that MQ RBF gives better accuracy than IMQ and Gaussain RBFs when \(M=16\). However, as M increases the three RBFs produces nearly same accurate solution which is better than those reported in [23]. In Fig. 6 approximate solution and absolute errors are plotted for \(M=32\). From the figure it is shows that exact and approximate solution are in well agreement.

Table 6 Comparison of maximum absolute error for problem 6
Fig. 6
figure 6

Solutions profiles and absolute errors for problem 6

Problem 7

Consider a second order system of Eq. [5].

$$\begin{aligned} w^{''}(v)= {\left\{ \begin{array}{ll} -w(v)-1, &{}{ \quad 0 \le v \le \pi /4 },\\ 0, &{} { \quad \pi /4< v < 3\pi /4 },\\ -w(v)-1, &{} { \quad 3\pi /4 \le v \le \pi }, \end{array}\right. } \end{aligned}$$
(3.36)

the boundary conditions \(w(0)=w(\pi )=0\) and \(w,~w^{'}\) are continuous at \(v=\pi /4, ~ 3\pi /4\). The exact solution of the system is given by

$$\begin{aligned} w(v)= {\left\{ \begin{array}{ll} \cos (v)+\sin (v)-1, &{}{ \quad 0 \le v< \pi /4 },\\ \sqrt{2}-1, &{} { \quad \pi /4< v < 3\pi /4 },\\ \sin (v)-\cos (v)-1, &{} { \quad 3\pi /4 \le v \le \pi }, \end{array}\right. } \end{aligned}$$
(3.37)

The scheme for this problem can be easily derived by adjusting the entries of matrix H in Eqs. (3.283.31) and entries of vector B in Eqs. (3.323.33). The solution has been produced using MQ, IMQ and Gaussain RBFs for various number of collocation points M. The obtained maximum absolute errors are listed in Table 7. From this table it is noted that the three RBFs produce almost same accuracy. The computed solutions and point wise absolute errors are displayed in Fig. 7 for \(M=32\) which showing that computed solution approaches to the true solution.

Table 7 Comparison of absolute errors for problem 7
Fig. 7
figure 7

Solutions profile and absolute errors for problem 7

4 Conclusion

In this paper, a meshfree method using RBFs is formulated to solve various BVPs. The method is applied for the approximate solutions of second order linear and nonlinear BVPs, singular perturbed BVPs and obstacle BVPs. The scheme has been applied to seven test problems and the obtained results have been recorded in tabulated as well as in graphical forms. The performance of the method has been assessed in terms of absolute errors and number of collocation points. The reported results overall illustrate that present method gives better accuracy in comparison to existing methods available in literature. In light of calculated results, it is clear that RBFs scheme is suitable to apply for such problems.