#### Abstract

A formulation of the fractional Legendre functions is constructed to solve the generalized time-fractional diffusion equation. The fractional derivative is described in the Caputo sense. The method is based on the collection Legendre and path following methods. Analysis for the presented method is given and numerical results are presented.

#### 1. Introduction

We consider the generalized time-fractional diffusion equation of the form with initial and boundary conditions where , , , , , , and . For , the fractional diffusion equation is reduced to a conventional diffusion-reaction equation which is well studied, so we focus on . Some existence and uniqueness results of Problem (1)-(2) were established in [1]. In recent years, great interests were devoted to the analytical and numerical treatments of fractional differential equations (FDEs). Usually, FDEs appear as generalizations to existing models with integer derivative and they also present new models for some physical problems [2, 3]. In general, FDEs do not possess exact solutions in closed forms, and, therefore, numerical methods such as the variational iteration (VIM) [4, 5], the homotopy analysis method (HAM) [6, 7], and the Adomian decomposition method (ADM) [8, 9] have been implemented for several types of FDEs. Also, the maximum principle and the method of lower and upper solutions have been extended to deal with FDEs and obtain analytical and numerical results [10, 11]. The Tau method, the pseudospectral method, and the wavelet method based on the Legendre polynomials have been implemented for several types of FDEs [12ā14]. Kazem et al. [12] have constructed the Legendre functions of fractional order and discussed some of their properties. The resulting Legendre function operational and product matrices, together with the Tau method, have been implemented to solve linear and nonlinear fractional differential equations. The effectiveness of the approach has been examined through several examples. In [13], a fractional diffusion equation is considered, where the fractional derivative of order refers to the spatial variable . The Legendre pseudospectral method is implemented to solve the problem, where the solution is expanded with regular Legendre polynomials. As a result, a system of linear equation has been obtained and integrated using the finite difference method. However, in solving fractional differential equations of order using series expansions, it is common and more efficient to expand the solution with fractional functions of the form . Rawashdeh [14] has implemented the Legendre wavelets method for integrodifferential equations with fractional order.

The Legendre collocation method has been implemented for wide classes of differential equations and the effectiveness of the method is illustrated [15]. In the recent work, we intend to apply the collocation method based on the shifted fractional Legendre functions to integrate the Problem (1)-(2). To the best of our knowledge, the method has not been developed to integrate fractional diffusion equations of the form (1)-(2). We organize this paper as follows. In Section 2, we present basic definitions and results of fractional derivative. In Section 3, we present the numerical technique for solving Problem (1)-(2). In Section 4, we present some numerical results to illustrate the efficiency of the presented method. Finally we conclude with some comments in Section 5.

#### 2. Preliminaries

In this section, we present the definition and some preliminary results of the Caputo fractional derivative, as well as the definition of the fractional-order Legendre functions and their properties.

*Definition 1. *A real function , , is said to be in the space , , if there exists a real number , such that , where , and it is said to be in the space if , .

*Definition 2. *The left Riemann-Liouville fractional integral of order , of a function , , is defined by

*Definition 3. *For , , , , and , the left Caputo fractional derivative is defined by
where is the well-known Gamma function.

The Caputo derivative defined in (4) is related to the Riemann-Liouville fractional integral, , of order , by . The Caputo fractional derivative satisfies the following properties for , , and (see [16]):(1), (2), (3), where is constant,(4), (5), where are constants.

The basic concept of this paper is the Legendre polynomials. For this reason, we study some of their properties.

*Definition 4. *The Legendre polynomials are the eigenfunctions of the Sturm-Liouville problem:

Among the properties of the Legendre polynomials we list the following [19]:(1), where ,(2), for ,(3).

In order to use these polynomials on the interval , we define the shifted Legendre polynomials by . Using the change of variable , has the following properties:(1), (2), for ,(3) and .

The analytic closed form of the shifted Legendre polynomials of degree is given by

One of the common and efficient methods for solving fractional differential equations of order is using series expansion of the form . For this reason, we define the fractional-order Legendre function by . Using the properties of the shifted Legendre polynomials, it is easy to verify that [20](1), ,(2), for ,(3) and ,(4) and .

In addition, are orthogonal functions with respect to the weight function on with

The closed form of is given by

Using properties (4) and (5) of the Caputo fractional derivative, we have

The following result is important, since it facilitates applying the collection method.

Theorem 5. *Let and let be a piecewise continuous function on . Then,*(i)* can be represented by infinite series expansion as , where
*(ii)* converges uniformly on to , where and , for and ā.*

