1 Introduction

Bernstein polynomial basis plays an important role in computer graphics for geometric modeling, curve and surface approximation. Some interesting features have been investigated for this basis in the last decades; for instance, it is proven to be an optimal stable basis among nonnegative bases in a sense described in Farouki and Goodman (1996). Also, it provides some optimal shape-preserving features (Carnicer and Pena 1993). We refer to Farin et al. (2002), Farouki and Rajan (1988), Farouki (1991) for detailed properties and applications in computer-aided geometric design (CAGD).

Bernstein basis has also been used for the numerical solution of differential, integral, integro-differential and fractional differential equations; see e.g., Behiry (2014), Javadi et al. (2016a), Javadi et al. (2016b), Maleknejad et al. (2012), Saadatmandi (2014) and the references therein. However, it is not orthogonal and so leads to dense linear systems when using in numerical methods. Some numerical approaches implement the orthogonalized Bernstein basis. However, as we will see in the next section, it fails to keep some interesting properties of the Bernstein basis. Another approach uses the dual Bernstein polynomials (DBP) introduced by Juttler (1998). To the best of our knowledge, the DBP basis has been only discussed from the CAGD point of view (see the works of Lewanowicz and Wozny e.g. Lewanowicz and Wozny 2011, Wozny and Lewanowicz 2009). So, it is of interest to explore some new aspects of this basis to facilitate the numerical methods for differential equations that are based on Bernstein polynomials and to present a method for time fractional diffusion equation in two dimensions.

Fractional partial differential equations (FPDEs) have been widely used for the description of some important physical phenomena in many applied fields including viscoelastic materials, control systems, polymer, electrical circuits, continuum and statistical mechanics; see, for instance Dabiri and Butcher (2017), Goychuk (2009), Metzler and Klafter (2004), Moghaddam and Machado (2017), 2016 and the references therein. The subdiffusion equation is a FPDE describing the behavior of anomalous diffusive systems with the probability density of particles diffusing proportional to the mean square displacement \(\chi ^{2}(t)\propto t^{\alpha }\) with \(0<\alpha <1\) (Gao et al. 2012). Anomalous diffusion equations have been used for modeling transport dynamics, especially the continuous time random walk, the contamination in porous media, viscoelastic diffusion, etc (Gao et al. 2012, 2015; Goychuk 2009; Metzler and Klafter 2004; Wang and Wang 2016). For the numerical solution of the one-dimensional problem, we refer to Jin et al. (2016), Ren et al. (2013), Stokes et al. (2015), Zhou and Gong (2016) and the references therein. Some classic numerical methods for PDEs have been developed for the simulation of two-dimensional subdiffusion equation, for example the finite difference schemes (Gao et al. 2015; Pang and Sun 2016; Ren et al. 2013), meshless methods (Shirzadi et al. 2012; Yang et al. 2015), finite element method (Zhao et al. 2016) and alternating direction implicit methods (Zhang 2011; Zhang et al. 2012).

In this paper, deriving some new aspects of DBPs, we present suitable combinations of these functions to develop a dual-Petrov–Galerkin method for solving the following 2D subdiffusion equation (Wang and Wang 2016; Yang et al. 2015; Yang and Zhang 2014; Zhang 2011; Zhang et al. 2012; Zhao et al. 2016).

$$\begin{aligned} {D_{t}^{\alpha }}u\left( x,y,t\right) =\kappa \varDelta u\left( x,y,t\right) +S\left( x,y,t\right) ,\quad \left( x,y,t\right) \in \varOmega \times \left( 0,T\right] , \end{aligned}$$
(1.1)

with the following initial and boundary conditions:

$$\begin{aligned}&u\left( x,y,0\right) =g\left( x,y\right) ,\quad (x,y)\in \varOmega , \end{aligned}$$
(1.2)
$$\begin{aligned}&u\left( x,y,t\right) =0,\quad \left( x,y,t\right) \in \partial \varOmega \times \left( 0,T\right] , \end{aligned}$$
(1.3)

where \(\varOmega =\left( 0,1\right) ^{2}\subset {\mathbb {R}}^{2}\), \(\varDelta \) is the Laplacian operator, \(T>0\), \(\kappa \) is the diffusion coefficient and S is the source function. Here, \({D_{t}^{\alpha }}u\) denotes the Caputo fractional derivative of order \(\alpha ,\) \(0<\alpha <1\), with respect to t defined as

$$\begin{aligned} {D_{t}^{\alpha }}u\left( x,t\right) =\frac{1}{\varGamma \left( 1-\alpha \right) } \int _{0}^{t}{\frac{1}{\left( t-s\right) {}^{\alpha }}\frac{\partial u\left( x,s\right) }{\partial s}\mathrm{d}s},\quad 0<\alpha <1. \end{aligned}$$
(1.4)

The main contribution of our work is the development of an accurate Bernstein dual-Petrov–Galerkin method and the application for the numerical simulation of the 2D subdiffusion equation. It is shown that the method leads to sparse linear systems. To give a matrix approach of the method, we present some results concerning the DBPs including a recurrence formula for the derivative, constructing a new basis using DBPs, deriving the operational matrix of differentiation and also providing the transformation matrices between the DBPs and the new basis.

The paper is organized as follows: Sect. 2 presents some new aspects of DBPs and provides modal basis functions and the associated transformation matrices between the bases. Section 3 is devoted to the Bernstein spectral formulation of the subdiffusion problem (1.1)–(1.3) and the stability and convergence results are discussed in Sect. 4. Numerical examples are provided in Sect. 5. The paper ends with some concluding remarks in Sect. 6.

2 Bernstein polynomials and DBPs

The Bernstein polynomials with degree N on the unit interval are defined by

$$\begin{aligned} \phi _{i}(x)=\genfrac(){0.0pt}0{N}{i}x^{i}\left( 1-x\right) {}^{N-i},\qquad 0\le i\le N. \end{aligned}$$

The set \(\left\{ \phi _{i}\left( x\right) :\,i=0,\dots ,N\right\} \) forms a basis for \({\mathbb {P}}_{N}\), with the space of polynomials of degree not exceeding N.

These polynomials possess end-point interpolation property, i.e.,

$$\begin{aligned} \phi _{i}\left( 0\right) =\delta _{i,0},\quad \phi _{i}\left( 1\right) =\delta _{i,N},\quad 0\le i\le N,\,N>0. \end{aligned}$$
(2.1)

Also, the summation is one and the integral over the unit interval is constant, namely

$$\begin{aligned} \sum _{i=0}^{N}{\phi _{i}(x)}\equiv 1,\quad \int _{0}^{1}{\phi _{i}(x)} =\frac{1}{N+1},\,i=0,1,\dots ,N. \end{aligned}$$
(2.2)

The derivative enjoys the three-term recurrence relation (Jani et al. 2017)

$$\begin{aligned} \phi _{i}^{\prime }\left( x\right) =\left( N-i+1\right) \phi _{i-1} \left( x\right) -\left( N-2i\right) \phi _{i}\left( x\right) -\left( i+1\right) \phi _{i+1}\left( x\right) ,\quad 0\le i\le N, \end{aligned}$$
(2.3)

where we adopt the convention that \(\phi _{i}\left( x\right) \equiv 0\) for \(i<0\) and \(i>N\).

As we mentioned in the preceding section, the Bernstein basis is not orthogonal. The corresponding orthogonalized basis, obtained e.g., by the Gram–Schmidt process fails to keep some interesting aspects of the original basis. We will not consider this basis in the present work. Instead, we turn to the dual basis.

The DBPs are defined as

$$\begin{aligned} {\tilde{\psi }}_{i}\left( x\right) =\sum _{j=0}^{N}c_{i,j}\phi _{j}\left( x\right) , \end{aligned}$$
(2.4)

with the coefficients given by

