# Adaptive Piecewise Poly-Sinc Methods for Ordinary Differential Equations
## 4 Adaptive Piecewise Poly-Sinc Algorithm
### Error Analysis
The exact solution follows as_

\[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)| =\|y(x)-y_{\mathrm{c}}^{(i)}(x)\|_{1}\]3

_The exact solution has a shock layer near \(x=0\)[66]. We set \(\epsilon=10^{-6}\)[67]._

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

_Figure 18a shows the approximate solution \(y_{\rm c}^{(16)}(x)\). A proper subset of the set of points \(\mathsf{S}\) is shown as red dots, which are projected onto the approximate solution \(y_{\rm c}^{(16)}(x)\). We plot the statistic \(\omega_{i}\) as a function of the iteration index \(i,\;i=2,3,\ldots,16\), in Figure 18b. The oscillations are decaying and the statistic \(\omega_{i}\) is converging to an asymptotic value. The mean value \(\overline{\omega_{i}}\approx 0.55\)._

_We perform the least-squares fitting of the logarithm of the set \(\mathsf{R}\) to the logarithm of the upper bound (24), where the parameter \(\delta\) is multiplied by the factor \(10^{-9}\) and \(10^{-9}\delta=O(10^{-12})\). Figure 19a shows the least-squares fitted model (24) to the set \(\mathsf{R}\). The residual, absolute local approximation error, and the mean value for the last iteration are shown in Figure 19b. The plot of the \(L^{2}\) norm values of the residual over the partitions show that fine partitions are formed near \(x=0\) due to the presence of the shock layer. The mean value \(\overline{R_{16}}\) is below the threshold \(\varepsilon_{\rm stop}=10^{-11}\)._

_We compare the supremum norm of the approximation error of our adaptive piecewise Poly-Sinc method with other methods in \[\max_{x\in[a,b]}|y(x)-y_{\mathrm{c}}^{(i)}(x)| =\|y(x)-y_{\mathrm{c}}^{(i)}(x)\|_{1}\]4 \(B-\)splines were used as basis functions [67]. The supremum \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Method** & **Adaptive PW PS** & **[**28**]** & **([**65**] Table 13(g))** \\ \hline \(\|y(x)-y_{\rm method}(x)\|\) & \(1.104\times 10^{-14}\) & \(3\times 10^{-5}\) & \(1.9\times 10^{-12}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of the \(L^{2}\) norm of the approximation error for different methods. Figure 17: (**a**) Fitting the upper bound (24) with the set \(\mathsf{R}\). (**b**) Visualization of the residual, absolute local approximation error, and the mean value. norm result is in the same order as that of [67]. Our adaptive method can reach a smaller value if we set \(\varepsilon_{\text{stop}}<10^{-11}\)._

We observe that the processing times differ among the many problems we look at. This is due to two factors: first, the fact that we are aiming for a very exact outcome; and second, the fact that there are many sorts of challenges. Therefore, listing the computing time in seconds is meaningless since it would only indicate the computational power used on our machine, which will vary for various users. Overall, it is evident that using adaptive techniques takes longer than using a simple collocation approach or finite element methods with a lower accuracy. In our examples, we used a stopping criterion of \(10^{-6}\) or less. As a result, our goal is to complete the computation in the most accurate way feasible rather than the quickest way possible. This will inevitably lengthen the processing time for some problems, such as stiff or layer problems. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Method** & **Adaptive PW PS** & **[67]** \\ \hline \(\|y(x)-y_{\text{method}}(x)\|_{\infty}\) & \(1.215\times 10^{-10}\) & \(4.3\times 10^{-10}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison of the supremum norm of the approximation error for different methods. Figure 19: (a) Fitting the upper bound (24) with the set R. (b) Visualization of the residual, absolute local approximation error, and the mean value. Figure 18: (a) The approximating polynomial \(y_{\text{c}}^{(16)}(x)\). A proper subset of the set of points S is shown.