# Adaptive Piecewise Poly-Sinc Methods for Ordinary Differential Equations
## 4 Adaptive Piecewise Poly-Sinc Algorithm
### Error Analysis
The exact solution [62] is_

\[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)|\leq K_{i}\,E_{i}+\delta\bigg{(} \frac{1}{\pi}\ln(\overline{\overline{m}})+1.07618\bigg{)},\]0 \[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)|\leq K_{i}\,E_{i}+\delta\bigg{(} \frac{1}{\pi}\ln(\overline{\overline{m}})+1.07618\bigg{)},\]1

_where_

\[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)|\leq K_{i}\,E_{i}+\delta\bigg{(} \frac{1}{\pi}\ln(\overline{\overline{m}})+1.07618\bigg{)},\]2

_and_

\[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)|\leq K_{i}\,E_{i}+\delta\bigg{(} \frac{1}{\pi}\ln(\overline{\overline{m}})+1.07618\bigg{)},\]3

_We set the number of Sinc points to be inserted in all partitions as \(m=2N+1=5\). The stopping criterion \(\epsilon_{\mathrm{stop}}=10^{-6}\) was used. The algorithm terminates after \(\kappa=8\) iterations and the number of points \(|\mathsf{S}|=605\)._

_Figure 11a shows the approximate solution \(y_{\mathrm{c}}^{(8)}(x)\). A proper subset of the set of points \(\mathsf{S}\) is shown as red dots, which are projected onto the approximate solution \(y_{\mathrm{c}}^{(8)}(x)\). We plot the statistic \(\omega_{i}\) as a function of the iteration index \(i\), \(i=2,3,\ldots,8\), in Figure 11b. The oscillations are decaying and the statistic \(\omega_{i}\) is converging to an asymptotic value. The mean value \(\overline{\omega_{i}}\approx 0.65\).__We perform the least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24). Figure 12a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). Figure 12b shows the residual, absolute local approximation error, and the mean value for the last iteration. The mean value \(\overline{\mathsf{R}_{8}}\) is below the threshold value \(10^{-6}\). The \(L^{2}\) norm of the approximation error \(\|y(x)-y_{\mathrm{c}}^{(10)}(x)\|\approx 3.1\times 10^{-7}\)._

**Example 7**. : _We study the BVP (25) with \(a(x)=0.02\), \(b(x)=1\), \(c(x)=0\), and \(f(x)=1\). The exact solution is given by_

\[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)|\leq K_{i}\,E_{i}+\delta\bigg{(} \frac{1}{\pi}\ln(\overline{\overline{m}})+1.07618\bigg{)},\]4

_where \(\mathrm{c}_{1}=-\mathrm{c}_{2}=\frac{1}{-1+\exp(50)}\). The solution \(y(x)\) has a boundary layer near \(x=1\)._

_We set the number of \(\mathrm{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}|=1055\)._

_Figure 13a shows the approximate solution \(y_{\mathrm{c}}^{(9)}(x)\). A proper subset of the set of points \(\mathsf{S}\) is shown as red dots, which are projected onto the approximate solution \(y_{\mathrm{c}}^{(9)}(x)\). We plot the statistic \(\omega_{i}\) as a function of the iteration index \(i\), \(i=2,3,\ldots,9\), in Figure 13b. The oscillations are decaying and the statistic \(\omega_{i}\) is converging to an asymptotic value. The mean value \(\overline{\omega_{i}}\) is \(0.62\).__We perform the least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24). Figure 14a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). Figure 14b 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=1\) due to the presence of the boundary layer. One observation is that the mean value \(\overline{\mathsf{R}_{9}}\) is below the threshold value \(10^{-6}\). The \(L^{2}\) norm of the approximation error \(\|y(x)-y_{\mathsf{c}}^{(9)}(x)\|\approx 2.36\times 10^{-8}\) and the threshold value in [8] is \(0.02\)._

_In this example, we increase the number of points per partition to \(m=2N+1=7\) to examine the effect of the increase on the convergence of the algorithm. The algorithm terminates after \(\kappa=5\) iterations and the number of points \(|\mathsf{S}|=350\).