# Finite Difference/Collocation Method for a Generalized Time-Fractional KdV Equation
## 4 Numerical Results and Analysis  
In Section 3.3, we proved the stability of the proposed scheme in the linear case. Following numerical examples will show that our algorithm is also available in the nonlinear case. In this part, two numerical examples are provided to demonstrate the effectiveness of the finite difference/collocation scheme. The initial and boundary conditions are given to establish an exact solution in the first example to analyze error and convergence numerically. In the second example, the initial condition is taken as a hyperbolic sine function and the boundary condition is homogenous. For convenience, we take the weight function \(w\left(t\right)=1\) in the following part. **Example 1**. : _Consider the generalized fractional KdV Equation (10) with following initial and boundary conditions_  
\[\left\{ \begin{array}{l}u\left(x,0\right)=x\left(1-x\right)^{2},\ x\in[0,1], \\ u\left(0,t\right)=u\left(1,t\right)=0,\ t\in[0,1],\\ u_{x}\left(1,t\right)=0,\ t\in[0,1].\end{array} \right. \tag{43}\]  
_With the above conditions, by taking_  
\[f\left(x,t\right)=g(t)x\left(1-x\right)^{2}+\xi\left(1-t^{6}\right)^{2}\left(3 x^{5}-10x^{4}+12x^{3}-6x^{2}+x\right)+6\delta\left(1-t^{6}\right),\]  
_the problem (10) has the exact solution of form_  
\[u\left(x,t\right)=\left(1-t^{6}\right)x\left(1-x\right)^{2}. \tag{44}\]  
_Here, we choose \(\xi=6\), \(\delta=1\), \(\gamma=\beta=1\) and \(g(t)=\frac{-\Gamma(7)}{\Gamma(7-\alpha)}t^{6-\alpha}\) for \(z(t)=t\), \(g(t)=\frac{-\Gamma(13)}{\Gamma(13-\alpha)}t^{6-\alpha/2}\) for \(z(t)=\sqrt{t}\), and \(g(t)=\frac{-6}{\Gamma(4-\alpha)}t^{6-2\alpha}\) for \(z(t)=t^{2}\), respectively. When \(z\left(t\right)=t\), the generalized fractional derivative in (10) is the classical Caputo fractional derivative._  
**Example 2**. : _Consider the generalized fractional KdV Equation (10) with following initial and boundary conditions_  
\[\left\{ \begin{array}{l}u(x,0)=\frac{1}{2}sech^{2}\left(\frac{1}{2}x\right),\ \ x\in[-10,10]\\ u(-10,t)=u(10,t)=0,\ \ t\in[0,T],\\ u_{x}\left(10,t\right)=0,\ \ t\in[0,T].\end{array} \right. \tag{45}\]  
_Here, we set \(f\left(x,t\right)=0\). When \(\alpha=1\), this problem has a soliton solution in the form of \(u\left(x,t\right)=0.5\) sech\({}^{2}\left(0.5\left(x-t\right)\right)\) in case \(\xi=6\) and \(\delta=1\) (see [5])._  
Applying the proposed finite difference/collocation scheme, we obtain the numerical solutions over the domain under different situations. Firstly, letting \(z\left(t\right)=t\), the generalized fractional derivative in (10) is equivalent to the Caputo fractional derivative. Figure 2 shows the influence of \(\delta\) and \(\alpha\) under conditions of \(T=2\), \(\xi=6\). By fixing \(\alpha=0.8\), diffusion processes with \(\delta=0.2\) and \(\delta=1\) are illustrated. It is shown that when \(\delta\) is small, the soliton (initial condition) will be decomposed to neighboring solitons, whose amplitudes are affected by the fractional derivative \(\alpha\). This decomposing phenomenon cannot be observed when \(\delta\) becomes larger. In the case of \(\delta=1\), the soliton wave does not move much with \(0<t<2\) as expected, and with the decreasing of \(\alpha\), the amplitudes are getting smaller. Next, numerical results with different scale functions \(z\left(t\right)=t^{0.5}\), \(t\), \(t^{2}\) and \(t^{5}\) are shown in Figure 3 when \(T=1\). Denoting \(z\left(t\right)=t^{s}\), \(0\leq t\leq 1\), scale function \(z\left(t\right)\) behaves like a \"contracting function\" for the time variable over domain \([0,1]\) when \(s>1\), while behaving like a \"stretching function\" as \(s<1\) (see [25]). From Figure 3, when \(s=0.5\), decomposing and diffusion phenomena appeared earlier in contrast with the case when \(s=1\), just like being contracted. On the contrary, thedecomposing process works quite slowly when \(s>1\). Moreover, the speed of decomposing is slower as \(s\) becomes larger.