$$\begin{aligned} c_{i,j} = \frac{(-1)^{i+j}}{\left( {\begin{array}{c}N\\ i\end{array}}\right) \left( {\begin{array}{c}N\\ j\end{array}}\right) } \sum _{r=0}^{\min \left( i,j\right) }\left( 2r+1\right) \left( {\begin{array}{c}N+r+1\\ N-i\end{array}}\right) \left( {\begin{array}{c}N-r\\ N-i\end{array}}\right) \left( {\begin{array}{c}N+r+1\\ N-j\end{array}}\right) \left( {\begin{array}{c}N-r\\ N-j\end{array}}\right) . \end{aligned}$$
(2.5)

It is verified that they satisfy the biorthogonal system (Juttler 1998, Theorem 3)

$$\begin{aligned} \int _{0}^{1}\phi _{i}\left( x\right) {\tilde{\psi }}_{j}\left( x\right) \mathrm{d}x = \delta _{ij},\quad 0\le i,j\le N. \end{aligned}$$
(2.6)

It is worth noting that less than a quarter of the entries of transformation matrix between the Bernstein and dual Bernstein basis \(C=[c_{i,j}]\), are to be computed directly by (2.5), for it is bisymmetric, i.e., symmetric about both of the main diagonal and antidiagonal.

Another property which is used later is that the sum of the entries for each row (column) is equal to the order of the matrix, i.e.,

$$\begin{aligned} \sum _{i=0}^{N}{c_{i,j}}=\sum _{j=0}^{N}{c_{i,j}}=N+1. \end{aligned}$$
(2.7)

In the next lemma, we present some properties of the DBPs.

Lemma 1

Let N be a nonnegative integer. The following statements hold.

  1. (i)

    For all \(x\in [0,1]\), \({\tilde{\psi }}_{N-i}\left( x\right) ={\tilde{\psi }}_{i}\left( 1-x\right) \), \(0\le i\le N\).

  2. (ii)

    For all \(x\in [0,1]\), \(\sum _{i=0}^{N}{{\tilde{\psi }}_{i}\left( x\right) }=N+1.\)

  3. (iii)

    The basis functions have the same definite integral, i.e.,\(\int _{0}^{1}{\tilde{\psi }}_{i}\left( x\right) \mathrm{d}x=1,\quad 0\le i\le N\).

Proof

The first statement is an immediate consequence of the similar formula for Bernstein polynomials, i.e., \(\phi _{N-i}(x)=\phi _{i}(1-x).\) From (2.4), (2.7) and (2.2), we have

$$\begin{aligned} \sum _{i=0}^{N}{{\tilde{\psi }}_{i}\left( x\right) }&= \sum _{i=0}^{N}{\sum _{j=0}^{N}c_{i,j}\phi _{j}\left( x\right) }\\&= \sum _{j=0}^{N}{\phi _{j}\left( x\right) \sum _{i=0}^{N}c_{i,j}}=N+1. \end{aligned}$$

Statement (iii) is also verified similarly. \(\square \)

The property (i) implies that \({\tilde{\psi }}_{i}\), for \(\left[ \frac{N}{2}\right] +1\le i\le N,\) need not to be computed directly by (2.4)–(2.5). It especially gives \({\tilde{\psi }}_{i}\left( 0\right) ={\tilde{\psi }}_{N-i}\left( 1\right) \).

2.1 Modal basis functions

One may choose a suitable compact combinations of orthogonal polynomials as the trial and test basis for the Galerkin and Petrov–Galerkin methods for BVPs in such a way leading to sparse linear systems for some special problems (see e.g., Goubet and Shen 2007; Yuan et al. 2008). Here, we use this idea for the non-orthogonal Bernstein polynomials to present a simple and accurate dual-Petrov–Galerkin spectral method for two-dimensional subdiffusion equation. Following Shen et al. (2007, 2011, Section 1.3), we will refer to such basis functions as the modal basis functions.

Proposition 1

Let \(N\ge 2\) be an integer, \(\{{\tilde{\psi }}_{i}:\,0\le i\le N\}\) be the dual Bernstein basis and \({\mathbb {P}}_{N}^{0}=\{u\in {\mathbb {P}}_{N}:\,u(0)=0,u(1)=0\}.\) Set

$$\begin{aligned} \psi _{i}\left( x\right) = {\tilde{\psi }}_{i}\left( x\right) +a_{i}{\tilde{\psi }}_{i+1} \left( x\right) +b_{i}{\tilde{\psi }}_{i+2}\left( x\right) , \end{aligned}$$
(2.8)

for \(0\le i\le N-2,\) where

$$\begin{aligned} a_{i}&= \frac{2i+4}{N-i+1},\nonumber \\ b_{i}&= \frac{(i+2)(i+3)}{(N-i)(N-i+1)}. \end{aligned}$$
(2.9)

Then, the polynomials \({\tilde{\psi }}_{i}(x)\) vanish at 0 and 1, so the set \(\{\psi _{i}\left( x\right) \}_{i=0}^{N-2}\) forms a basis for \({\mathbb {P}}_{N}^{0}\).

Proof

By (2.4) and (2.1), we have

$$\begin{aligned} {\tilde{\psi }}_{i}\left( 0\right) =\sum _{j=0}^{N}c_{i,j}\phi _{j}\left( 0\right) = c_{i,0}=\left( -1\right) ^{i}\left( N+1\right) \left( {\begin{array}{c}N+1\\ i+1\end{array}}\right) . \end{aligned}$$
(2.10)

From Lemma 1, we infer that

$$\begin{aligned} {\tilde{\psi }}_{i}\left( 1\right) ={\tilde{\psi }}_{N-i}\left( 0\right) =\left( -1\right) ^{N-i}\left( N+1\right) \left( {\begin{array}{c}N+1\\ i\end{array}}\right) . \end{aligned}$$
(2.11)

By (2.10) and (2.11), we obtain

$$\begin{aligned}&\psi _{i}\left( 0\right) =\left( -1\right) ^{i}\left( N+1\right) \left( \left( {\begin{array}{c}N+1\\ i+1\end{array}}\right) -a_{i}\left( {\begin{array}{c}N+1\\ i+2\end{array}}\right) +b_{i}\left( {\begin{array}{c}N+1\\ i+3\end{array}}\right) \right) =0,\\&\psi _{i}\left( 1\right) =\left( -1\right) ^{N-i}\left( N+1\right) \left( \left( {\begin{array}{c}N+1\\ N-i+1\end{array}}\right) -a_{i}\left( {\begin{array}{c}N+1\\ N-i\end{array}}\right) +b_{i}\left( {\begin{array}{c}N+1\\ N-i-1\end{array}}\right) \right) =0, \end{aligned}$$

for \(0\le i\le N-2.\) It is easy to see that \(\{\psi _{i}\left( x\right) \}_{i=0}^{N-2}\) is linearly independent. Since \(\mathrm {dim}{\mathbb {P}}_{N}^{0}=N-1\), this set is a basis for \({\mathbb {P}}_{N}^{0}\). This completes the proof. \(\square \)

Figure 1 illustrates the DBPs and the modal basis functions for \(6\le N\le 8\). It is seen that the modal basis functions have less values than the corresponding dual functions on the unit interval, expecting less round-off errors.

Fig. 1
figure 1

Graphs of DBPs \(\{{\tilde{\psi }}_{i}(x),\,0\le i\le N\}\) (top) and the modal basis functions \(\{\psi _{i}(x),\,0\le i\le N-2\}\) (bottom)

2.2 Transformation matrices and the operational matrix for derivatives

For \(N\ge 2\), consider the \((N+1)\)-vector \({\tilde{{\varvec{\Psi }}}}\) and the \((N-1)\)-vector \({\varvec{\Psi }}\) consisting of dual functions given by (2.4) and the modal basis functions given by (2.8), respectively:

$$\begin{aligned}&{\tilde{{\varvec{\Psi }}}}(\cdot )=[{\tilde{\psi }}_{i}\left( \cdot \right) :\,0\le i\le N]^{\mathrm{T}}, \end{aligned}$$
(2.12)
$$\begin{aligned}&{\varvec{\Psi }}(\cdot )=[\psi _{i}\left( \cdot \right) :\,0\le i\le N-2]^{\mathrm{T}}. \end{aligned}$$
(2.13)