*Proof. *(i) Since and is a piecewise continuous function on ,āā converges uniformly to on , where can be computed by the orthogonality relation of the Legendre polynomials; see [11]. Since , defined by , is a bijection continuous function, the infinite series converges uniformly to on , where the value of follows from the orthogonality relation of with respect to the weight function on , which completes the proof.

(ii) Let for . From Part (i), converges uniformly to on . Since and is a piecewise continuous function on ,
and converges uniformly to on . Thus, converges uniformly to on which gives the result of the second part. The value of follows from the orthogonality relation of with respect to the weight function on .

#### 3. Collocation Method

In this section, we use the fractional-order Legendre collocation method to discretize Problem (1)-(2). For simplicity, we assume that and . If , we use the change of variable to make the -domain (0,1). Expand the solution in terms of the fractional-order Legendre function as follows: Thus, where for . Therefore, for , the residual is given by

Orthogonalize the residual with respect to the Dirac delta function as follows: where are the collocation points. We choose the collocation points to be the roots of . Therefore, (15) leads to the elementwise equation: or Let

Thus, we can rewrite (17) in the matrix form as where Since for , it is easy to see that , where is matrix. Therefore, System (19) becomes

Now, we study the boundary conditions on the variable . From (12), one can see that which implies that where . From Systems (21) and (23), we obtain the following fractional system: where

From (2) and (12), we see that

Using the orthogonality property of the Legendre polynomials, we get

Therefore, our initial fractional value problem becomes where

To solve the System (28)-(29), we use the fractional-order Legendre collocation method. Approximate the solution in terms of the fractional-order Legendre function as follows: Thus, where , and , for and . Therefore, for , the residual is given by

Orthogonalize the residual with respect to the Dirac delta function as follows: where are the collocation points. We choose the collocation points to be where are the roots of . Therefore, (34) leads to the elementwise equation: or Let

Thus, we can rewrite (37) in the matrix form as where

Since , it is easy to see that , whereand for and . Therefore, System (19) becomes

Now, we study the initial condition on the variable . From (29), one can see that which implies that where . From Systems (21) and (23), we obtain the following linear system: where Finally, we use Mathematica to solve the above linear system.

#### 4. Numerical Results

In this section, we implement the proposed numerical technique for four examples.

*Example 1. *Consider the fractional diffusion equation:
where is the Mittag-Leffler function. Since for , it is easy to see that the exact solution is
The exact solution for is
The approximate solutions generated by the proposed method are presented in Figure 1, for different values of and . Figure 2 depicts the exact solution (red) and the approximate solution (green) for , and . Define the error
where is the approximate solution generated by the proposed method for . Table 1 presents the error for different values of .

**(a)**

**(b)**

**(c)**

**(d)**

*Example 2. *Consider the fractional diffusion equation:
where is the exact solution. The approximate solutions generated by the proposed method are presented in Figure 3 for different values of and . Figure 4 depicts the exact solution (red) and the approximate solution (green) for and .

Table 2 presents the error for different values of .

**(a)**

**(b)**

**(c)**

**(d)**

*Example 3. *Consider the fractional diffusion equation presented in [17]:
The exact solution is
To apply the proposed method, we shall do the following change of variable . In this case, the -domain becomes . The approximate solutions generated by the proposed method and the exact solution are presented in Figure 5 for and at and . Table 3 presents a comparison between the error in our results and the ones obtained by the finite difference method (FDM) [17] for and .

**(a)**

**(b)**

*Example 4. *Consider the fractional diffusion equation presented in [18]:
The exact solution is
To apply the proposed method, we will do the following change of variable . In this case, the -domain becomes . To make a comparison with the results of [18], assume that , , and are the errors in [18] using uniform mesh, quasiuniform mesh, and nonuniform mesh for . Let be the error in the proposed method for and . Results are presented in Table 4.

#### 5. Conclusion

In this paper, we use series expansion based on the shifted fractional Legendre functions to solve fractional diffusions equations of Caputoās type. We write the coefficients of the fractional derivative in terms of the shifted fractional Legendre functions as indicated in Theorem 5 and give explicit relationship between them. Then, we use the collocation method to compute these coefficients. To the best of our knowledge, the method has not been developed to integrate fractional diffusion equations of the form (1)-(2). We test the proposed technique for several examples and present four of them in this paper. These examples show the efficiency and the accuracy of the proposed method, where in few terms we achieved accuracy up to . In Examples 3 and 4, we compare our results with the ones obtained by FDM in [17, 18]. Both examples show that the proposed method works more efficiently and accurately than the methods in [17, 18].

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgment

The authors would like to express their sincere appreciation to United Arab Emirates University for the financial support of Grant no. 21S074.