# Finite Difference/Collocation Method for a Generalized Time-Fractional KdV Equation
## 2 Preliminaries of Fractional Calculus and Jacobi Polynomials
### Numerical Discretization in the Space Direction  
As the homogeneous Neumann condition is included in the boundary conditions, we choose a type of polynomial as \(\tilde{p}\left(x\right)=\left(b-x\right)p\left(x\right)\) to approximate to the \(u\left(x,t\right)\) in the space direction. In our problem, we set that \(p\left(x\right)\) is a combination of Jacobi polynomials of degree \(\leq N\), and \(\tilde{p}\left(x\right)\) satisfies the Equation (10) exactly at \(x_{j},j=1,\cdots,N-1\) and boundary condition at \(x_{0}\) and \(x_{N}\). \(\left\{x_{j},j=0,\cdots,N\right\}\) are Jacobi-Gauss-Lobatto (JGL) nodes on \([a,b]\) by introducing the change of variable  
\[x_{j}=\frac{b-a}{2}\left(x_{j}^{\gamma,\beta}+1\right)+a,\ \ 0\leq j\leq N,\]  
where \(\left\{x_{j}^{\gamma,\beta}\right\},j=0,\cdots,N\) are JGL points on \([-1,1]\). Based on the analysis above, we take  
\[\psi_{n}\left(x\right)=\left(b-x\right)\int_{n}^{\gamma,\beta}\left(x\right),\ \ \ j=0,1,\cdots,N, \tag{23}\]  
as the basis functions in the space direction. Then, the numerical solution of problem (10) has the form:  
\[u_{N}\left(x,t\right)=\sum_{n=0}^{N}\phi_{n}\left(t\right)\psi_{n}\left(x \right), \tag{24}\]  
satisfying  
\[\sum_{n=0}^{N}\phi_{n}\left(t\right)\int_{n}^{\gamma,\beta}\left( x_{0}\right)=0, \tag{25}\] \[\sum_{n=0}^{N}\phi_{n}\left(t\right)\int_{n}^{\gamma,\beta}\left( x_{N}\right)=0, \tag{26}\]  
for any \(t\in[0,T]\). Substituting (24) to the semi-discretization (22), we have  
\[\sum_{n=0}^{N}\left\{\frac{1}{\eta_{k}}a_{k}w_{k}\phi_{n}\left(t_ {k}\right)\psi_{n}\left(x\right)+\xi u_{N}\left(x,t_{k-1}\right)\phi_{n}\left( t_{k}\right)[\psi_{n}\left(x\right)]^{\prime}+\delta\phi_{n}\left(t_{k}\right)[ \psi_{n}\left(x\right)]^{\prime\prime\prime}\right\}\\ =\frac{1}{\eta_{k}}\sum_{n=0}^{N}\left[\sum_{i=1}^{k-1}\left(a_{i +1}-a_{i}\right)w_{i}\phi_{n}\left(t_{i}\right)+a_{1}w_{0}\phi_{n}\left(t_{0} \right)\right]\psi_{n}\left(x\right)+R_{k}+R_{s}+f^{k}\left(x\right), \tag{27}\]where \(f^{k}\left(x\right)=f\left(x,t_{k}\right)\) and \(R_{s}\) is the error in the space direction caused by replacing \(u\left(x,t\right)\) with \(u_{N}\left(x,t\right)\). The classical first- and third-order partial derivatives in (27) are derived as  
\[\left[\psi_{n}\left(x\right)\right]^{\prime}=\frac{\Gamma\left(n+2+\gamma+ \beta\right)}{\Gamma\left(n+\alpha+\beta+1\right)\left(b-a\right)}J_{n-1}^{ \gamma+1,\beta+1}\left(x\right)\left(b-x\right)-J_{n}^{\gamma,\beta}\left(x \right), \tag{28}\]  
\[\left[\psi_{n}\left(x\right)\right]^{\prime\prime\prime}=\frac{ \Gamma\left(n+4+\gamma+\beta\right)}{\Gamma\left(n+\alpha+\beta+1\right) \left(b-a\right)^{3}}J_{n-3}^{\gamma+3,\beta+3}\left(x\right)\left(b-x\right)\] \[-3\frac{\Gamma\left(n+3+\gamma+\beta\right)}{\Gamma\left(n+\alpha +\beta+1\right)\left(b-a\right)^{2}}J_{n-2}^{\gamma+2,\beta+2}\left(x\right). \tag{29}\]  
Neglecting the error parts, we obtain the full discretization scheme of Equation (10). For \(\left(x_{j},t_{k}\right)\in\left(a,b\right)\times\left(0,T\right]\), \(j=1,\cdots,N-1;k=1,\cdots,M\), it holds that  
\[\sum_{n=0}^{N}\left\{a_{k}\frac{1}{\eta_{k}}w_{k}J_{n}^{\gamma, \beta}\left(x_{j}\right)\left(b-x_{j}\right)+\xi u_{N}\left(x_{j},t_{k-1} \right)\left[c_{1}J_{n-1}^{\gamma+1,\beta+1}\left(x_{j}\right)\left(b-x_{j} \right)-J_{n}^{\gamma,\beta}\left(x_{j}\right)\right]\right.\] \[\left.+\delta\left[c_{3}J_{n-3}^{\gamma+3,\beta+3}\left(x_{j} \right)\left(b-x_{j}\right)-c_{2}J_{n-2}^{\gamma+2,\beta+2}\left(x_{j}\right) \right]\right\}\phi_{n}\left(t_{k}\right)\] \[=\sum_{n=0}^{N}\frac{1}{\eta_{k+1}}\left[\sum_{i=1}^{k-1}\left( a_{i+1}-a_{i}\right)w_{i}\phi_{n}\left(t_{i}\right)+a_{1}w_{0}\phi_{n}\left(t_{0} \right)\right]J_{n}^{\gamma,\beta}\left(x_{j}\right)\left(b-x_{j}\right)+f^{k} \left(x_{j}\right), \tag{30}\]  
where  
\[c_{p}=\frac{\Gamma\left(n+p+1+\gamma+\beta\right)}{\Gamma\left(n+\alpha+\beta +1\right)\left(b-a\right)^{p}},\quad p=1,2,3. \tag{31}\]