# Adaptive Piecewise Poly-Sinc Methods for Ordinary Differential Equations
## 4 Adaptive Piecewise Poly-Sinc Algorithm
### Error Analysis
The \(L^{2}\) norm of the approximation error \(\|y(x)-y_{\mathrm{c}}^{(10)}(x)\|\approx 1.12\times 10^{-8}\). The threshold value in [8] is \(0.05\). We study the BVP (25) with \(a(x)=0.01\), \(b(x)=0\), \(c(x)=1\), and \(f(x)=1/x\). Using the variation of parameters method [62], the exact solution of this problem is

\[\|\mathbf{c}_{i}-\mathbf{y}_{i}\|_{1}<\delta,\qquad i=1,2,\ldots,\kappa.\]2

where \(\operatorname{Ei}(x)=\int_{-\infty}^{x}\frac{\exp(t)}{t}\,\mathrm{d}t\) is the exponential integral function [55] and

\[\|\mathbf{c}_{i}-\mathbf{y}_{i}\|_{1}<\delta,\qquad i=1,2,\ldots,\kappa.\]3

The exact solution \(y(x)\) experiences a boundary layer near \(x=0\) and a slope change at approximately \(x=0.5\). Equation (25) is multiplied by the factor \(x\) so that the residual \(R(x)\) does not contain a singularity at \(x=0\). We set the number of Sinc points to be inserted in all partitions as \(m=2N+1=5\). The stopping criterion \(\varepsilon_{\mathrm{stop}}=10^{-6}\) was used. The algorithm terminates after \(\kappa=9\) iterations and the number of points \(|\mathsf{S}|=1630\). We perform the least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24). Figure 7a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). Figure 7b shows the residual, absolute local approximation error, and the mean value for the last iteration. The plot of the \(L^{2}\) norm values of the residual over the partitions shows that fine partitions are formed near \(x=0\) due to the presence of the boundary layer. The mean value \(\overline{R_{9}}\) is below the threshold value \(10^{-6}\). The \(L^{2}\) norm of the approximation error \(\|y(x)-y_{\mathrm{c}}^{(9)}(x)\|\approx 1.6\times 10^{-6}\). The threshold value in [8] is \(0.01\). The approximating polynomial \(y_{\mathrm{c}}^{(9)}(x)\) and a proper subset of the set of points \(\mathsf{S}\) are shown in Figure 8a. The corresponding plot for the statistic \(\omega_{i}\) at is shown in Figure 8c. The oscillations are decaying and the mean value \(\overline{\omega_{i}}\approx 0.66\). It was mentioned that Equation (25) was multiplied by the factor \(x\) so that the residual \(R(x)\) does not contain a singularity at \(x=0\). We replace the residual \(R(x)\) with the quantity \(y(x)-y_{\mathrm{c}}(x)\) in Algorithm 4 and the BVP (25) contains the term \(1/x\). We set the number of Sinc points to be inserted in all partitions as \(m=2N+1=5\). The stopping criterion \(\varepsilon_{\mathrm{stop}}=10^{-6}\) was used. The algorithm terminates after \(\kappa=8\) iterations and the

\[\|\mathbf{c}_{i}-\mathbf{y}_{i}\|_{1}<\delta,\qquad i=1,2,\ldots,\kappa.\]4 (**a**) Fitting the upper bound (24) with the set \(\mathsf{R}\). (**b**) Visualization of the residual, absolute local approximation error, and the mean value. number of points \(|\mathsf{S}|=730\), which is smaller than the one obtained from multiplying the residual by \(x\). This is expected since the exact solution \(y(x)\) is used. The approximating polynomial \(y_{\mathsf{c}}^{(8)}(x)\) and a proper subset of the set of points \(\mathsf{S}\) are shown in Figure 8b. The corresponding plot for the statistic \(\omega_{i}\) is shown in Figure 8d. The mean value \(\overline{\omega_{i}}\approx 0.61\). It is observed that the statistic \(\omega_{i}\) oscillates around the mean \(\overline{\omega_{i}}\approx 0.61\)._

**Example 5**. : _We study a variation of Example 4, in which the source term \(f(x)=\frac{1}{\sqrt{x}}\). Even though the source term has a singularity at \(x=0\), its definite integral over the domain \([0,1]\) is finite. The exact solution [62] is

\[\|\mathbf{c}_{i}-\mathbf{y}_{i}\|_{1}<\delta,\qquad i=1,2,\ldots,\kappa.\]5 Visualization of the approximating polynomial and statistic \(\omega_{i}\). (**a**) Approximating polynomial \(y_{\mathsf{c}}^{(9)}(x)\) obtained by multiplying Equation (25) by \(x\). (**b**) Approximating polynomial \(y_{\mathsf{c}}^{(8)}(x)\) obtained by \(y(x)-y_{\mathsf{c}}(x)\). (**c**) Plot of \(\omega_{i},\,i=2,3,\ldots,9\).