## 6 Algorithms for Solution of Finite Difference Algebraic Systems
### The IP2  
First, we will present the algorithm for IP2. After the full discretization, the obtained linear system of algebraic equations has the following canonical form:  
\[ \begin{split}& a_{i}U_{i-1}^{j+1}+c_{i}U_{i}^{j+1}+d_{i}U_{i+1}^{j +1}+k_{i}^{j+1}b_{i-1}^{j+1}+l_{i}^{j+1}b_{i+1}^{j+1}+r_{i}U_{1}^{j+1}+s_{i}U_{ N-1}^{j+1}=G_{i}^{j+1}\\ &\hat{a}_{i}b_{i-1}^{j+1}+\hat{c}_{i}b_{i}^{j+1}+\hat{d}_{i}b_{i+1 }^{j+1}+\hat{k}_{i}^{j+1}U_{i-1}^{j+1}+\hat{l}_{i}^{j+1}U_{i+1}^{j+1}=\hat{G}_{i }^{j+1}\\ & U_{0}^{j}=U_{N}^{j}=0,\ \ \ b_{0}^{j}=b_{N}^{j}=0\ \ \ j=1,2,\ldots,M,\\ & U_{i}^{0}=U_{0}(x_{i}),\ \ \ b_{i}^{0}=b_{0}(x_{i})\ \ \ i=0,1,2,\ldots,N,\end{split}  \tag{33}\]  
where  
\[ \begin{split}& a_{i}=d_{i}=-\frac{\
u}{2h^{2}},\ \ c_{i}=\frac{1}{\tau}+\frac{\
u}{h^{2}},\ \ k_{i}^{j+1}=-l_{i}^{j+1}=\frac{\beta^{j+1/2}}{4h},\ \ r_{i}=s_{i}=-\frac{\
u}{2 Xh},\\ &\hat{a}_{i}=\hat{d}_{i}=-\frac{\
u_{m}}{2h^{2}},\ \ \hat{c}_{i}=\frac{1}{\tau}+\frac{\
u_{m}}{h^{2}},\ \ \hat{k}_{i}^{j+1}=-\hat{l}_{i}^{j+1}=\frac{\beta^{j+1/2}}{4h},\\ & G_{i}^{j+1}=\frac{1}{\tau}U_{i}^{j}+\frac{\
u}{2}\frac{U_{i-1}^ {j}-2U_{i}^{j}+U_{i+1}^{j}}{h^{2}}+\frac{\beta^{j+1/2}}{2}\frac{b_{i+1}^{j}-b_ {i-1}^{j}}{2h}+\frac{E^{\prime}(t^{j+1/2})}{X}\\ &\quad-\frac{\
u}{2X}\bigg{(}\frac{U_{N}^{j}-U_{N-1}^{j}}{h}- \frac{U_{1}^{j}-U_{0}^{j}}{h}\bigg{)}-\Big{(}\Big{(}1-\frac{x_{i}}{X}\Big{)}u_ {i}^{\prime}(t^{j+1/2})+\frac{x_{i}}{X}u_{r}^{\prime}(t^{j+1/2})\Big{)},\\ &\hat{G}_{i}^{j+1}=\frac{1}{\tau}b_{i}^{j}+\frac{\
u_{m}}{2}\frac {b_{i-1}^{j}-2b_{i}^{j}+b_{i+1}^{j}}{h^{2}}+\frac{\beta^{j+1/2}}{2}\frac{U_{i +1}^{j}-U_{i-1}^{j}}{2h}\\ &\quad-\frac{\beta^{j+1/2}}{X}\Big{(}u_{l}(t^{j+1/2})-u_{r}(t^{j+ 1/2})\Big{)}-\Big{(}(1-\frac{x_{i}}{X})B_{l}^{\prime}(t^{j+1/2})+\frac{x_{i}}{ X}B_{r}^{\prime}(t^{j+1/2})\Big{)}.\end{split}  \tag{34}\]  
We will seek the numerical solution \(\{U_{i}^{j},b_{i}^{j}\}\), \(i=1,\ldots,N-1\), \(j=1,\ldots,M\) in the following linear combinations (see also [7; 19]):  
\[U_{i}^{j} = \bar{U}_{i}^{j}+v_{i}^{j}U_{1}^{j}+w_{i}^{j}U_{N-1}^{j}, \tag{35}\] \[b_{i}^{j} = \bar{b}_{i}^{j}+\bar{v}_{i}^{j}b_{1}^{j}+\bar{w}_{i}^{j}b_{N-1}^{j}. \tag{36}\]  
Plugging (35), (36) into (33), we obtain three systems for the new unknown functions: \(\{\bar{U}_{i}^{j},\bar{b}_{i}^{j}v_{i}^{j},\,w_{i}^{j},\bar{v}_{i}^{j},\,\bar{ w}_{i}^{j}\}\):  
\[\begin{split}& a_{i}\bar{U}_{i-1}^{j+1}+c_{i}\bar{U}_{i}^{j+1}+d_{i} \bar{U}_{i-1}^{j+1}+k_{i}^{j+1}\bar{b}_{i-1}^{j+1}+l_{i}^{j+1}\bar{b}_{i+1}^{j+ 1  
\[ \begin{array}{l}a_{i}w_{i-1}^{j+1}+c_{i}w_{i}^{j+1}+d_{i}w_{i+1}^{j+1}+k_{i}^{j+1 }w_{i-1}^{j+1}+l_{i}^{j+1}w_{i+1}^{j+1}=-s_{i}^{j+1}\\ \hat{a}_{i}\bar{w}_{i-1}^{j+1}+\hat{c}_{i}\bar{w}_{i}^{j+1}+\hat{d}_{i}\bar{w}_ {i-1}^{j+1}+\hat{k}_{i}^{j+1}w_{i-1}^{j+1}+\hat{l}_{i}^{j+1}w_{i+1}^{j+1}=0\\ w_{1}^{\prime}=0,\ \ \ w_{N-1}^{j}=1,\ \ \ \bar{w}_{1}^{\prime}=0,\ \ \ \bar{w}_{N-1}^{ \prime}=1\ \ \ j=1,2,\ldots,M,\\ w_{i}^{0}=0,\ \ \ \bar{w}_{i}^{0}=0\ \ \ \ \ \ i=1,2,\ldots,N-1.\end{array}  \tag{39}\]  
We solve the systems (37)-(39) and obtain \(\{\Omega_{i}^{j},\bar{b}_{i}^{j},v_{i}^{j},w_{i}^{j},\bar{v}_{i}^{j},\bar{w}_{ i}^{j}\}\) for \(i=1,\ldots,N-1\). To find \(U_{1}^{j}\), \(U_{N-1}^{j}\), \(b_{1}^{j}\) and \(b_{N-1}^{j}\), we input (35), (36) into (33) for \(i=1\) and \(i=N-1\). Taking into account that \(U_{0}^{j}=U_{N}^{j}=0\) and \(b_{0}^{j}=b_{N}^{j}=0\), the resulting system is  
\[