# 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}}^{(7)}(x)\|\approx 1.5\times 10^{-7}\)._

**Example 2** (Hanging Bar Problem). : _We apply the collocation method on the hanging bar problem (14) and \(y(x)=e^{\pi}(x-1)^{2}\)[61]. The approximate solution \(y_{\mathrm{c}}(x)\) is computed as discussed in Section 3.1._

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

_Figure 3 shows the approximate solution \(y_{\mathrm{c}}^{(3)}(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}}^{(3)}(x)\)._

_We perform the least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24). Figure 4a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). Figure 4b shows the residual, absolute local approximation error, and the mean value for the last iteration. The mean value \(\overline{R_{3}}\) is below the threshold value \(10^{-6}\). The \(L^{2}\) norm of the approximation error \(\|y(x)-y_{\mathrm{c}}^{(3)}(x)\|\approx 5.82\times 10^{-9}\)._\[\max_{x\in[a,b]}\frac{1}{K_{i}}\left|y(x)-y_{h}^{(i)}(x)\right|\leq E_{i}.\]7 The approximating polynomial \(y_{\mathrm{c}}^{(3)}(x)\). A proper subset of the set of points \(\mathsf{S}\) is shown. \[\max_{x\in[a,b]}\frac{1}{K_{i}}\left|y(x)-y_{h}^{(i)}(x)\right|\leq E_{i}.\]8 (a) Fitting the upper bound (24) with the set \(\mathsf{R}\). (b) Visualization of the residual, absolute local approximation error, and the mean value. ### Boundary Value Problem

We discuss a number of stiff BVPs [8] based on the general linear second-order BVP

\[\max_{x\in[a,b]}\frac{1}{K_{i}}\left|y(x)-y_{h}^{(i)}(x)\right|\leq E_{i}.\]9

where \(a(x)>0\), \(b(x)\), \(c(x)\) are the coefficients, and \(f(x)\) is the source term. **Example 3**. : _We study the BVP (25) with \(a(x)=x+0.01\), \(b(x)=c(x)=0\), and \(f(x)=1\). The exact solution is_

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

_where \(\mathrm{c_{1}}=1/\ln(101)\) and \(\mathrm{c_{2}}=0\) are obtained from the boundary conditions \(y(0)=y(1)=0\). The exact solution experiences a boundary layer near \(x=0\)._

_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=10\) iterations and the number of points \(|\mathsf{S}|=2055\)._

_Figure 5a shows the approximate solution \(y_{\mathrm{c}}^{(10)}(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}}^{(10)}(x)\). We plot the statistic \(\omega_{i}\) as a function of the iteration index \(i\), \(i=2,3,\ldots,10\), in Figure 5b. It is observed that the oscillations are decaying and the statistic \(\omega_{i}\) is converging to an asymptotic value. The mean value \(\overline{\omega_{i}}\approx 0.64\)._

\[\|\mathbf{c}_{i}-\mathbf{y}_{i}\|_{1}<\delta,\qquad i=1,2,\ldots,\kappa.\]1 (a) Fitting the upper bound (24) with the set \(\mathsf{R}\). (b) Visualization of the residual, absolute local approximation error and the mean value. We perform the least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24). Figure 6a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). Figure 6b 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 demonstrates that fine partitions are formed near \(x=0\) due to the presence of the boundary layer. The mean value \(\overline{R_{10}}\) is below the threshold value \(10^{-6}\).