# Adaptive Piecewise Poly-Sinc Methods for Ordinary Differential Equations
## 4 Adaptive Piecewise Poly-Sinc Algorithm
### Error Analysis
(——————————



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

_where_

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

\(\text{erf}(x)=\frac{2}{\sqrt{\pi}}\int_{0}^{x}e^{-t^{2}}\,\mathrm{d}t\) (_[_55_] SS 7.1.1)_ is the error function, \(\text{erf}(x)\equiv-t\,\text{erf}(t\,x)=\frac{2}{\sqrt{\pi}}\int_{0}^{x}e^{t^ {2}}\,\mathrm{d}t\)[63], and \(t^{2}=-1\). The solution \(y(x)\) has a boundary layer near \(x=0\). Equation (25) is multiplied by the factor \(\sqrt{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_{\text{stop}}=10^{-6}\) was used. The algorithm terminates after \(\kappa=7\) iterations and the number of points \(|\mathsf{S}|=1183\). We performed least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24). Figure 9a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). Figure 9b shows the residual, absolute local approximation error, and the mean value for the last iteration. Fine partitions are formed near \(x=0\) due to the presence of the boundary layer, as seen in the plot of the \(L^{2}\) norm values of the residual over the partitions. The mean value \(\overline{R_{7}}\) is below the threshold value \(10^{-6}\). The \(L^{2}\) norm of the approximation error \(\|y(x)-y_{\mathsf{c}}^{(7)}(x)\|\approx 2.18\times 10^{-7}\). The approximating polynomial \(y_{\mathsf{c}}^{(7)}(x)\) and a proper subset of the set of points \(\mathsf{S}\) are shown in Figure 10a. The corresponding plot for the statistic \(\omega_{i}\) is shown in Figure 10c. The statistic \(\omega_{i}\) oscillates around the median value \(\tilde{\omegaomega_{i}}\approx 0.49\). It was mentioned that Equation (25) was multiplied by the factor \(\sqrt{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_{\mathsf{c}}(x)\) in Algorithm 4 and the BVP (25) contains the term \(1/\sqrt{x}\). We set the number of Sinc points to be inserted in all partitions as \(m=2N+1=5\). The stopping criterion \(\varepsilon_{\text{stop}}=10^{-6}\) was used. The algorithm terminates after \(\kappa=6\) iterations and the number of points \(|\mathsf{S}|=595\), which is smaller than the one obtained by multiplying the residual by \(\sqrt{x}\). This is expected since the exact solution \(y(x)\) is used. The approximating polynomial \(y_{\mathsf{c}}^{(6)}(x)\) and a proper subset of the set of points \(\mathsf{S}\) are shown in Figure 10b. The corresponding plot for the statistic \(\omega_{i}\) is shown in Figure 10d. The oscillations are decaying and the statistic \(\omega_{i}\) is converging to an asymptotic value. The mean value \(\overline{\omega_{i}}\) is \(0.58\). \[\|\mathbf{c}_{i}-\mathbf{y}_{i}\|_{1}<\delta,\qquad i=1,2,\ldots,\kappa.\]9 (**a**) Fitting the upper bound (24) with the set \(\mathsf{R}\). (**b**) Visualization of the residual, absolute local approximation error, and the mean value. **Example 6**. : _We study a variation of Example 4, in which the source term \(f(x)=\frac{\exp(x)-1}{x}\). The source term has a removable singularity at \(x=0\), since \(\lim\limits_{x\to 0}f(x)=1\). The algorithm can directly solve the BVP, even though the residual contains the term \(\frac{\exp(x)-1}{x}\).