For simplicity, we ignore the dependence of the vectors on the variable. First, note that

$$\begin{aligned} {\varvec{\Psi }}={\mathbf {G}}{\tilde{{\varvec{\Psi }}}}, \end{aligned}$$
(2.14)

where \({\mathbf {G}}=[g_{i,j}]\) is an \(\left( N-1\right) \times \left( N+1\right) \) matrix with three diagonals as

$$\begin{aligned} g_{i,j}&= {\left\{ \begin{array}{ll} 1, &{} i-j=0,\\ a_{i}, &{} j=i+1,\\ b_{i}, &{} j=i+2, \end{array}\right. }\quad 0\le i\le N-1,0\le j\le N. \end{aligned}$$

To derive a formula for the derivative of the modal basis functions, we first prove the following result.

Lemma 2

The operational matrix for derivative of the DBPs, \({\mathbf {P}}\) satisfies

$$\begin{aligned} {\tilde{{\varvec{\Psi }}}}^{\prime } = {\mathbf {P}}{\tilde{{\varvec{\Psi }}}}, \end{aligned}$$
(2.15)

where the matrix \({\mathbf {P}}=[p_{i,j}:\,0\le i,j\le N]\) is given by

$$\begin{aligned} p_{i,j}={\left\{ \begin{array}{ll} -(-1)^{i}(N+1)\left( {\begin{array}{c}N+1\\ i+1\end{array}}\right) +N\delta _{i,0}+\delta _{i,1}, &{} j=0,\\ -p_{N-i,0} &{} j=N,\\ i, &{} j=i-1,\;\;j\ne 0,\\ N-2i, &{} j=i,\;\;j\ne 0,N,\\ -N+i, &{} j=i+1,\;\;j\ne N. \end{array}\right. } \end{aligned}$$

Proof

The DBPs \({\tilde{{\varvec{\Psi }}}}\) is a basis for \(P_{N}\), so we expand \({\tilde{\psi }}_{i}^{\prime }\left( x\right) \) for \(0\le i\le N\) as

$$\begin{aligned} {\tilde{\psi }}_{i}^{\prime }\left( x\right) = \sum _{j=0}^{N}{p_{i,j}{\tilde{\psi }}_{j}\left( x\right) }. \end{aligned}$$

Integration by parts and (2.3) imply that

$$\begin{aligned} p_{i,j}&= \int _{0}^{1}{{\tilde{\psi }}_{i}^{\prime } \left( x\right) \phi _{j}\left( x\right) \mathrm{d}x}\\&= {\tilde{\psi }}_{i}\left( 1\right) \delta _{j,N} -{\tilde{\psi }}_{i}\left( 0\right) \delta _{j,0} -\int _{0}^{1}{\tilde{\psi }}_{i}\left( x\right) \left( (N-j+1) \phi _{j-1}(x)\right. \\&\quad \left. -(N-2j)\phi _{j}(x)-(j+1)\phi _{j+1}(x)\right) \mathrm{d}x. \end{aligned}$$

The biorthogonality (2.6) gives

$$\begin{aligned} p_{i,j} ={\tilde{\psi }}_{i}\left( 1\right) \delta _{j,N}-{\tilde{\psi }}_{i} \left( 0\right) \delta _{j,0}-\left( (N-j+1)\delta _{i,j-1} -(N-2j)\delta _{i,j}-(j+1)\delta _{i,j+1}\right) . \end{aligned}$$

Now, the result is proved by considering (2.10) and (2.11). \(\square \)

Remark 1

The matrix \({\mathbf {P}}\) is a sparse matrix of order \(N+1\) with \(p_{i,j}=0\) for \(|i-j|>1,\) \(j\ne 0,N\); for instance, see the matrix given below.

Corollary 1

Set \(\alpha _{i,0}=-(-1)^{i}(N+1)\left( {\begin{array}{c}N+1\\ i+1\end{array}}\right) +N\delta _{i,0}+\delta _{i,1}\) for \(0\le i\le N.\) Then, from (2.15), we infer that the following five-term recurrence relation is deduced:

$$\begin{aligned} {\tilde{\psi }}_{i}^{\prime }(x)&= \alpha _{i,0}{\tilde{\psi }}_{0} \left( x\right) +(1-\delta _{i,1})i{\tilde{\psi }}_{i-1}\left( x\right) +(1-\delta _{i,0})(1-\delta _{i,N})\left( N-2i\right) {\tilde{\psi }}_{i}\left( x\right) \\&\quad -(1-\delta _{i,N-1})\left( N-i\right) {\tilde{\psi }}_{i+1} \left( x\right) -\alpha _{N-i,0}{\tilde{\psi }}_{N}\left( x\right) , \end{aligned}$$

where we set \({\tilde{\psi }}_{i}\equiv 0\) for \(i<0\) and \(i>N.\)

We derive the transformation matrices that map the Bernstein and Chebyshev coefficients.

Now, we derive the transformation matrix that maps the derivative of modal basis functions to DBPs. This facilitates the use of the Galerkin method in the next section. In the following, \((p,q)-band\) matrix stands for a matrix with p and q nonzero diagonals below and above the main diagonal, respectively.

Lemma 3

Let the vectors \({\varvec{\Psi }}\) and \({\tilde{{\varvec{\Psi }}}}\) be defined as in (2.12) and (2.13), respectively. Then,

$$\begin{aligned} {\varvec{\Psi }}^\prime ={\mathbf {Q}}{\tilde{{\varvec{\Psi }}}}, \end{aligned}$$

where \({\mathbf {Q}}\) is an \(\left( N-1\right) \times \left( N+1\right) ,\) \(\mathrm {(1,3)-band}\) matrix given by \({\mathbf {Q}}={\mathbf {GP}}.\)

Proof

Combining (2.14) with (2.15) implies \({\mathbf {Q}}={\mathbf {GP}}.\) To prove that \({\mathbf {Q}}\) is a \(\mathrm {(1,3)-band}\) matrix, it is sufficient to show that \(q_{i,0}=0\) for \(i>1\) and \(q_{i,N}=0\) for \(i<N-2,\)

$$\begin{aligned} q_{i,0}&= \left( {\mathbf {GP}}\right) _{i,0}=p_{i,0}+a_{i}p_{i+1,0}+b_{i}p_{i+2,0}\\&=-\left( {\tilde{\psi }}_{i}\left( 0\right) +a_{i} {\tilde{\psi }}_{i+1}\left( 0\right) +b_{i}{\tilde{\psi }}_{i+2} \left( 0\right) \right) =-\psi _{i}(0)=0, \end{aligned}$$

and for \(i<N-2,\) by (1)

$$\begin{aligned} q_{i,N}&= p_{i,N}+a_{i}p_{i+1,N}+b_{i}p_{i+2,N} ={\tilde{\psi }}_{N-i}\left( 0\right) +a_{i}{\tilde{\psi }}_{N-i-1}\left( 0\right) +b_{i}{\tilde{\psi }}_{N-i-2}\left( 0\right) \\&= {\tilde{\psi }}_{i}\left( 1\right) +a_{i}{\tilde{\psi }}_{i+1} \left( 1\right) +b_{i}{\tilde{\psi }}_{i+2}\left( 1\right) =\psi _{i}(1)=0. \end{aligned}$$

Note that \(\psi _{i}\)’s vanish at the boundary values according to Proposition 1. The proof is complete.

To see the sparsity of the transformation matrices, \({\mathbf {P}}\), \({\mathbf {G}}\) and \({\mathbf {Q}}\) for \(N=6\) are shown in the following

$$\begin{aligned} {\mathbf {G}}= & {} \left[ \begin{array}{ccccccc} 1 &{}\quad \frac{4}{7} &{}\quad \frac{1}{7} &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 0\\ 0 &{}\quad 1 &{}\quad 1 &{}\quad \frac{2}{5} &{}\quad 0 &{}\quad 0 &{}\quad 0\\ 0 &{}\quad 0 &{}\quad 1 &{}\quad \frac{8}{5} &{}\quad 1 &{}\quad 0 &{}\quad 0\\ 0 &{}\quad 0 &{}\quad 0 &{}\quad 1 &{}\quad \frac{5}{2} &{}\quad \frac{5}{2} &{}\quad 0\\ 0 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 1 &{}\quad 4 &{}\quad 7 \end{array}\right] ,\quad {\mathbf {P}}=\left[ \begin{array}{ccccccc} -43 &{}\quad -6 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 7\\ 148 &{}\quad 4 &{}\quad -5 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad -49\\ -245 &{}\quad 2 &{}\quad 2 &{}\quad -4 &{}\quad 0 &{}\quad 0 &{}\quad 147\\ 245 &{}\quad 0 &{}\quad 3 &{}\quad 0 &{}\quad -3 &{}\quad 0 &{}\quad -245\\ -147 &{}\quad 0 &{}\quad 0 &{}\quad 4 &{}\quad -2 &{}\quad -2 &{}\quad 245\\ 49 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 5 &{}\quad -4 &{}\quad -148\\ -7 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 0 &{}\quad 6 &{}\quad 43 \end{array}\right] ,\\ {\mathbf {Q}}= & {} \left[ \begin{array}{ccccccc} \frac{46}{7} &{}\quad -\frac{24}{7} &{}\quad -\frac{18}{7} &{}\quad -\frac{4}{7} &{}\quad 0 &{}\quad 0 &{}\quad 0\\ 1 &{}\quad 6 &{}\quad -\frac{9}{5} &{}\quad -4 &{}\quad -\frac{6}{5} &{}\quad 0 &{}\quad 0\\ 0 &{}\quad 2 &{}\quad \frac{34}{5} &{}\quad 0 &{}\quad -\frac{34}{5} &{}\quad -2 &{}\quad 0\\ 0 &{}\quad 0 &{}\quad 3 &{}\quad 10 &{}\quad \frac{9}{2} &{}\quad -15 &{}\quad -\frac{5}{2}\\ 0 &{}\quad 0 &{}\quad 0 &{}\quad 4 &{}\quad 18 &{}\quad 24 &{}\quad -46 \end{array}\right] . \end{aligned}$$

3 Variational formulation of the problem (1.1) and the spectral discretization

In this section, at first the problem (1.1)–(1.3) is discretized in time. Then we develop a matrix approach Bernstein dual-Petrov–Galerkin method using the results of the previous section.

3.1 Time discretization

Consider the subdiffusion Eq. (1.1) at \(t=t_{k+1},\,k\ge 0\) as

$$\begin{aligned} {D_{t}^{\alpha }}u\left( x,y,t_{k+1}\right) =\kappa \varDelta u \left( x,y,t_{k+1}\right) +S\left( x,y,t_{k+1}\right) . \end{aligned}$$
(3.1)

Let \(u^{k}\) be an approximation of u at \(t=t_{k}=k\tau \) for \(k=0,1,\ldots ,M,\) where \(\tau =\frac{T}{M}\) is the time step length. The time fractional derivative can be approximated by definition (1.4) and using forward difference for the derivative inside as

$$\begin{aligned} {D_{t}^{\alpha }}u\left( x,y,t_{k+1}\right)= & {} \mu \left( u^{k+1}-(1-b_{1})u^{k} -\sum _{j=1}^{k-1}(b_{j}-b_{j+1})u^{k-j}-b_{k}u^{0}\right) \nonumber \\&+\;r_{\tau }^{k+1},\quad k\ge 1, \end{aligned}$$
(3.2)

where \(\mu =\frac{1}{\tau ^{\alpha }\varGamma \left( 2-\alpha \right) }\) and \(b_{j}=\left( j+1\right) ^{1-\alpha }-j^{1-\alpha }\) for \(k\ge 0\) and \(0\le j\le k\). The error is bounded by

$$\begin{aligned} \left| r_{\tau }^{k+1}\right| \le {\tilde{c}}_{u}\tau ^{2-\alpha }, \end{aligned}$$
(3.3)

where the coefficient \({\tilde{c}}_{u}\) depends only on u (Deng 2008). The time discretization (3.2) is referred to as L1 approximation (see e.g., Deng 2008; Ramezani et al. 2015). Substituting from (3.2) into (3.1) and multiplying both sides by \(\tau ^{\alpha }\varGamma \left( 2-\alpha \right) \) and dropping (xy), the following time-discrete scheme is obtained:

$$\begin{aligned}&u^{k+1}-\alpha _{0}\varDelta u^{k+1}=f^{k+1},\quad k\ge 0,\nonumber \\&f^{k+1}:=(1-b_{1})u^{k}+\sum _{j=1}^{k-1}(b_{j}-b_{j+1})u^{k-j} +b_{k}u^{0}+\frac{1}{\mu }S^{k+1}, \end{aligned}$$
(3.4)

with \(\alpha _{0}=\frac{k}{\mu }\) and \(u^{0}=g\) is given by the initial condition (1.2) with the error

$$\begin{aligned} r^{k+1}\le \tau ^{\alpha }\varGamma \left( 2-\alpha \right) \left| r_{\tau }^{k+1}\right| \le {\tilde{c}}_{u}\tau ^{2}. \end{aligned}$$
(3.5)

For \(k=0,\) it reads as

$$\begin{aligned} u^{1}-\alpha _{0}\kappa \varDelta u^{1}=(1-b_{1})u^{1}+b_{1}u^{0} +\frac{1}{\mu }S^{1}. \end{aligned}$$
(3.6)

The boundary conditions for the semidiscrete problem is \(u^{k+1}=0\) on \(\partial \varOmega \).

3.2 Weak and spectral formulation

Consider the problem (3.4) with \(\varOmega =I{}^{2},\,I=\left( 0,1\right) \) and the homogeneous Dirichlet boundary conditions \(u^{k+1}|_{\partial \varOmega }=0\). We seek an approximate solution in the Sobolev space \(H_{0}^{1}\left( \varOmega \right) =\{u\in H^{1}(\varOmega ),u=0,\,\text {on} {\partial \varOmega }\}\). A weak formulation of the problem (3.4) is to find \(u^{k+1}\in H_{0}^{1}(\varOmega )\) such that \(\forall v\in H_{0}^{1}(\varOmega )\):

$$\begin{aligned} (u^{k+1},v)+\alpha _{0}(\nabla u^{k+1},\nabla v)=\left( (1-b_{1})u^{k} +\sum _{j=1}^{k-1}(b_{j}-b_{j+1})u^{k-j}+b_{k}u^{0}+\frac{1}{\mu }S^{k+1},v\right) .\nonumber \\ \end{aligned}$$
(3.7)

Let \({\mathbb {P}}_{N}\) be the space of polynomials over I with degree not exceeding N and \(({\mathbb {P}}_{N}^{0})^{2}=\{v\in ({\mathbb {P}}_{N})^{2}:\,v=0,\, \text {on}\,\partial \varOmega \}\).

The Galerkin formulation of the (3.7) is to find \(u_{N}^{k+1}\in ({\mathbb {P}}_{N}^{0})^{2}\) such that \(\forall v_{N}\in ({\mathbb {P}}_{N}^{0})^{2}\):

$$\begin{aligned}&\left( u_{N}^{k+1},v_{N}\right) +\alpha _{0}\left( \nabla u_{N}^{k+1},\nabla v_{N}\right) \nonumber \\&\quad =\left( (1-b_{1})u_{N}^{k}+\sum _{j=1}^{k-1}(b_{j}-b_{j+1})u_{N}^{k-j} +b_{k}u_{N}^{0}+\frac{1}{\mu }I_{N}S^{k+1},v_{N}\right) , \end{aligned}$$
(3.8)

with \(\left( f,g\right) \) being the standard inner product and \(I_{N}\) an interpolation operator.

3.2.1 Bernstein dual-Petrov–Galerkin method

Since \(\dim {\mathbb {P}}_{N}^{0}=N-1\), and due to (2.1), we choose a basis for it by removing the first and last Bernstein polynomials of degree N, i.e.,

$$\begin{aligned} {\varvec{\Phi }} = \left[ \phi _{i}(x):\,1\le i\le N-1\right] ^{\mathrm{T}}. \end{aligned}$$
(3.9)

Using (2.3), it is easy to verify that

$$\begin{aligned} {\varvec{\Phi }}'={\mathbf {D}}{\varvec{\Phi }}+\mathbf {d}, \end{aligned}$$
(3.10)

where \({\mathbf {D}}=\mathrm {tridiag}(N-i+1,2i-N,-(i+1))\) is a tridiagonal matrix of order \(N-1\) and \(\mathbf {d}=N\left[ \phi _{0},0,\dots ,0,-\phi _{N}\right] ^{\mathrm{T}}\) is an \((N-1)\)-vector.

Assuming \(N_{x}=N_{y}=N,\) we use the tensor product of the basis functions of \({\mathbb {P}}_{0}^{N}\) as a basis for two-dimensional case, \(\left\{ \phi _{i}(x)\phi _{j}(y):1\le i,j\le N-1\right\} \) and consider an approximate solution of (3.4) as

$$\begin{aligned} u_{N}^{k+1}=\sum _{i,j=1}^{N-1}{\hat{u}_{i,j}^{k+1}\phi _{i}(x)\phi _{j}(y)} ={\varvec{\Phi }}^{\mathrm{T}}\left( x\right) {\mathbf {U}}^{k+1}{\varvec{\Phi }} \left( y\right) ,\quad (x,y)\in \varOmega , \end{aligned}$$
(3.11)

where \({\varvec{\Phi }}\left( \cdot \right) =\left[ \phi _{i}(\cdot ):\,1\le i\le N-1\right] ^{\mathrm{T}}\) and \({\mathbf {U}}^{k+1}=[\hat{u}_{i,j}^{k+1}]\). Let us use the following notations.

$$\begin{aligned} a_{i,j}&=\int _{I}{\phi _{j}^{\prime }(x)\psi _{i}^{\prime }(x)\mathrm{d}x}, \quad {\mathbf {A}}=[a_{i,j}],\nonumber \\ b_{i,j}&=\int _{I}{\phi _{j}(x)\psi _{i}(x)\mathrm{d}x},\quad {\mathbf {B}}=[b_{i,j}],\nonumber \\ f_{i,j}^{k+1}&=\int _{\varOmega }{I_{N}f^{k+1}(x,y)\psi _{j}(x)\psi _{i}(y)\mathrm{d}\varOmega }, \end{aligned}$$
(3.12)

for \(1\le j\le N-1,\,0\le i\le N-2.\)

Taking the test functions of (3.8) as \(v=\psi _{l}(x)\psi _{m}(y)\) for \(l,m=0,1,\dots ,N-2,\) it is seen that the spectral form (3.8) is equivalent to the following linear system:

$$\begin{aligned} \mu _{\tau }^{\alpha }{\mathbf {B}}{\mathbf {U}}^{k+1}{\mathbf {B}}^{\mathrm{T}}+\kappa \left( {\mathbf {A}}{\mathbf {U}}^{k+1}{\mathbf {B}}^{\mathrm{T}}+{\mathbf {B}} {\mathbf {U}}^{k+1}{\mathbf {A}}^{\mathrm{T}}\right) =\mathbf {F}^{k+1},\quad k\ge 0, \end{aligned}$$

which can be equivalently written as a Sylvester equation, but it requires computing the inverse of \({\mathbf {B}}\). Although \({\mathbf {B}}\) has only three nonzero diagonals, it can be shown that its inverse is a dense matrix and so we avoid transforming to the Sylvester equation. Instead, we use the equivalent tensor product form:

$$\begin{aligned} \left( \mu _{\tau }^{\alpha }{\mathbf {B}}\otimes {\mathbf {B}}+\kappa \left( {\mathbf {B}}\otimes {\mathbf {A}}+{\mathbf {A}}\otimes {\mathbf {B}}\right) \right) \mathbf {u}^{k+1}=\mathbf {f}^{k+1}, \end{aligned}$$
(3.13)

with \(\mathbf {f=}\left[ f_{1,0,\ldots },f_{q,0};f_{1,1\ldots }, f_{q,1};\dots ;f_{1,q-1,\ldots },f_{q,q-1}\right] ^{\mathrm{T}},\,q=N-1\). It is worth noting that the coefficient matrix of the linear system (3.13) is the same for all time steps, so it is to be evaluated just once for all \(k\ge 0\).

In terms of the trial vector (3.9), and test vector (2.13), we may write

$$\begin{aligned} \mathbf {A=}\int _{I}{{{\varvec{\Psi }}^{\prime }}{\varvec{\Phi }}^{\prime T}\mathrm{d}x}, \quad {\mathbf {B}}=\int _{I}{{\varvec{\Psi }}{\varvec{\Phi }}^{\mathrm{T}}}. \end{aligned}$$

To facilitate the computations, in what follows, these matrices are related to the transformation matrices introduced in Sect. 2.2. First, note that by the biorthogonality (2.6), we have

$$\begin{aligned} \int _{I}{{\tilde{\varvec{\Psi }}}{\varvec{\Phi }}^{\mathrm{T}}\mathrm{d}x} = \left[ \begin{array}{ccccc} 0 &{} \quad 0 &{} \quad \cdots &{} \quad 0 &{} \quad 0 \\ 1 &{} \quad 0 &{} \quad \cdots &{} \quad 0 &{} \quad 0 \\ 0 &{} \quad 1 &{} \quad \cdots &{} \quad 0 &{} \quad 0 \\ \vdots &{} \quad \vdots &{} \quad \ddots &{} \quad \vdots &{} \quad \vdots \\ 0 &{} \quad 0 &{} \quad \cdots &{} \quad 1 &{} \quad 0 \\ 0 &{} \quad 0 &{} \quad \cdots &{} \quad 0 &{} \quad 1 \\ 0 &{} \quad 0 &{} \quad \cdots &{} \quad 0 &{} \quad 0 \end{array}\right] =:{\tilde{\mathbf {I}}}. \end{aligned}$$
(3.14)

Now from (2.14), and writing \({\mathbf {G}}\) as \({\mathbf {G}}=[\mathbf {g}_{0},\mathbf {g}_{1},\dots ,\mathbf {g}_{N}]\), we get

$$\begin{aligned} {\mathbf {B}} =\int _{I}{{\mathbf {G}}{\tilde{\varvec{\Psi }}}{\varvec{\Phi }}^{\mathrm{T}}\mathrm{d}x} ={\mathbf {G}}{\tilde{\mathbf {I}}}=[\mathbf {g}_{1},\mathbf {g}_{2},\dots ,\mathbf {g}_{N-1}]. \end{aligned}$$

So \({\mathbf {B}}\) is a tridiagonal matrix whose entries are given by

$$\begin{aligned} b_{i,j} = {\left\{ \begin{array}{ll} 1, &{} \quad j=i+1, \\ a_{i}, &{} \quad j=i, \\ b_{i}, &{} \quad j=i-1, \\ 0, &{} \quad \mathrm{otherwise}, \end{array}\right. } \end{aligned}$$
(3.15)

where \(a_{i}\)s and \(b_{i}\)s are easily computed by (2.9). On the other hand, from Lemma 3, the Bernstein operational matrix of differentiation (3.10) and (3.14), we obtain

$$\begin{aligned} {\mathbf {A}}&= \int _{I}{{\mathbf {Q}}{\tilde{{\varvec{\Psi }}}} ({{\varvec{\Phi }}^{\mathrm{T}}D^{\mathrm{T}}}+\mathbf {d^{\mathrm{T}}})\mathrm{d}x}\nonumber \\&= {\mathbf {Q}}{\tilde{\mathbf {I}}}\mathbf {D^{\mathrm{T}}}+N[\mathbf {q}_{0}, \mathbf {0},\dots ,\mathbf {0},\mathbf {q}_{N}]\nonumber \\&= [{\mathbf {q}}_{1},\dots ,{\mathbf {q}}_{N-1}]{\mathbf {D}}^{\mathrm{T}}+N[{\mathbf {q}}_{0}, \mathbf {0},\dots ,\mathbf {0},{\mathbf {q}}_{N}], \end{aligned}$$
(3.16)

where \({\mathbf {Q}}=[{\mathbf {q}}_{0},{\mathbf {q}}_{1},\dots ,{\mathbf {q}}_{N}]\) is a \(\mathrm {(1,3)-band}\) matrix introduced Lemma 3. Hence, \({\mathbf {Q}}{\tilde{\mathbf {I}}}\) is a pentadiagonal matrix and \({\mathbf {A}}\) is the product of a pentadiagonal and a tridiagonal matrix plus a sparse matrix. From Lemma 3 and (3.16), it is seen that \({\mathbf {A}}\) is a seven-diagonal matrix.

Notice that the solution of linear system (3.13) requires the matrices \({\mathbf {A}}\) and \({\mathbf {B}}.\) \({\mathbf {A}}\) is obtained by a sparse matrix–matrix multiplication (3.16) and entries of \({\mathbf {B}}\) are given by (3.15).

Remark 2

Since the coefficient matrix of the linear system (3.13) remains intact for a fixed \(\tau \), only the RHS vector needs to be computed for different time steps, \(k=0,1,\dots \) up to a desired time. So it is efficient to use a band-LU factorization for solving the system. It is remarkable that for a \((2p+1)\)-band matrix, the LU-factorization can be done with \(O(Np^{2})\) flops and backward substitutions require O(Np) flops Golub and Ortega (1992, Section 4.3).

4 Stability and convergence analysis

For the error analysis, we assume the problem (1.1) to be homogeneous, \(S=0\).

For \(\alpha \ge 0,\) the bilinear form \(a\left( u,v\right) =\left( \nabla u,\nabla v\right) +\alpha (u,v)\) in (3.8) is continuous and coercive in \(H_{0}^{1}\left( \varOmega \right) \times H_{0}^{1}\left( \varOmega \right) \). The existence and uniqueness of the solution for both the weak form (3.8) and the Galerkin form (3.8) is guarantied by the well-known Lax–Milgram lemma.

We define the following inner product and the associated energy norm on \(H_{0}^{1}(\varOmega )\):

$$\begin{aligned} (u,v)=\int _{\varOmega }uv\mathrm{d}\varOmega ,\quad (u,v)_{1,}=(u,v)+\alpha _{0} (\nabla u,\nabla v),\quad \Vert u\Vert _{1}=(u,u)_{1}^{\frac{1}{2}}. \end{aligned}$$
(4.1)

Theorem 1

The weak form (3.7) is unconditionally stable:

$$\begin{aligned} \Vert u^{k}\Vert _{1}\le \Vert u^{0}\Vert ,\quad k=1,\ldots ,M. \end{aligned}$$
(4.2)

Proof

Let \(v=u^{1}\) in (3.7). Then,

$$\begin{aligned} (u^{1},u^{1})+\alpha _{0}(\nabla u^{1},\nabla u^{1})=(u^{0},u^{1}), \end{aligned}$$

giving (4.2) for \(k=1,\) by the definition (4.1), the Schwarz inequality and the inequality \(\Vert v\Vert \le \Vert v\Vert _{1}\). By mathematical induction, assume (4.2) holds for \(k=0,\dots ,n.\) Let \(v=u^{n+1}\) in (3.7), i.e.,

$$\begin{aligned}&(u^{n+1},u^{n+1})+\alpha _{0}(\nabla u^{n+1},\nabla u^{n+1}) \\&\quad =(1-b_{1})(u^{n},u^{n+1})+\sum _{j=1}^{n-1}(b_{j}-b_{j+1})(u^{n-j},u^{n+1})+b_{n}(u^{0},u^{n+1}). \end{aligned}$$

It is easy to see that the RHS coefficients in (3.4) are positive. So we obtain

$$\begin{aligned} \Vert u^{n+1}\Vert _{1}&\le (1-b_{1})\Vert u^{n}\Vert +\sum _{j=1}^{n-1}(b_{j}-b_{j+1})\Vert u^{n-j}\Vert +b_{n}\Vert u^{0}\Vert \\&\le \left( (1-b_{1})+\sum _{j=1}^{n-1}(b_{j}-b_{j+1}) +b_{n}\right) \Vert u^{0}\Vert =\Vert u^{0}\Vert . \end{aligned}$$

So the proof is done. \(\square \)

Theorem 2

Let u be the solution of the equation (1.1) with conditions (1.2)–(1.3) and \(u^{k}\) be the solution of the the semidiscrete problem (3.4). Then,

$$\begin{aligned}&\Vert u(t_{k})-u^{k}\Vert _{1}\le \frac{c_{u}}{1-\alpha }T^{\alpha }\tau ^{2-\alpha },\quad 0<\alpha <1, \end{aligned}$$
(4.3)
$$\begin{aligned}&\Vert u(t_{k})-u^{k}\Vert _{1}\le c_{u}T\tau ,\quad \qquad \quad \,as\,\alpha \rightarrow 1. \end{aligned}$$
(4.4)

Proof

The idea of the proof comes from Lin and Chuanju (2007). We first prove

$$\begin{aligned} \Vert u(t_{k})-u^{k}\Vert _{1}\le \frac{c_{u}}{b_{k-1}}\tau ^{2},\quad k=1,\dots ,M. \end{aligned}$$
(4.5)

By (1.1) and (3.6), we have

$$\begin{aligned} (e^{1},v)+\alpha _{0}(\nabla e^{1},\nabla v)=(e^{0},v)+(r^{1},v),\quad \forall \; v\in H_{0}^{1}(\varOmega ), \end{aligned}$$

in which \(e^{k}:=u(t_{k})-u^{k}.\) For \(v=e^{1}\) and by using \(e^{0}=0\), \(\Vert v\Vert \le \Vert v\Vert _{1}\) and (3.5), we get

$$\begin{aligned} \Vert e^{1}\Vert _{1}\le c_{u}\tau ^{2}, \end{aligned}$$
(4.6)

i.e., (4.5) holds for \(k=1\). By induction, assume (4.5) holds for \(k\le n\). Using (1.1) and (3.4), we get

$$\begin{aligned}&(e^{n+1},v)+\alpha _{1}(\nabla e^{n+1},\nabla v) \\&\quad =(1-b_{1})(e^{n},v)+\sum _{j=1}^{n-1}(b_{j}-b_{j+1})(e^{n-j},v)+b_{n}(e^{0},v)+(r^{n+1},v),\quad \forall \; v\in H_{0}^{1}(\varOmega ). \end{aligned}$$

For \(v=e^{n+1}\), it reads as

$$\begin{aligned} \Vert e^{n+1}\Vert _{1}^{2}&\le (1-b_{1})\Vert e^{n}\Vert \Vert e^{n+1}\Vert _{1} +\sum _{j=1}^{n-1}(b_{j}-b_{j+1})\Vert e^{n-j}\Vert \Vert e^{n+1}\Vert _{1}+\Vert r^{n+1}\Vert \Vert e^{n+1}\Vert _{1},\\ \Rightarrow \Vert e^{n+1}\Vert _{1}&\le (1-b_{1})\frac{c_{u}}{b_{n-1}} \tau ^{2}+\sum _{j=1}^{n-1}(b_{j}-b_{j+1})\frac{c_{u}}{b_{n-j-1}}\tau ^{2}+c_{u}\tau ^{2}\\&\le \left( (1-b_{1})+\sum _{j=1}^{n-1}(b_{j}-b_{j+1}) +b_{n}\right) \frac{c_{u}}{b_{n}}\tau ^{2}=\frac{c_{u}}{b_{n}}\tau ^{2}, \end{aligned}$$

proving (4.5) for \(k=n+1\) that completes the proof of (4.5).

Consider \(f(t)=t^{1-\alpha }\), then there exists a\(\xi ,\) \(k-1<\xi <k\le M\) such that

$$\begin{aligned} b_{k-1}\tau ^{-\alpha }= & {} \frac{(k\tau )^{1-\alpha } -(\tau (k-1))^{1-\alpha }}{\tau }=(1-\alpha )(\xi \tau )^{-\alpha }\nonumber \\\ge & {} (1-\alpha )(k\tau )^{-\alpha }\ge (1-\alpha )(T)^{-\alpha }, \end{aligned}$$

which gives

$$\begin{aligned} \frac{c_{u}}{b_{k-1}}\tau ^{2}\le \frac{c_{u}}{1-\alpha }T^{\alpha } \tau ^{2-\alpha }. \end{aligned}$$
(4.7)

Now using this along with (4.5) proves (4.3).

To derive (4.4), we first prove

$$\begin{aligned} \Vert u(t_{k})-u^{k}\Vert _{1}\le c_{u}k\tau ^{2},\quad k=1,\dots ,M. \end{aligned}$$
(4.8)

By (4.6), the inequality (4.8) holds for \(k=1\). Assume that (4.8) holds for \(k=1,\dots ,n,\,n\le M-1\). Then, from (1.1), (3.4) and (3.5), we obtain

$$\begin{aligned} \Vert e^{n+1}\Vert _{1}&\le (1-b_{1})\Vert e^{n}\Vert +\sum _{j=1}^{n-1} (b_{j}-b_{j+1})\Vert e^{n-j}\Vert +\Vert r^{n+1}\Vert \\&\le \left( (1-b_{1})\frac{n}{n+1}+\sum _{j=1}^{n-1}(b_{j}-b_{j+1}) \frac{n-j}{n+1}+\frac{1}{(n+1)}\right) c_{u}(n+1)\tau ^{2}\\&\le \left( (1-b_{1})\frac{n}{n+1}+(b_{1}-b_{n})\frac{n}{n+1} -(b_{1}-b_{n})\frac{1}{n+1}+\frac{1}{(n+1)}\right) c_{u}(n+1)\tau ^{2}\\&= \left( 1-b_{n}\frac{n}{n+1}-(b_{1}-b_{n})\frac{1}{n+1} \right) c_{u}(n+1)\tau ^{2}\le c_{u}(n+1)\tau ^{2}. \end{aligned}$$

So (4.8) holds for \(k=n+1\). From \(k\tau \le T\) and (4.8), we get (4.4). \(\square \)

4.1 Convergence of the full discretization scheme

Let \(\pi _{N}^{1,0}\) be the \(H^{1}\)-orthogonal projection operator from \(H_{0}^{1}(\varOmega )\) into \(({\mathbb {P}}_{N}^{0})^{2}\) associated with the energy norm \(\Vert \cdot \Vert _{1}\) defined in (4.1). Due to the equivalence of this norm with the standard \(H^{1}\) norm, we have the following error estimation Lin and Chuanju (2007, Relation (4.3))

$$\begin{aligned} \left\| u-\pi _{N}^{1,0}u\right\| _{1}\le cN{}^{1-m}\Vert u\Vert _{m},\quad u\in H_{0}^{m}(\varOmega )\cap H_{0}^{1}(\varOmega ), \quad m\ge 1. \end{aligned}$$
(4.9)

The idea of the proof for the following result comes from the paper (Lin and Chuanju 2007).

Theorem 3

Let \(u^{k},k=0,\dots ,M\) be the solution of the variational formulation (3.7) and \(u_{N}^{k}\) be the solution of the scheme (3.8), assuming \(u^{0}=\pi _{N}^{1,0}u^{0}\) and \(u^{k}\in H^{m}(\varOmega )\cap H_{0}^{1}(\varOmega )\) for some \(m>1.\) Then,

$$\begin{aligned}&\left\| u^{k}-u_{N}^{k}\right\| _{1}\le \frac{c}{1-\alpha }\tau ^{-\alpha }N{}^{1-m}\max _{0\le j\le k}\Vert u^{j}\Vert _{m},\quad 0<\alpha <1,\nonumber \\&\left\| u^{k}-u_{N}^{k}\right\| _{1}\le cN^{1-m}\sum _{j=0}^{k}\Vert u^{j}\Vert _{m}, \quad \alpha \rightarrow 1, \end{aligned}$$
(4.10)

for \(k=1,\dots ,M\), where c depends only on \(T^{\alpha }\).

Proof

We have \((u^{k+1}-\pi _{N}^{1,0}u^{k+1},v_{N})_{1}=0,\,\forall v_{N}\in ({\mathbb {P}}_{N}^{0})^{2}\) by the projection operator. By definition of the norm (4.1), we get

$$\begin{aligned}&\left( \pi _{N}^{1,0}u^{k+1},v_{N}\right) +\alpha _{1}\left( \nabla \pi _{N}^{1,0}u^{k+1},\nabla v_{N}\right) \\&\quad = \left( u^{k+1},v_{N}\right) +\alpha _{1}\left( \nabla u^{k+1},\nabla v_{N}\right) ,\quad \forall \; v_{N}\in \left( {\mathbb {P}}_{N}^{0}\right) ^{2}. \end{aligned}$$

By the weak form (3.7), the RHS of the above equation is replaced as

$$\begin{aligned}&\left( \pi _{N}^{1,0}u^{k+1},v_{N}\right) +\alpha _{1}\left( \nabla \pi _{N}^{1,0}u^{k+1}, \nabla v_{N}\right) =(1-b_{1})\left( u^{k},v_{N}\right) \nonumber \\&\quad +\sum _{j=1}^{k-1}(b_{j}-b_{j+1})(u^{k-j},v_{N}) +b_{k}(u^{0},v_{N}),\quad \forall \; v_{N}\in \left( {\mathbb {P}}_{N}^{0}\right) ^{2}. \end{aligned}$$
(4.11)

Subtracting (4.11) from (3.8), we have

$$\begin{aligned}&\left( \tilde{e}_{N}^{k+1},v_{N}\right) +\alpha _{1}\left( \frac{\partial \tilde{e}_{N}^{k+1}}{\partial x},\frac{\partial v_{N}}{\partial x}\right) \\&\quad =(1-b_{1})\left( e_{N}^{k},v_{N}\right) +\sum _{j=1}^{k-1}(b_{j}-b_{j+1})\left( e_{N}^{k-j}, v_{N}\right) +b_{k}\left( e_{N}^{0},v_{N}\right) ,\quad \forall \; v_{N}\in \left( {\mathbb {P}}_{N}^{0}\right) ^{2}, \end{aligned}$$

where \(e_{N}^{k+1}=u^{k+1}-u_{N}^{k+1}\) and \(\tilde{e}_{N}^{k+1}=\pi _{N}^{1,0}u^{k+1}-u_{N}^{k+1}\). Let \(v_{N}=\tilde{e}_{N}^{k+1}\), then

$$\begin{aligned} \left\| \tilde{e}_{N}^{k+1}\right\| _{1}\le (1-b_{1})\left\| e_{N}^{k}\right\| +\sum _{j=1}^{k-1}(b_{j} -b_{j+1})\left\| e_{N}^{k-j}\right\| +b_{k}\left\| e_{N}^{0}\right\| . \end{aligned}$$

With \(\Vert e_{N}^{k+1}\Vert _{1}\le \Vert \tilde{e}_{N}^{k+1}\Vert _{1}+\Vert u^{k+1} -\pi _{N}^{1,0}u^{k+1}\Vert _{1}\), we obtain

$$\begin{aligned} \left\| e_{N}^{k+1}\right\| _{1}\le (1-b_{1})\left\| e_{N}^{k}\right\| +\sum _{j=1}^{k-1}(b_{j} -b_{j+1})\left\| e_{N}^{k-j}\right\| +b_{k}\left\| e_{N}^{0}\right\| +cN^{1-m}\Vert u^{k+1}\Vert . \end{aligned}$$

As in the proof of Theorem 2, it is first proved by induction that:

$$\begin{aligned}&\left\| e_{N}^{k+1}\right\| _{1}\le \frac{1}{b_{k-1}}\max _{0\le j\le k}\left\| u^{j} -\pi _{N}^{1,0}u^{j}\right\| _{1},\quad 0<\alpha <1,\\&\left\| e_{N}^{k+1}\right\| _{1}\le \sum _{j=0}^{k}\left\| u^{j}-\pi _{N}^{1,0}u^{j}\right\| _{1}, \quad \alpha \rightarrow 1, \end{aligned}$$

for \(0\le k\le M.\) Then, by using (4.7) and the projection error (4.9) the desired result is derived. \(\square \)

The following theorem is obtained by the triangle inequality \(||u(\cdot ,t_{k})-u_{N}^{k}||_{1}\le ||u(\cdot ,t_{k})-u^{k}||_{1}+||u^{k}-u_{N}^{k}||_{1}\) along with the inequalities (4.3) and (4.10).

Theorem 4

Let u be the solution of the problem (1.1) with the initial and boundary conditions given by (1.2)–(1.3) and \(u_{N}^{k}\) be the solution of the scheme (3.8). Then, assuming \(u_{N}^{0}=\pi _{N}^{1,0}u^{0}\) and \(u\in H^{m}(\varOmega )\cap H_{0,}^{1}(\varOmega )\), we have

$$\begin{aligned} \left\| u(t_{k})-u_{N}^{k}\right\| _{1}\le&\frac{CT^{\alpha }}{1-\alpha }\left( c_{u} \tau ^{2-\alpha }+c\tau ^{-\alpha }N{}^{1-m}\sup _{0<t<T}\Vert u(x,t)\Vert _{m}\right) , \quad k\le M,\quad 0<\alpha<1, \nonumber \\ \left\| u(t_{k})-u_{N}^{k}\right\| _{1}\le&T^{\alpha }\left( c_{u}\tau +c\tau ^{-1}N{}^{1-m} \sup _{0<t<T}\Vert u(x,t)\Vert _{m}\right) ,\quad k\le M,\quad \alpha \rightarrow 1. \end{aligned}$$
(4.12)

The constants C and c are independent of \(\tau \), T, N.

It is seen that the method has the so-called spectral convergence in space and the order of convergence \(O(\tau ^{2-\alpha })\) in time.

5 Numerical examples

Here, some numerical experiments are provided to show the accuracy of the proposed method. For the computations, we use Maple 18 on a laptop with CPU core i3 1.9 GHz and RAM 4 running Windows 8.1 platform. To compute the errors, we use the discrete \(L^{2}\) and \(L^{\infty }\) errors defined as

$$\begin{aligned} L^{2}&\approx \left( \frac{1}{{\mathcal {N}}^{2}}\sum _{i,j=0}^{{\mathcal {N}}-1} {\left| u(x_{i},y_{j},t_{m})-u_{N}^{m}(x_{i},y_{j})\right| ^{2}}\right) ^{1/2},\\ L^{\infty }&\approx \max _{0\le i,j\le {\mathcal {N}}}{\left| u(x_{i},y_{j},t_{m}) -u_{N}^{m}(x_{i},y_{j})\right| }, \end{aligned}$$

respectively, where u is the exact solution of the problem (1.1)–(1.3), \(u_{N}^{m}\) is the approximation solution (3.11) at \(t=t_{m}=m\tau ,\) \(x_{i}=\frac{i}{{\mathcal {N}}},\,y_{j}=\frac{j}{N}\) and \({\mathcal {N}}=100\). Also, the convergence rates in space and time are, respectively, computed by

$$\begin{aligned} \text {rate}_{N_{i}}=\frac{\log {\frac{E(N_{i},\tau )}{E(N_{i-1},\tau )}}}{\log {\frac{N_{i-1}}{N_{i}}}},\quad \text {rate}_{\tau _{i}} =\frac{\log {\frac{E(N,\tau _{i})}{E(N,\tau _{i-1})}}}{\log {\frac{\tau _{i}}{\tau _{i-1}}}}, \end{aligned}$$

where \(E(h,\tau )\) is the error with \(h=1/N,\) where N stands for the dimension of basis and \(\tau \) is the time-step size. However, as it is common in the literature, we will show the spectral convergence of the proposed method by logarithmic scaled error plots.

It is worth mentioning that as we derived the operational matrices in Sect. 2.2 with special structures, and the proposed method finally leads to the linear system (3.13) that is sparse and banded. To see the sparsity and bandedness, the nonzero entries of the coefficinet matrix of (3.13) are depicted in Fig. 2 using the sparsematrixplot command of Maple. It is seen that the density decreases rapidly as N increases.

Fig. 2
figure 2

The coefficient matrix of the linear system (3.13)

Example 1

Consider the problem (1.1) with \(\kappa =1\) and the exact solution \(u(x,y,t)=\sin {(\pi x)}\sin {(\pi y)}t^{2}\). Table 1 shows the convergence of the method in space for \(\tau =\varDelta t=0.01\) for fractional orders \(\alpha =0.25,0.50,0.75\). \(N_{x}\) and \(N_{y}\) stand for the number of basis in the x and y direction. Figure 3 demonstrates the logarithmic scale error plot in terms of \(H^{1}\)-norm for \(\alpha =1/2\) for some ts. It is seen that the method preserves the spectral convergence at different time rows \(t<1\) and \(t>1\). Table 2 reports the convergence in time by considering \(N_{x}=N_{y}=N=8\) as \(\tau \) decreases at time rows \(t=0.1\) and \(t=1\). It verifies the \(O(\tau ^{2-\alpha })\) temporal rate of convergence.

Table 1 Convergence in space at \(t=1\) for Example 1
Fig. 3
figure 3

Convergence of the spectral method (3.13) in space with \(\tau =0.001\)

Table 2 Error and temporal rate of convergence at \(t=1\) for Example 1
Fig. 4
figure 4

Convergence in space for some fractional orders with \(\tau =0.01\)

Example 2

To see whether the method works for the case in which there is no source term, consider the problem (1.1)–(1.3) with the initial condition \(u(x,y,0)=x(x-1)\sin {(2\pi y)}\), \(\kappa =1\) and no source term (Yang and Zhang 2014).

The spectral convergence in space is seen from Fig. 4 in which the time step length is considered to be \(\tau =0.01.\) The solution with \(N_{x}=N_{y}=10\) is treated as the exact solution. The errors are reported at \(t=1\) with the \(H^{1}\)-norm.

The numerical examples present the spectral convergence in space and fixed convergence of \(O(\tau ^{2-\alpha })\) in time, confirming the theoretical claims. It should be noted that we have used the eight-point Gauss–Legendre quadrature rule to perform the integrals (3.12) in the right hand side of the linear system (3.13).

6 Conclusion

In this paper, some new aspects of the dual Bernstein polynomials have been discussed. A suitable compact combinations of these polynomials has been derived for developing a dual-Petrov–Galerkin variational formulation for the numerical simulation of the two-dimensional subdiffusion equation. It is shown that the method leads to sparse linear systems. The illustrated numerical examples have been provided to show the accuracy of the method. It is important to note that the transformation matrices and the operational matrix for differentiation of dual Bernstein polynomials that have been obtained in this work can be used similarly for developing Bernstein-based dual-Petrov–Galerkin Galerkin methods for other fractional partial differential equations on bounded domains.